X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fqtui%2Fmainwin.cpp;h=63fe459bbb70f91d757b9b6d9c0542a00b5e87c6;hb=5a259061411e123d89059d815d1ea0f7cfcb3401;hp=01389c55df2ad4671aa86dd630982dfc74e4a440;hpb=584085c95a70e921f401b387bb73e66e2d71a714;p=quassel.git diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 01389c55..63fe459b 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2014 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -337,7 +337,7 @@ void MainWin::restoreStateFromSettings(UiSettings &s) void MainWin::updateIcon() { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC const int size = 128; #else const int size = 48; @@ -402,7 +402,7 @@ void MainWin::setupActions() configureShortcutsAct->setMenuRole(QAction::NoRole); coll->addAction("ConfigureShortcuts", configureShortcutsAct); - #ifdef Q_WS_MAC + #ifdef Q_OS_MAC QAction *configureQuasselAct = new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll, this, SLOT(showSettingsDlg())); configureQuasselAct->setMenuRole(QAction::PreferencesRole); @@ -445,7 +445,7 @@ void MainWin::setupActions() this, SLOT(on_jumpHotBuffer_triggered()), QKeySequence(Qt::META + Qt::Key_A))); // Jump keys -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC const int bindModifier = Qt::ControlModifier | Qt::AltModifier; const int jumpModifier = Qt::ControlModifier; #else @@ -1000,7 +1000,7 @@ void MainWin::setupToolBars() connect(_nickListWidget, SIGNAL(nickSelectionChanged(QModelIndexList)), QtUi::toolBarActionProvider(), SLOT(nickSelectionChanged(QModelIndexList))); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC setUnifiedTitleAndToolBarOnMac(true); #endif @@ -1015,6 +1015,24 @@ void MainWin::setupToolBars() QtUi::toolBarActionProvider()->addActions(_mainToolBar, ToolBarActionProvider::MainToolBar); _toolbarMenu->addAction(_mainToolBar->toggleViewAction()); + +#ifdef Q_OS_MAC + QtUiSettings uiSettings; + + bool visible = uiSettings.value("ShowMainToolBar", QVariant(true)).toBool(); + _mainToolBar->setVisible(visible); + connect(_mainToolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(saveMainToolBarStatus(bool))); +#endif +} + +void MainWin::saveMainToolBarStatus(bool enabled) +{ +#ifdef Q_OS_MAC + QtUiSettings uiSettings; + uiSettings.setValue("ShowMainToolBar", enabled); +#else + Q_UNUSED(enabled); +#endif } @@ -1395,10 +1413,19 @@ void MainWin::onFullScreenToggled() bool MainWin::event(QEvent *event) { - if (event->type() == QEvent::WindowActivate) { - BufferId buffer = Client::bufferModel()->currentBuffer(); - if (buffer.isValid()) - Client::instance()->markBufferAsRead(buffer); + switch(event->type()) { + case QEvent::WindowActivate: { + BufferId bufferId = Client::bufferModel()->currentBuffer(); + if (bufferId.isValid()) + Client::instance()->markBufferAsRead(bufferId); + break; + } + case QEvent::WindowDeactivate: + if (bufferWidget()->autoMarkerLineOnLostFocus()) + bufferWidget()->setMarkerLine(); + break; + default: + break; } return QMainWindow::event(event); }