Skip to content

Commit

Permalink
Add option to move SideBar to right side of window (#5114)
Browse files Browse the repository at this point in the history
  • Loading branch information
Veratil authored May 5, 2020
1 parent 6095bbc commit 1a6f4c1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private slots:
void toggleNoteLabels(bool enabled);
void toggleCompactTrackButtons(bool enabled);
void toggleOneInstrumentTrackWindow(bool enabled);
void toggleSideBarOnRight(bool enabled);
void toggleMMPZ(bool enabled);
void toggleDisableBackup(bool enabled);
void toggleOpenLastProject(bool enabled);
Expand Down Expand Up @@ -130,6 +131,7 @@ private slots:
bool m_printNoteLabels;
bool m_compactTrackButtons;
bool m_oneInstrumentTrackWindow;
bool m_sideBarOnRight;
bool m_MMPZ;
bool m_disableBackup;
bool m_openLastProject;
Expand Down
15 changes: 11 additions & 4 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ MainWindow::MainWindow() :
splitter->setChildrenCollapsible( false );

ConfigManager* confMgr = ConfigManager::inst();
bool sideBarOnRight = confMgr->value("ui", "sidebaronright").toInt();

emit initProgress(tr("Preparing plugin browser"));
sideBar->appendTab( new PluginBrowser( splitter ) );
Expand Down Expand Up @@ -171,7 +172,7 @@ MainWindow::MainWindow() :
embed::getIconPixmap( "computer" ).transformed( QTransform().rotate( 90 ) ),
splitter, dirs_as_items) );

m_workspace = new QMdiArea( splitter );
m_workspace = new QMdiArea(splitter);

// Load background
emit initProgress(tr("Loading background picture"));
Expand All @@ -194,9 +195,15 @@ MainWindow::MainWindow() :
m_workspace->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
m_workspace->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );

hbox->addWidget( sideBar );
hbox->addWidget( splitter );

hbox->addWidget(sideBar);
hbox->addWidget(splitter);
// If the user wants the sidebar on the right, we move the workspace and
// the splitter to the "left" side, or the first widgets in their list
if (sideBarOnRight)
{
splitter->insertWidget(0, m_workspace);
hbox->insertWidget(0, splitter);
}

// create global-toolbar at the top of our window
m_toolBar = new QWidget( main_widget );
Expand Down
12 changes: 12 additions & 0 deletions src/gui/SetupDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
"ui", "compacttrackbuttons").toInt()),
m_oneInstrumentTrackWindow(ConfigManager::inst()->value(
"ui", "oneinstrumenttrackwindow").toInt()),
m_sideBarOnRight(ConfigManager::inst()->value(
"ui", "sidebaronright").toInt()),
m_MMPZ(!ConfigManager::inst()->value(
"app", "nommpz").toInt()),
m_disableBackup(!ConfigManager::inst()->value(
Expand Down Expand Up @@ -229,6 +231,8 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
m_compactTrackButtons, SLOT(toggleCompactTrackButtons(bool)), true);
addLedCheckBox("Enable one instrument-track-window mode", gui_tw, counter,
m_oneInstrumentTrackWindow, SLOT(toggleOneInstrumentTrackWindow(bool)), true);
addLedCheckBox("Show sidebar on the right-hand side", gui_tw, counter,
m_sideBarOnRight, SLOT(toggleSideBarOnRight(bool)), true);

gui_tw->setFixedHeight(YDelta + YDelta * counter);

Expand Down Expand Up @@ -876,6 +880,8 @@ void SetupDialog::accept()
QString::number(m_compactTrackButtons));
ConfigManager::inst()->setValue("ui", "oneinstrumenttrackwindow",
QString::number(m_oneInstrumentTrackWindow));
ConfigManager::inst()->setValue("ui", "sidebaronright",
QString::number(m_sideBarOnRight));
ConfigManager::inst()->setValue("app", "nommpz",
QString::number(!m_MMPZ));
ConfigManager::inst()->setValue("app", "disablebackup",
Expand Down Expand Up @@ -980,6 +986,12 @@ void SetupDialog::toggleOneInstrumentTrackWindow(bool enabled)
}


void SetupDialog::toggleSideBarOnRight(bool enabled)
{
m_sideBarOnRight = enabled;
}


void SetupDialog::toggleMMPZ(bool enabled)
{
m_MMPZ = enabled;
Expand Down

0 comments on commit 1a6f4c1

Please sign in to comment.