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