mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-10 12:54:46 +00:00
Home: add tabs for home widgets
This commit is contained in:
parent
855755fea3
commit
a9ec69afd0
8 changed files with 80 additions and 164 deletions
|
@ -190,26 +190,13 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
|
||||||
ui->tabWidget->setTabVisible(Tabs::XMRIG, false);
|
ui->tabWidget->setTabVisible(Tabs::XMRIG, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CCS/Reddit widget
|
connect(ui->ccsWidget, &CCSWidget::selected, this, &MainWindow::showSendScreen);
|
||||||
m_ccsWidget = new CCSWidget(this);
|
connect(m_ctx, &AppContext::ccsUpdated, ui->ccsWidget->model(), &CCSModel::updateEntries);
|
||||||
m_redditWidget = new RedditWidget(this);
|
connect(m_ctx, &AppContext::redditUpdated, ui->redditWidget->model(), &RedditModel::updatePosts);
|
||||||
|
|
||||||
m_ccsWidget->hide();
|
connect(ui->tabHomeWidget, &QTabWidget::currentChanged, [](int index){
|
||||||
m_redditWidget->hide();
|
config()->set(Config::homeWidget, TabsHome(index));
|
||||||
|
|
||||||
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(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, [=]{
|
connect(m_ctx, &AppContext::donationNag, [=]{
|
||||||
auto msg = "Feather is a 100% community-sponsored endeavor. Please consider supporting "
|
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, m_ctx, &AppContext::onPreferredFiatCurrencyChanged);
|
||||||
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, ui->sendWidget, QOverload<>::of(&SendWidget::onPreferredFiatCurrencyChanged));
|
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, ui->sendWidget, QOverload<>::of(&SendWidget::onPreferredFiatCurrencyChanged));
|
||||||
|
|
||||||
// CCS/Reddit widget
|
|
||||||
connect(m_windowSettings, &Settings::homeWidgetChanged, this, &MainWindow::homeWidgetChanged);
|
|
||||||
|
|
||||||
// Skin
|
// Skin
|
||||||
connect(m_windowSettings, &Settings::skinChanged, this, &MainWindow::skinChanged);
|
connect(m_windowSettings, &Settings::skinChanged, this, &MainWindow::skinChanged);
|
||||||
|
|
||||||
|
@ -538,15 +522,8 @@ void MainWindow::menuToggleTabVisible(const QString &key){
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::initWidgets() {
|
void MainWindow::initWidgets() {
|
||||||
auto homeWidget = config()->get(Config::homeWidget).toString();
|
int homeWidget = config()->get(Config::homeWidget).toInt();
|
||||||
if(homeWidget == QString("ccs")) {
|
ui->tabHomeWidget->setCurrentIndex(TabsHome(homeWidget));
|
||||||
m_ccsWidget->show();
|
|
||||||
} else if (homeWidget == "reddit") {
|
|
||||||
m_redditWidget->show();
|
|
||||||
} else {
|
|
||||||
config()->set(Config::homeWidget, "ccs");
|
|
||||||
m_ccsWidget->show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletWizard *MainWindow::createWizard(WalletWizard::Page startPage){
|
WalletWizard *MainWindow::createWizard(WalletWizard::Page startPage){
|
||||||
|
@ -1047,16 +1024,6 @@ void MainWindow::skinChanged(const QString &skinName) {
|
||||||
qDebug() << QString("Skin changed to %1").arg(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) {
|
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
cleanupBeforeClose();
|
cleanupBeforeClose();
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,11 @@ public:
|
||||||
XMRIG
|
XMRIG
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TabsHome {
|
||||||
|
CCS,
|
||||||
|
REDDIT
|
||||||
|
};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void initWidgets();
|
void initWidgets();
|
||||||
void initMenu();
|
void initMenu();
|
||||||
|
@ -102,7 +107,6 @@ public slots:
|
||||||
void showSendTab();
|
void showSendTab();
|
||||||
void showHistoryTab();
|
void showHistoryTab();
|
||||||
void showSendScreen(const CCSEntry &entry);
|
void showSendScreen(const CCSEntry &entry);
|
||||||
void homeWidgetChanged(const QString &widgetName);
|
|
||||||
void skinChanged(const QString &skinName);
|
void skinChanged(const QString &skinName);
|
||||||
void menuTorClicked();
|
void menuTorClicked();
|
||||||
void onBlockchainSync(int height, int target);
|
void onBlockchainSync(int height, int target);
|
||||||
|
@ -177,9 +181,6 @@ private:
|
||||||
|
|
||||||
bool m_windowSpawned = false;
|
bool m_windowSpawned = false;
|
||||||
|
|
||||||
CCSWidget *m_ccsWidget = nullptr;
|
|
||||||
RedditWidget *m_redditWidget = nullptr;
|
|
||||||
|
|
||||||
QSystemTrayIcon *m_trayIcon;
|
QSystemTrayIcon *m_trayIcon;
|
||||||
QMenu m_trayMenu;
|
QMenu m_trayMenu;
|
||||||
QAction *m_trayActionCalc;
|
QAction *m_trayActionCalc;
|
||||||
|
|
|
@ -87,31 +87,65 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="homeLine">
|
<widget class="Line" name="line">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="coolLayout">
|
<widget class="QTabWidget" name="tabHomeWidget">
|
||||||
<property name="spacing">
|
<property name="currentIndex">
|
||||||
<number>9</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="documentMode">
|
||||||
<spacer name="verticalSpacer">
|
<bool>true</bool>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Vertical</enum>
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>CCS</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="topMargin">
|
||||||
<size>
|
<number>0</number>
|
||||||
<width>0</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="rightMargin">
|
||||||
</item>
|
<number>0</number>
|
||||||
</layout>
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="CCSWidget" name="ccsWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>/r/Monero</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="RedditWidget" name="redditWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -734,6 +768,18 @@
|
||||||
<header>MorphTokenWidget.h</header>
|
<header>MorphTokenWidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>CCSWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>widgets/ccswidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>RedditWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>widgets/redditwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="assets.qrc"/>
|
<include location="assets.qrc"/>
|
||||||
|
|
|
@ -38,16 +38,11 @@ Settings::Settings(QWidget *parent) :
|
||||||
ui->checkBox_hideBalance->setChecked(config()->get(Config::hideBalance).toBool());
|
ui->checkBox_hideBalance->setChecked(config()->get(Config::hideBalance).toBool());
|
||||||
|
|
||||||
// setup comboboxes
|
// setup comboboxes
|
||||||
auto settingsHomeWidget = config()->get(Config::homeWidget).toString();
|
|
||||||
if (m_homeWidgets.contains(settingsHomeWidget))
|
|
||||||
ui->comboBox_homeWidget->setCurrentIndex(m_homeWidgets.indexOf(settingsHomeWidget));
|
|
||||||
|
|
||||||
this->setupSkinCombobox();
|
this->setupSkinCombobox();
|
||||||
auto settingsSkin = config()->get(Config::skin).toString();
|
auto settingsSkin = config()->get(Config::skin).toString();
|
||||||
if (m_skins.contains(settingsSkin))
|
if (m_skins.contains(settingsSkin))
|
||||||
ui->comboBox_skin->setCurrentIndex(m_skins.indexOf(settingsSkin));
|
ui->comboBox_skin->setCurrentIndex(m_skins.indexOf(settingsSkin));
|
||||||
|
|
||||||
connect(ui->comboBox_homeWidget, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_homeWidgetChanged);
|
|
||||||
connect(ui->comboBox_skin, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_skinChanged);
|
connect(ui->comboBox_skin, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_skinChanged);
|
||||||
connect(ui->comboBox_blockExplorer, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_blockExplorerChanged);
|
connect(ui->comboBox_blockExplorer, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_blockExplorerChanged);
|
||||||
|
|
||||||
|
@ -83,12 +78,6 @@ void Settings::comboBox_skinChanged(int pos) {
|
||||||
emit skinChanged(m_skins.at(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) {
|
void Settings::comboBox_blockExplorerChanged(int pos) {
|
||||||
QString blockExplorer = ui->comboBox_blockExplorer->currentText();
|
QString blockExplorer = ui->comboBox_blockExplorer->currentText();
|
||||||
config()->set(Config::blockExplorer, blockExplorer);
|
config()->set(Config::blockExplorer, blockExplorer);
|
||||||
|
|
|
@ -26,7 +26,6 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void closed();
|
void closed();
|
||||||
void preferredFiatCurrencyChanged(QString currency);
|
void preferredFiatCurrencyChanged(QString currency);
|
||||||
void homeWidgetChanged(QString widgetName);
|
|
||||||
void skinChanged(QString skinName);
|
void skinChanged(QString skinName);
|
||||||
void showHomeCCS(bool);
|
void showHomeCCS(bool);
|
||||||
void blockExplorerChanged(QString blockExplorer);
|
void blockExplorerChanged(QString blockExplorer);
|
||||||
|
@ -35,12 +34,10 @@ public slots:
|
||||||
void copyToClipboard();
|
void copyToClipboard();
|
||||||
void checkboxExternalLinkWarn();
|
void checkboxExternalLinkWarn();
|
||||||
void fiatCurrencySelected(int index);
|
void fiatCurrencySelected(int index);
|
||||||
void comboBox_homeWidgetChanged(int pos);
|
|
||||||
void comboBox_skinChanged(int pos);
|
void comboBox_skinChanged(int pos);
|
||||||
void comboBox_blockExplorerChanged(int post);
|
void comboBox_blockExplorerChanged(int post);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QStringList m_homeWidgets{"ccs", "reddit"};
|
|
||||||
QStringList m_skins{"Native", "QDarkStyle", "Breeze/Dark", "Breeze/Light"};
|
QStringList m_skins{"Native", "QDarkStyle", "Breeze/Dark", "Breeze/Light"};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1019</width>
|
<width>1019</width>
|
||||||
<height>358</height>
|
<height>336</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -121,44 +121,23 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Home screen widget:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBox_homeWidget">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>CCS proposals</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>/r/monero</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Appearance:</string>
|
<string>Appearance:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="comboBox_skin"/>
|
<widget class="QComboBox" name="comboBox_skin"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Block explorer:</string>
|
<string>Block explorer:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="comboBox_blockExplorer">
|
<widget class="QComboBox" name="comboBox_blockExplorer">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -182,14 +161,14 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="checkBox_externalLink">
|
<widget class="QCheckBox" name="checkBox_externalLink">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Warn before opening external link</string>
|
<string>Warn before opening external link</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="checkBox_hideBalance">
|
<widget class="QCheckBox" name="checkBox_hideBalance">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Hide balance</string>
|
<string>Hide balance</string>
|
||||||
|
|
|
@ -48,39 +48,6 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="warnLabel">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Powered by ccs.getmonero.org</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -51,36 +51,6 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Powered by Reddit</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
Loading…
Reference in a new issue