Merge pull request 'Mainwindow: fix tab order and stylization' (#104) from tobtoht/feather:tabs_order into master

Reviewed-on: https://git.wownero.com/feather/feather/pulls/104
Reviewed-by: dsc <dsc@noreply.gitgud.wownero.nl>
This commit is contained in:
dsc 2020-10-21 12:25:46 +00:00
commit fa6ee35fb0
3 changed files with 45 additions and 31 deletions

View file

@ -118,10 +118,9 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
connect(m_ctx->XMRTo, &XmrTo::openURL, this, [=](const QString &url){ Utils::externalLinkWarning(url); }); connect(m_ctx->XMRTo, &XmrTo::openURL, this, [=](const QString &url){ Utils::externalLinkWarning(url); });
ui->xmrToWidget->setHistoryModel(m_ctx->XMRTo->tableModel); ui->xmrToWidget->setHistoryModel(m_ctx->XMRTo->tableModel);
#else #else
ui->tabWidget->setTabVisible(5, false); ui->tabWidget->setTabVisible(Tabs::XMR_TO, false);
#endif #endif
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
// system tray // system tray
m_trayIcon = new QSystemTrayIcon(QIcon(":/assets/images/appicons/64x64.png")); m_trayIcon = new QSystemTrayIcon(QIcon(":/assets/images/appicons/64x64.png"));
@ -183,6 +182,8 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
connect(m_xmrig, &XMRigWidget::miningStarted, [=]{ m_ctx->setWindowTitle(true); }); connect(m_xmrig, &XMRigWidget::miningStarted, [=]{ m_ctx->setWindowTitle(true); });
connect(m_xmrig, &XMRigWidget::miningEnded, [=]{ m_ctx->setWindowTitle(false); }); connect(m_xmrig, &XMRigWidget::miningEnded, [=]{ m_ctx->setWindowTitle(false); });
#else
ui->tabWidget->setTabVisible(Tabs::XMRIG, false);
#endif #endif
// CCS/Reddit widget // CCS/Reddit widget
@ -296,7 +297,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
}); });
connect(ui->receiveWidget, &ReceiveWidget::showTransactions, [this](const QString &text) { connect(ui->receiveWidget, &ReceiveWidget::showTransactions, [this](const QString &text) {
ui->historyWidget->setSearchText(text); ui->historyWidget->setSearchText(text);
ui->tabWidget->setCurrentIndex(1); //history ui->tabWidget->setCurrentIndex(Tabs::HISTORY);
}); });
// History // History
@ -344,7 +345,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
connect(ui->coinsWidget, &CoinsWidget::sweepOutput, m_ctx, &AppContext::onSweepOutput); connect(ui->coinsWidget, &CoinsWidget::sweepOutput, m_ctx, &AppContext::onSweepOutput);
connect(m_ctx, &AppContext::walletClosing, [=]{ connect(m_ctx, &AppContext::walletClosing, [=]{
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(Tabs::HOME);
}); });
// window title // window title
@ -390,9 +391,14 @@ void MainWindow::initMenu() {
connect(ui->actionShow_Coins, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map)); connect(ui->actionShow_Coins, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
m_tabShowHideMapper["Coins"] = new ToggleTab(ui->tabCoins, "Coins", "Coins", ui->actionShow_Coins, Config::showTabCoins); m_tabShowHideMapper["Coins"] = new ToggleTab(ui->tabCoins, "Coins", "Coins", ui->actionShow_Coins, Config::showTabCoins);
m_tabShowHideSignalMapper->setMapping(ui->actionShow_Coins, "Coins"); m_tabShowHideSignalMapper->setMapping(ui->actionShow_Coins, "Coins");
connect(ui->actionShow_calc, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
m_tabShowHideMapper["Calc"] = new ToggleTab(ui->tabCalc, "Calc", "Calc", ui->actionShow_calc, Config::showTabCalc);
m_tabShowHideSignalMapper->setMapping(ui->actionShow_calc, "Calc");
#if defined(XMRTO) #if defined(XMRTO)
connect(ui->actionShow_xmr_to, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map)); connect(ui->actionShow_xmr_to, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
m_tabShowHideMapper["XMRto"] = new ToggleTab(ui->tabXmrTo, "XMRto", "xmr.to", ui->actionShow_xmr_to, Config::showTabXMRto); m_tabShowHideMapper["XMRto"] = new ToggleTab(ui->tabXmrTo, "XMRto", "XMR.to", ui->actionShow_xmr_to, Config::showTabXMRto);
m_tabShowHideSignalMapper->setMapping(ui->actionShow_xmr_to, "XMRto"); m_tabShowHideSignalMapper->setMapping(ui->actionShow_xmr_to, "XMRto");
#else #else
ui->actionShow_xmr_to->setVisible(false); ui->actionShow_xmr_to->setVisible(false);
@ -405,9 +411,6 @@ void MainWindow::initMenu() {
#else #else
ui->actionShow_XMRig->setVisible(false); ui->actionShow_XMRig->setVisible(false);
#endif #endif
connect(ui->actionShow_calc, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
m_tabShowHideMapper["Calc"] = new ToggleTab(ui->tabCalc, "Calc", "Calc", ui->actionShow_calc, Config::showTabCalc);
m_tabShowHideSignalMapper->setMapping(ui->actionShow_calc, "Calc");
for (const auto &key: m_tabShowHideMapper.keys()) { for (const auto &key: m_tabShowHideMapper.keys()) {
const auto toggleTab = m_tabShowHideMapper.value(key); const auto toggleTab = m_tabShowHideMapper.value(key);
@ -1011,17 +1014,17 @@ void MainWindow::donateButtonClicked() {
donation = 1.337; donation = 1.337;
ui->sendWidget->fill(m_ctx->featherDonationAddress, "Donation to the Feather development team", donation); ui->sendWidget->fill(m_ctx->featherDonationAddress, "Donation to the Feather development team", donation);
ui->tabWidget->setCurrentIndex(2); ui->tabWidget->setCurrentIndex(Tabs::SEND);
} }
void MainWindow::showHistoryTab() { void MainWindow::showHistoryTab() {
this->raise(); this->raise();
ui->tabWidget->setCurrentIndex(1); ui->tabWidget->setCurrentIndex(Tabs::HISTORY);
} }
void MainWindow::showSendTab() { void MainWindow::showSendTab() {
this->raise(); this->raise();
ui->tabWidget->setCurrentIndex(2); ui->tabWidget->setCurrentIndex(Tabs::SEND);
} }
void MainWindow::showCalcWindow() { void MainWindow::showCalcWindow() {
@ -1030,7 +1033,7 @@ void MainWindow::showCalcWindow() {
void MainWindow::showSendScreen(const CCSEntry &entry) { void MainWindow::showSendScreen(const CCSEntry &entry) {
ui->sendWidget->fill(entry); ui->sendWidget->fill(entry);
ui->tabWidget->setCurrentIndex(2); ui->tabWidget->setCurrentIndex(Tabs::SEND);
} }
void MainWindow::onViewOnBlockExplorer(const QString &txid) { void MainWindow::onViewOnBlockExplorer(const QString &txid) {

View file

@ -65,6 +65,17 @@ public:
qreal screenDpiPhysical; qreal screenDpiPhysical;
qreal screenRatio; qreal screenRatio;
enum Tabs {
HOME = 0,
HISTORY,
SEND,
RECEIVE,
COINS,
CALC,
XMR_TO,
XMRIG
};
public slots: public slots:
void initWidgets(); void initWidgets();
void initMenu(); void initMenu();

View file

@ -224,13 +224,27 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabCalc">
<attribute name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/images/coldcard.png</normaloff>:/assets/images/coldcard.png</iconset>
</attribute>
<attribute name="title">
<string>Calc</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="CalcWidget" name="conversionWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabXmrTo"> <widget class="QWidget" name="tabXmrTo">
<attribute name="icon"> <attribute name="icon">
<iconset resource="assets.qrc"> <iconset resource="assets.qrc">
<normaloff>:/assets/images/xmrto.png</normaloff>:/assets/images/xmrto.png</iconset> <normaloff>:/assets/images/xmrto.png</normaloff>:/assets/images/xmrto.png</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
<string>xmr.to</string> <string>XMR.to</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin"> <property name="leftMargin">
@ -266,27 +280,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabCalc">
<attribute name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/images/coldcard.png</normaloff>:/assets/images/coldcard.png</iconset>
</attribute>
<attribute name="title">
<string>Calc</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="CalcWidget" name="conversionWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabXmrRig"> <widget class="QWidget" name="tabXmrRig">
<attribute name="icon"> <attribute name="icon">
<iconset resource="assets.qrc"> <iconset resource="assets.qrc">
<normaloff>:/assets/images/xmrig.ico</normaloff>:/assets/images/xmrig.ico</iconset> <normaloff>:/assets/images/xmrig.ico</normaloff>:/assets/images/xmrig.ico</iconset>
</attribute> </attribute>
<attribute name="title"> <attribute name="title">
<string>XmrRig</string> <string>XMRig</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
@ -305,7 +305,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>894</width> <width>894</width>
<height>22</height> <height>30</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -416,8 +416,8 @@
<string>View</string> <string>View</string>
</property> </property>
<addaction name="actionShow_Coins"/> <addaction name="actionShow_Coins"/>
<addaction name="actionShow_xmr_to"/>
<addaction name="actionShow_calc"/> <addaction name="actionShow_calc"/>
<addaction name="actionShow_xmr_to"/>
<addaction name="actionShow_XMRig"/> <addaction name="actionShow_XMRig"/>
</widget> </widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
@ -506,7 +506,7 @@
</action> </action>
<action name="actionShow_xmr_to"> <action name="actionShow_xmr_to">
<property name="text"> <property name="text">
<string>Show Xmr.To</string> <string>Show XMR.to</string>
</property> </property>
</action> </action>
<action name="actionShow_calc"> <action name="actionShow_calc">