Skip to content
Permalink
Browse files

Merge PR #3156: Add toggle to lock layout when in custom layout mode

  • Loading branch information...
mkrautz committed Jul 9, 2017
2 parents 6cd17bd + e72a22f commit a4e859e7dc7cf64b2321ccf95d32caee837b64f3
Showing with 23 additions and 5 deletions.
  1. +6 −1 src/mumble/LookConfig.cpp
  2. +10 −0 src/mumble/LookConfig.ui
  3. +3 −4 src/mumble/MainWindow.cpp
  4. +3 −0 src/mumble/Settings.cpp
  5. +1 −0 src/mumble/Settings.h
@@ -59,6 +59,8 @@ LookConfig::LookConfig(Settings &st) : ConfigWidget(st) {
qcbUserDrag->insertItem(Settings::Ask, tr("Ask"), Settings::Ask);
qcbUserDrag->insertItem(Settings::DoNothing, tr("Do Nothing"), Settings::DoNothing);
qcbUserDrag->insertItem(Settings::Move, tr("Move"), Settings::Move);

connect(qrbLCustom,SIGNAL(toggled(bool)),qcbLockLayout,SLOT(setEnabled(bool)));

QDir userThemeDirectory = Themes::getUserThemesDirectory();
if (userThemeDirectory.exists()) {
@@ -141,6 +143,7 @@ void LookConfig::load(const Settings &r) {
qrbLCustom->setChecked(true);
break;
}
qcbLockLayout->setEnabled(r.wlWindowLayout==Settings::LayoutCustom);


for (int i=0;i<qcbLanguage->count();i++) {
@@ -158,6 +161,7 @@ void LookConfig::load(const Settings &r) {
loadCheckBox(qcbUsersTop, r.bUserTop);
loadCheckBox(qcbAskOnQuit, r.bAskOnQuit);
loadCheckBox(qcbEnableDeveloperMenu, r.bEnableDeveloperMenu);
loadCheckBox(qcbLockLayout, (r.wlWindowLayout==Settings::LayoutCustom)&&r.bLockLayout);
loadCheckBox(qcbHideTray, r.bHideInTray);
loadCheckBox(qcbStateInTray, r.bStateInTray);
loadCheckBox(qcbShowUserCount, r.bShowUserCount);
@@ -205,6 +209,7 @@ void LookConfig::save() const {
s.aotbAlwaysOnTop = static_cast<Settings::AlwaysOnTopBehaviour>(qcbAlwaysOnTop->currentIndex());
s.bAskOnQuit = qcbAskOnQuit->isChecked();
s.bEnableDeveloperMenu = qcbEnableDeveloperMenu->isChecked();
s.bLockLayout = qcbLockLayout->isChecked();
s.bHideInTray = qcbHideTray->isChecked();
s.bStateInTray = qcbStateInTray->isChecked();
s.bShowUserCount = qcbShowUserCount->isChecked();
@@ -223,7 +228,7 @@ void LookConfig::save() const {
}

void LookConfig::accept() const {
g.mw->setShowDockTitleBars(g.s.wlWindowLayout == Settings::LayoutCustom);
g.mw->setShowDockTitleBars((g.s.wlWindowLayout == Settings::LayoutCustom) && !g.s.bLockLayout);
}

void LookConfig::themeDirectoryChanged() {
@@ -243,6 +243,16 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="qcbLockLayout">
<property name="whatsThis">
<string>When in custom layout mode, checking this disables rearranging.</string>
</property>
<property name="text">
<string>Lock layout</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -301,7 +301,7 @@ void MainWindow::setupGui() {
qteChat->setDefaultText(tr("<center>Not connected</center>"), true);
qteChat->setEnabled(false);

setShowDockTitleBars(g.s.wlWindowLayout == Settings::LayoutCustom);
setShowDockTitleBars((g.s.wlWindowLayout == Settings::LayoutCustom) && !g.s.bLockLayout);

#ifdef Q_OS_MAC
// Workaround for QTBUG-3116 -- using a unified toolbar on Mac OS X
@@ -382,8 +382,7 @@ void MainWindow::updateWindowTitle() {

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

qtIconToolbar->setMovable(layoutIsCustom);
qtIconToolbar->setMovable(layoutIsCustom && !g.s.bLockLayout);

// Update the toolbar so the movable flag takes effect.
if (layoutIsCustom) {
@@ -617,7 +616,7 @@ void MainWindow::updateTransmitModeComboBox() {
}

QMenu *MainWindow::createPopupMenu() {
if (g.s.wlWindowLayout == Settings::LayoutCustom) {
if ((g.s.wlWindowLayout == Settings::LayoutCustom) && !g.s.bLockLayout) {
return QMainWindow::createPopupMenu();
}

@@ -287,6 +287,7 @@ Settings::Settings() {
aotbAlwaysOnTop = OnTopNever;
bAskOnQuit = true;
bEnableDeveloperMenu = false;
bLockLayout = false;
#ifdef Q_OS_WIN
// Don't enable minimize to tray by default on Windows >= 7
const QSysInfo::WinVersion winVer = QSysInfo::windowsVersion();
@@ -703,6 +704,7 @@ void Settings::load(QSettings* settings_ptr) {
LOADENUM(aotbAlwaysOnTop, "ui/alwaysontop");
SAVELOAD(bAskOnQuit, "ui/askonquit");
SAVELOAD(bEnableDeveloperMenu, "ui/developermenu");
SAVELOAD(bLockLayout, "ui/locklayout");
SAVELOAD(bMinimalView, "ui/minimalview");
SAVELOAD(bHideFrame, "ui/hideframe");
SAVELOAD(bUserTop, "ui/usertop");
@@ -1032,6 +1034,7 @@ void Settings::save() {
SAVELOAD(aotbAlwaysOnTop, "ui/alwaysontop");
SAVELOAD(bAskOnQuit, "ui/askonquit");
SAVELOAD(bEnableDeveloperMenu, "ui/developermenu");
SAVELOAD(bLockLayout, "ui/locklayout");
SAVELOAD(bMinimalView, "ui/minimalview");
SAVELOAD(bHideFrame, "ui/hideframe");
SAVELOAD(bUserTop, "ui/usertop");
@@ -295,6 +295,7 @@ struct Settings {
AlwaysOnTopBehaviour aotbAlwaysOnTop;
bool bAskOnQuit;
bool bEnableDeveloperMenu;
bool bLockLayout;
bool bHideInTray;
bool bStateInTray;
bool bUsage;

0 comments on commit a4e859e

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