mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 07:11:29 +02:00
Avoid writing config on tab change
This commit is contained in:
+2
-3
@@ -170,9 +170,6 @@ void MainWindow::initStatusBar() {
|
||||
void MainWindow::initWidgets() {
|
||||
int homeWidget = config()->get(Config::homeWidget).toInt();
|
||||
ui->tabHomeWidget->setCurrentIndex(TabsHome(homeWidget));
|
||||
connect(ui->tabHomeWidget, &QTabWidget::currentChanged, [](int index){
|
||||
config()->set(Config::homeWidget, TabsHome(index));
|
||||
});
|
||||
|
||||
// [History]
|
||||
m_historyWidget = new HistoryWidget(m_ctx, this);
|
||||
@@ -908,6 +905,8 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
if (!this->cleanedUp) {
|
||||
this->cleanedUp = true;
|
||||
|
||||
config()->set(Config::homeWidget, ui->tabHomeWidget->currentIndex());
|
||||
|
||||
m_historyWidget->resetModel();
|
||||
|
||||
m_updateBytes.stop();
|
||||
|
||||
+4
-2
@@ -90,8 +90,10 @@ public:
|
||||
};
|
||||
|
||||
enum TabsHome {
|
||||
CCS,
|
||||
REDDIT
|
||||
CCS = 0,
|
||||
BOUNTIES,
|
||||
REDDIT,
|
||||
REVUO
|
||||
};
|
||||
|
||||
void showOrHide();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "Icons.h"
|
||||
#include "utils/WebsocketNotifier.h"
|
||||
@@ -22,9 +23,6 @@ Settings::Settings(QSharedPointer<AppContext> ctx, QWidget *parent)
|
||||
|
||||
ui->tabWidget->setTabVisible(5, false);
|
||||
ui->tabWidget->setCurrentIndex(config()->get(Config::lastSettingsPage).toInt());
|
||||
connect(ui->tabWidget, &QTabWidget::currentChanged, [](int index){
|
||||
config()->set(Config::lastSettingsPage, index);
|
||||
});
|
||||
|
||||
this->setupGeneralTab();
|
||||
this->setupPrivacyTab();
|
||||
@@ -270,4 +268,9 @@ void Settings::enableWebsocket(bool enabled) {
|
||||
emit websocketStatusChanged(enabled);
|
||||
}
|
||||
|
||||
void Settings::closeEvent(QCloseEvent *event) {
|
||||
config()->set(Config::lastSettingsPage, ui->tabWidget->currentIndex());
|
||||
event->accept();
|
||||
}
|
||||
|
||||
Settings::~Settings() = default;
|
||||
@@ -53,6 +53,8 @@ private:
|
||||
void setupLocalMoneroFrontendCombobox();
|
||||
void enableWebsocket(bool enabled);
|
||||
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
QScopedPointer<Ui::Settings> ui;
|
||||
QSharedPointer<AppContext> m_ctx;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user