summaryrefslogtreecommitdiff
path: root/plugingui/mainwindow.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2019-02-11 10:52:30 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2019-02-11 10:52:30 +0100
commit43c2a51331d3e91d86ef50c5262920bdaa260925 (patch)
treeffc5b03be36537e6f028df935a251493d4557979 /plugingui/mainwindow.cc
parent152423c0274887415b50c0d31828036a8fe54708 (diff)
Show/hide drumkit tab depending on if the current kit has a valid image attached or not.
Diffstat (limited to 'plugingui/mainwindow.cc')
-rw-r--r--plugingui/mainwindow.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/plugingui/mainwindow.cc b/plugingui/mainwindow.cc
index a0364fa..a625bc3 100644
--- a/plugingui/mainwindow.cc
+++ b/plugingui/mainwindow.cc
@@ -51,8 +51,12 @@ MainWindow::MainWindow(Settings& settings, void* native_window)
tabs.setTabWidth(100);
tabs.move(16, 0); // x-offset to make room for the left side bar.
tabs.addTab("Main", &main_tab);
- tabs.addTab("Drumkit", &drumkit_tab);
+ drumkit_tab_id = tabs.addTab("Drumkit", &drumkit_tab);
+ changeDrumkitTabVisibility(false); // Hide while no kit is loaded
tabs.addTab("About", &about_tab);
+
+ CONNECT(&drumkit_tab, imageChangeNotifier,
+ this, &MainWindow::changeDrumkitTabVisibility);
}
MainWindow::~MainWindow()
@@ -105,6 +109,16 @@ void MainWindow::sizeChanged(std::size_t width, std::size_t height)
tabs.resize(std::max((int)width - 2 * 16, 0), height);
}
+void MainWindow::changeDrumkitTabVisibility(bool visible)
+{
+ // TODO: Check if the currently active tab is the drumkit tab and switch to
+ // the main tab if it is.
+
+ // TODO: Add disabled state to the TabButtons and make it disabled instead of
+ // hidden here.
+ tabs.setVisible(drumkit_tab_id, visible);
+}
+
void MainWindow::closeEventHandler()
{
closing = true;