diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index ff34233..4d65a0a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -190,26 +190,13 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
ui->tabWidget->setTabVisible(Tabs::XMRIG, false);
#endif
- // CCS/Reddit widget
- m_ccsWidget = new CCSWidget(this);
- m_redditWidget = new RedditWidget(this);
+ connect(ui->ccsWidget, &CCSWidget::selected, this, &MainWindow::showSendScreen);
+ connect(m_ctx, &AppContext::ccsUpdated, ui->ccsWidget->model(), &CCSModel::updateEntries);
+ connect(m_ctx, &AppContext::redditUpdated, ui->redditWidget->model(), &RedditModel::updatePosts);
- m_ccsWidget->hide();
- m_redditWidget->hide();
-
- ui->coolLayout->addWidget(m_ccsWidget);
- ui->coolLayout->addWidget(m_redditWidget);
-
- connect(m_ctx, &AppContext::ccsEmpty, [=] {
- if(m_ccsWidget->isVisible()) {
- // display Reddit widget instead
- m_ccsWidget->show();
- m_redditWidget->show();
- }
+ connect(ui->tabHomeWidget, &QTabWidget::currentChanged, [](int index){
+ config()->set(Config::homeWidget, TabsHome(index));
});
- connect(m_ctx, &AppContext::ccsUpdated, m_ccsWidget->model(), &CCSModel::updateEntries);
- connect(m_ctx, &AppContext::redditUpdated, m_redditWidget->model(), &RedditModel::updatePosts);
- connect(m_ccsWidget, &CCSWidget::selected, this, &MainWindow::showSendScreen);
connect(m_ctx, &AppContext::donationNag, [=]{
auto msg = "Feather is a 100% community-sponsored endeavor. Please consider supporting "
@@ -282,9 +269,6 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, m_ctx, &AppContext::onPreferredFiatCurrencyChanged);
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, ui->sendWidget, QOverload<>::of(&SendWidget::onPreferredFiatCurrencyChanged));
- // CCS/Reddit widget
- connect(m_windowSettings, &Settings::homeWidgetChanged, this, &MainWindow::homeWidgetChanged);
-
// Skin
connect(m_windowSettings, &Settings::skinChanged, this, &MainWindow::skinChanged);
@@ -538,15 +522,8 @@ void MainWindow::menuToggleTabVisible(const QString &key){
}
void MainWindow::initWidgets() {
- auto homeWidget = config()->get(Config::homeWidget).toString();
- if(homeWidget == QString("ccs")) {
- m_ccsWidget->show();
- } else if (homeWidget == "reddit") {
- m_redditWidget->show();
- } else {
- config()->set(Config::homeWidget, "ccs");
- m_ccsWidget->show();
- }
+ int homeWidget = config()->get(Config::homeWidget).toInt();
+ ui->tabHomeWidget->setCurrentIndex(TabsHome(homeWidget));
}
WalletWizard *MainWindow::createWizard(WalletWizard::Page startPage){
@@ -1047,16 +1024,6 @@ void MainWindow::skinChanged(const QString &skinName) {
qDebug() << QString("Skin changed to %1").arg(skinName);
}
-void MainWindow::homeWidgetChanged(const QString &widgetName) {
- if(widgetName == "ccs"){
- m_ccsWidget->show();
- m_redditWidget->hide();
- } else if(widgetName == "reddit") {
- m_ccsWidget->hide();
- m_redditWidget->show();
- }
-}
-
void MainWindow::closeEvent(QCloseEvent *event) {
cleanupBeforeClose();
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 2bc86c6..9ee6f38 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -81,6 +81,11 @@ public:
XMRIG
};
+ enum TabsHome {
+ CCS,
+ REDDIT
+ };
+
public slots:
void initWidgets();
void initMenu();
@@ -102,7 +107,6 @@ public slots:
void showSendTab();
void showHistoryTab();
void showSendScreen(const CCSEntry &entry);
- void homeWidgetChanged(const QString &widgetName);
void skinChanged(const QString &skinName);
void menuTorClicked();
void onBlockchainSync(int height, int target);
@@ -177,9 +181,6 @@ private:
bool m_windowSpawned = false;
- CCSWidget *m_ccsWidget = nullptr;
- RedditWidget *m_redditWidget = nullptr;
-
QSystemTrayIcon *m_trayIcon;
QMenu m_trayMenu;
QAction *m_trayActionCalc;
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index b564772..bf486f1 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -87,31 +87,65 @@
-
-
+
Qt::Horizontal
-
-
-
- 9
+
+
+ 1
-
-
-
-
- Qt::Vertical
+
+ true
+
+
+
+ CCS
+
+
+
+ 0
-
-
- 0
- 40
-
+
+ 0
-
-
-
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+
+
+ /r/Monero
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+
+
@@ -734,6 +768,18 @@
1
+
+ CCSWidget
+ QWidget
+
+ 1
+
+
+ RedditWidget
+ QWidget
+
+ 1
+
diff --git a/src/settings.cpp b/src/settings.cpp
index 018f044..3c47349 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -38,16 +38,11 @@ Settings::Settings(QWidget *parent) :
ui->checkBox_hideBalance->setChecked(config()->get(Config::hideBalance).toBool());
// setup comboboxes
- auto settingsHomeWidget = config()->get(Config::homeWidget).toString();
- if (m_homeWidgets.contains(settingsHomeWidget))
- ui->comboBox_homeWidget->setCurrentIndex(m_homeWidgets.indexOf(settingsHomeWidget));
-
this->setupSkinCombobox();
auto settingsSkin = config()->get(Config::skin).toString();
if (m_skins.contains(settingsSkin))
ui->comboBox_skin->setCurrentIndex(m_skins.indexOf(settingsSkin));
- connect(ui->comboBox_homeWidget, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_homeWidgetChanged);
connect(ui->comboBox_skin, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_skinChanged);
connect(ui->comboBox_blockExplorer, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_blockExplorerChanged);
@@ -83,12 +78,6 @@ void Settings::comboBox_skinChanged(int pos) {
emit skinChanged(m_skins.at(pos));
}
-void Settings::comboBox_homeWidgetChanged(int pos) {
- config()->set(Config::homeWidget, m_homeWidgets.at(pos));
-
- emit homeWidgetChanged(m_homeWidgets.at(pos));
-}
-
void Settings::comboBox_blockExplorerChanged(int pos) {
QString blockExplorer = ui->comboBox_blockExplorer->currentText();
config()->set(Config::blockExplorer, blockExplorer);
diff --git a/src/settings.h b/src/settings.h
index 14f760b..075ad09 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -26,7 +26,6 @@ public:
signals:
void closed();
void preferredFiatCurrencyChanged(QString currency);
- void homeWidgetChanged(QString widgetName);
void skinChanged(QString skinName);
void showHomeCCS(bool);
void blockExplorerChanged(QString blockExplorer);
@@ -35,12 +34,10 @@ public slots:
void copyToClipboard();
void checkboxExternalLinkWarn();
void fiatCurrencySelected(int index);
- void comboBox_homeWidgetChanged(int pos);
void comboBox_skinChanged(int pos);
void comboBox_blockExplorerChanged(int post);
private:
- const QStringList m_homeWidgets{"ccs", "reddit"};
QStringList m_skins{"Native", "QDarkStyle", "Breeze/Dark", "Breeze/Light"};
private:
diff --git a/src/settings.ui b/src/settings.ui
index 1beb169..d973835 100644
--- a/src/settings.ui
+++ b/src/settings.ui
@@ -7,7 +7,7 @@
0
0
1019
- 358
+ 336
@@ -121,44 +121,23 @@
-
-
-
- Home screen widget:
-
-
-
- -
-
-
-
-
- CCS proposals
-
-
- -
-
- /r/monero
-
-
-
-
- -
Appearance:
- -
+
-
- -
+
-
Block explorer:
- -
+
-
-
@@ -182,14 +161,14 @@
- -
+
-
Warn before opening external link
- -
+
-
Hide balance
diff --git a/src/widgets/ccswidget.ui b/src/widgets/ccswidget.ui
index 880027a..c02ad8f 100644
--- a/src/widgets/ccswidget.ui
+++ b/src/widgets/ccswidget.ui
@@ -48,39 +48,6 @@
- -
-
-
- 0
-
-
-
-
-
- false
-
-
- Powered by ccs.getmonero.org
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
diff --git a/src/widgets/redditwidget.ui b/src/widgets/redditwidget.ui
index 4521378..ef63a43 100644
--- a/src/widgets/redditwidget.ui
+++ b/src/widgets/redditwidget.ui
@@ -51,36 +51,6 @@
- -
-
-
-
-
-
- false
-
-
- Powered by Reddit
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-