Skip to content

Commit

Permalink
Add option to move SideBar to right side of window
Browse files Browse the repository at this point in the history
  • Loading branch information
Veratil committed Sep 8, 2019
1 parent e1236f5 commit 532ed17
Show file tree
Hide file tree
Showing 3 changed files with 38 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
28 changes: 24 additions & 4 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ MainWindow::MainWindow() :
splitter->setChildrenCollapsible( false );

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

// create the QMdiArea with an empty splitter so the workspace is on the left
if(sideBarOnRight)
{
m_workspace = new QMdiArea(splitter);
}

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

m_workspace = new QMdiArea( splitter );
// create the QMdiArea with a populated splitter so the workspace is on the right
if(!sideBarOnRight)
{
m_workspace = new QMdiArea(splitter);
}

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

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

// Sidebar on right
if(sideBarOnRight)
{
hbox->addWidget(splitter);
hbox->addWidget(sideBar);
}
// Sidebar on left
else
{
hbox->addWidget(sideBar);
hbox->addWidget(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 532ed17

Please sign in to comment.