]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
menu: make view tabs checkable
authortobtoht <tob@featherwallet.org>
Wed, 26 Mar 2025 09:16:31 +0000 (10:16 +0100)
committertobtoht <tob@featherwallet.org>
Wed, 26 Mar 2025 09:16:31 +0000 (10:16 +0100)
src/MainWindow.cpp
src/MainWindow.ui

index 84eba76dcf654afd75801a91804aa88e36d88a44..804adcec65b5fc91cdeab3f7de413e4d8f6b3ba7 100644 (file)
@@ -356,7 +356,7 @@ void MainWindow::initMenu() {
             continue;
         }
 
-        auto* pluginAction = new QAction(QString("Show %1").arg(plugin->displayName()), this);
+        auto* pluginAction = new QAction(plugin->displayName(), this);
         ui->menuView->insertAction(plugin->insertFirst() ? ui->actionPlaceholderBegin : ui->actionPlaceholderEnd, pluginAction);
         connect(pluginAction, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
         m_tabShowHideMapper[plugin->displayName()] = new ToggleTab(plugin->tab(), plugin->displayName(), plugin->displayName(), pluginAction, this);
@@ -370,7 +370,9 @@ void MainWindow::initMenu() {
         const auto toggleTab = m_tabShowHideMapper.value(key);
         bool show = enabledTabs.contains(key);
 
-        toggleTab->menuAction->setText((show ? QString("Hide ") : QString("Show ")) + toggleTab->name);
+        toggleTab->menuAction->setText(toggleTab->name);
+        toggleTab->menuAction->setCheckable(true);
+        toggleTab->menuAction->setChecked(show);
         ui->tabWidget->setTabVisible(ui->tabWidget->indexOf(toggleTab->tab), show);
     }
     connect(m_tabShowHideSignalMapper, &QSignalMapper::mappedString, this, &MainWindow::menuToggleTabVisible);
@@ -539,7 +541,7 @@ void MainWindow::menuToggleTabVisible(const QString &key){
 
     conf()->set(Config::enabledTabs, enabledTabs);
     ui->tabWidget->setTabVisible(ui->tabWidget->indexOf(toggleTab->tab), show);
-    toggleTab->menuAction->setText((show ? QString("Hide ") : QString("Show ")) + toggleTab->name);
+    toggleTab->menuAction->setText(toggleTab->name);
 }
 
 void MainWindow::menuClearHistoryClicked() {
index 89b539d7e51a11e00f29081edb1017cc0f2606c3..a7d177bc746f19781599a4a9a6aa04ef30a27a60 100644 (file)
    </property>
   </action>
   <action name="actionShow_Coins">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
    <property name="text">
-    <string>Show Coins</string>
+    <string>Coins</string>
    </property>
   </action>
   <action name="actionShow_xmr_to">
    </property>
   </action>
   <action name="actionShow_Contacts">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
    <property name="text">
-    <string>Show Contacts</string>
+    <string>Contacts</string>
    </property>
   </action>
   <action name="actionShow_Notes">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
    <property name="text">
-    <string>Show Notes</string>
+    <string>Notes</string>
    </property>
   </action>
  </widget>