aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.h
diff options
context:
space:
mode:
authorLibravatar Keshav Bhatt <keshavnrj@gmail.com>2023-05-17 21:59:43 +0530
committerLibravatar Keshav Bhatt <keshavnrj@gmail.com>2023-05-17 21:59:43 +0530
commit5f10a0f9657358fcd86c55ec065f3855bad0c160 (patch)
tree340f949dbe076db57bf62879ad150fabc884905a /src/mainwindow.h
parentb4b5dc3397966bea899bbb5ec0f756bb745dbff1 (diff)
downloadwhatsie-5f10a0f9657358fcd86c55ec065f3855bad0c160.tar.gz
whatsie-5f10a0f9657358fcd86c55ec065f3855bad0c160.zip
feat: minor fixes + code cleanup
Diffstat (limited to 'src/mainwindow.h')
-rw-r--r--src/mainwindow.h105
1 files changed, 51 insertions, 54 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 4ca25d5..c5e2821 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -11,8 +11,6 @@
#include <QMessageBox>
#include <QProgressBar>
#include <QRadioButton>
-#include <QRegExp>
-#include <QSettings>
#include <QStatusBar>
#include <QStyle>
#include <QStyleFactory>
@@ -33,6 +31,7 @@
#include "rateapp.h"
#include "requestinterceptor.h"
#include "settingswidget.h"
+#include "theme.h"
#include "webenginepage.h"
#include "webview.h"
@@ -42,23 +41,25 @@ public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
+ void loadSchemaUrl(const QString &arg);
+ void alreadyRunning(bool notify = false);
+ void runMinimized();
+ void notify(QString title, QString message);
+ void doReload(bool byPassCache = false, bool isAskedByCLI = false,
+ bool byLoadingQuirk = false);
+
public slots:
void updateWindowTheme();
void updatePageTheme();
- void handleWebViewTitleChanged(QString title);
+ void handleWebViewTitleChanged(const QString &title);
void handleLoadFinished(bool loaded);
void handleDownloadRequested(QWebEngineDownloadItem *download);
- void loadSchemaUrl(const QString &arg);
void showSettings(bool isAskedByCLI = false);
void showAbout();
void lockApp();
- void runMinimized();
- void alreadyRunning(bool notify = false);
- void notify(QString title, QString message);
void toggleTheme();
- void doReload(bool byPassCache = false, bool isAskedByCLI = false,
- bool byLoadingQuirk = false);
void newChat();
+
protected slots:
void closeEvent(QCloseEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
@@ -66,71 +67,67 @@ protected slots:
private:
const QIcon getTrayIcon(const int &notificationCount) const;
- QPalette lightPalette, darkPalette;
void createActions();
void createTrayIcon();
void createWebEngine();
-
- QSettings settings;
- QRegExp notificationsTitleRegExp;
- QIcon trayIconNormal;
- QRegExp unreadMessageCountRegExp;
-
- QAction *reloadAction;
- QAction *minimizeAction;
- QAction *restoreAction;
- QAction *aboutAction;
- QAction *settingsAction;
- QAction *toggleThemeAction;
- QAction *quitAction;
- QAction *lockAction;
- QAction *fullscreenAction;
- QAction *openUrlAction;
-
- QMenu *trayIconMenu;
- QSystemTrayIcon *trayIcon;
- QWebEngineView *webEngine;
- SettingsWidget *settingsWidget = nullptr;
- DownloadManagerWidget downloadManagerWidget;
- QScopedPointer<QWebEngineProfile> otrProfile;
- Lock *lockWidget = nullptr;
- int correctlyLoaderRetries = 4;
- QStringList dictionaries;
- AutoLockEventFilter *autoLockEventFilter = nullptr;
-
-private slots:
-
- QString getPageTheme();
- void iconActivated(QSystemTrayIcon::ActivationReason reason);
- void messageClicked();
+ QString getPageTheme() const;
void handleCookieAdded(const QNetworkCookie &cookie);
- void toggleMute(const bool &checked);
void doAppReload();
void askToReloadPage();
void updateSettingsUserAgentWidget();
- void fullScreenRequested(QWebEngineFullScreenRequest request);
void createWebPage(bool offTheRecord = false);
void initSettingWidget();
void initGlobalWebProfile();
- void checkWindowState();
- void initLock();
void tryLock();
void checkLoadedCorrectly();
- void loadingQuirk(QString test);
+ void loadingQuirk(const QString &test);
void setNotificationPresenter(QWebEngineProfile *profile);
- void quitApp();
void initRateWidget();
- void initThemes();
void handleZoomOnWindowStateChange(const QWindowStateChangeEvent *ev);
void handleZoom();
- void changeLockPassword();
void forceLogOut();
- void tryLogOut();
bool isLoggedIn();
+ void tryLogOut();
void initAutoLock();
- void appAutoLockChanged();
- void triggerNewChat(QString phone, QString text);
+ void triggerNewChat(const QString &phone, const QString &text);
void restoreMainWindow();
+
+ QIcon m_trayIconNormal;
+ QRegularExpression m_notificationsTitleRegExp;
+ QRegularExpression m_unreadMessageCountRegExp;
+ DownloadManagerWidget m_downloadManagerWidget;
+ QScopedPointer<QWebEngineProfile> m_otrProfile;
+ int m_correctlyLoadedRetries = 4;
+ QStringList m_dictionaries;
+
+ QAction *m_reloadAction = nullptr;
+ QAction *m_minimizeAction = nullptr;
+ QAction *m_restoreAction = nullptr;
+ QAction *m_aboutAction = nullptr;
+ QAction *m_settingsAction = nullptr;
+ QAction *m_toggleThemeAction = nullptr;
+ QAction *m_quitAction = nullptr;
+ QAction *m_lockAction = nullptr;
+ QAction *m_fullscreenAction = nullptr;
+ QAction *m_openUrlAction = nullptr;
+
+ QMenu *m_trayIconMenu = nullptr;
+ QSystemTrayIcon *m_systemTrayIcon = nullptr;
+ QWebEngineView *m_webEngine = nullptr;
+ SettingsWidget *m_settingsWidget = nullptr;
+ Lock *m_lockWidget = nullptr;
+ AutoLockEventFilter *m_autoLockEventFilter = nullptr;
+
+private slots:
+ void iconActivated(QSystemTrayIcon::ActivationReason reason);
+ void messageClicked();
+ void toggleMute(const bool &checked);
+ void fullScreenRequested(QWebEngineFullScreenRequest request);
+ void checkWindowState();
+ void initLock();
+ void quitApp();
+ void changeLockPassword();
+ void appAutoLockChanged();
};
#endif // MAINWINDOW_H