Refactoring
Ui improvements Bug fixes
This commit is contained in:
parent
3645735053
commit
441811e277
13 changed files with 773 additions and 123 deletions
|
@ -1,7 +1,11 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMainWindow>
|
||||
#include <QProgressBar>
|
||||
#include <QPushButton>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#include "framelesswindow.h"
|
||||
#include "protocols/vpnprotocol.h"
|
||||
|
@ -29,35 +33,61 @@ public:
|
|||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
enum class Page {Initialization = 0, NewServer = 1, Vpn = 2, Sites = 3, SomeSettings = 4, Share = 5};
|
||||
enum Page {Start, NewServer, Vpn, GeneralSettings, ServerSettings, ShareConnection, Sites};
|
||||
Q_ENUM(Page)
|
||||
|
||||
private slots:
|
||||
void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
||||
void onConnectionStateChanged(VpnProtocol::ConnectionState state);
|
||||
void onVpnProtocolError(amnezia::ErrorCode errorCode);
|
||||
|
||||
void onPushButtonBackFromNewServerClicked(bool clicked);
|
||||
void onPushButtonBackFromSettingsClicked(bool clicked);
|
||||
void onPushButtonBackFromSitesClicked(bool clicked);
|
||||
void onPushButtonBlockedListClicked(bool clicked);
|
||||
void onPushButtonConnectToggled(bool checked);
|
||||
void onPushButtonNewServerConnectWithNewData(bool clicked);
|
||||
void onPushButtonNewServerSetup(bool clicked);
|
||||
void onPushButtonSettingsClicked(bool clicked);
|
||||
void onPushButtonConnectClicked(bool checked);
|
||||
void onPushButtonNewServerConnectWithNewData(bool);
|
||||
|
||||
void onPushButtonReinstallServer(bool);
|
||||
void onPushButtonClearServer(bool);
|
||||
void onPushButtonForgetServer(bool);
|
||||
|
||||
void onTrayActionConnect(); // connect from context menu
|
||||
void setTrayState(VpnProtocol::ConnectionState state);
|
||||
|
||||
void onTrayActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
|
||||
void onConnect();
|
||||
void onDisconnect();
|
||||
|
||||
void on_pushButton_close_clicked();
|
||||
|
||||
private:
|
||||
void goToPage(Page page);
|
||||
void goToPage(Page page, bool reset = true, bool slide = true);
|
||||
QWidget *getPageWidget(Page page);
|
||||
Page currentPage();
|
||||
|
||||
bool installServer(ServerCredentials credentials, QWidget *page, QProgressBar *progress, QPushButton *button, QLabel *info);
|
||||
|
||||
void setupTray();
|
||||
void setTrayIcon(const QString &iconPath);
|
||||
|
||||
void setupUiConnections();
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
VpnConnection* m_vpnConnection;
|
||||
Settings* m_settings;
|
||||
|
||||
QAction* m_trayActionConnect;
|
||||
QAction* m_trayActionDisconnect;
|
||||
|
||||
QSystemTrayIcon m_tray;
|
||||
QMenu* m_menu;
|
||||
|
||||
bool canMove = false;
|
||||
QPoint offset;
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
const QString ConnectedTrayIconName = "active.png";
|
||||
const QString DisconnectedTrayIconName = "default.png";
|
||||
const QString ErrorTrayIconName = "error.png";
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue