Skip to content
Permalink
Browse files

MainWindow: only allow toolbar dragging in the 'custom' layout.

Now that we only allow customizing the UI when using the 'custom'
layout, it makes sense to only allow moving the toolbar when in the
'custom layout.

For all our pre-defined layouts, the toolbar is forced to be on top
of the window.
  • Loading branch information...
mkrautz committed Dec 27, 2015
1 parent 7f37b71 commit 69cdaee4325a486e374245713c708f80591eb561
Showing with 24 additions and 0 deletions.
  1. +18 −0 src/mumble/MainWindow.cpp
  2. +6 −0 src/mumble/MainWindow.h
@@ -399,6 +399,21 @@ void MainWindow::updateWindowTitle() {
setWindowTitle(title.arg(QLatin1String(MUMBLE_RELEASE)));
}

void MainWindow::updateToolbar() {
bool layoutIsCustom = g.s.wlWindowLayout == Settings::LayoutCustom;

qtIconToolbar->setMovable(layoutIsCustom);

// Update the toolbar so the movable flag takes effect.
if (layoutIsCustom) {
// Update the toolbar, but keep it in place.
addToolBar(toolBarArea(qtIconToolbar), qtIconToolbar);
} else {
// Update the toolbar, and ensure it is at the top of the window.
addToolBar(Qt::TopToolBarArea, qtIconToolbar);
}
}

// Sets whether or not to show the title bars on the MainWindow's
// dock widgets.
void MainWindow::setShowDockTitleBars(bool doShow) {
@@ -914,6 +929,9 @@ void MainWindow::setupView(bool toggle_minimize) {
default:
break;
}

updateToolbar();

qteChat->updateGeometry();

QRect geom = frameGeometry();
@@ -179,6 +179,12 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
void createActions();
void setupGui();
void updateWindowTitle();
/// updateToolbar updates the state of the toolbar depending on the current
/// window layout setting.
/// If the window layout setting is 'custom', the toolbar is made movable. If the
/// window layout is not 'custom', the toolbar is locked in place at the top of
/// the MainWindow.
void updateToolbar();
void customEvent(QEvent *evt) Q_DECL_OVERRIDE;
void findDesiredChannel();
void setupView(bool toggle_minimize = true);

0 comments on commit 69cdaee

Please sign in to comment.
You can’t perform that action at this time.