Some fixes.

This commit is contained in:
Martin Rotter 2014-03-13 19:43:41 +01:00
parent 03fda9f090
commit b3e5a38f96
3 changed files with 26 additions and 18 deletions

View File

@ -184,27 +184,31 @@ void FormMain::switchMainMenu() {
}
void FormMain::switchVisibility(bool force_hide) {
// TODO: Kdyz neni povolena tray ikona, tak je povolena satle polozka "switch window" v menu.
// v pripade ze tedy neni povolena tray ikona, tak polozku switch bud disabnout
// nebo upravit jeji chovani aby provedla minimalizaci a ne hide.
// aktualne nastaveno na tu minimalizaci
if (force_hide || isVisible()) {
if (SystemTrayIcon::isSystemTrayActivated()) {
hide();
m_ui->m_actionSwitchMainWindow->blockSignals(true);
m_ui->m_actionSwitchMainWindow->setChecked(false);
m_ui->m_actionSwitchMainWindow->blockSignals(false);
}
else {
// Window gets minimized in single-window mode.
showMinimized();
}
}
else {
display();
m_ui->m_actionSwitchMainWindow->blockSignals(true);
m_ui->m_actionSwitchMainWindow->setChecked(true);
m_ui->m_actionSwitchMainWindow->blockSignals(false);
}
}
void FormMain::setApplicationMode(FormMain::ApplicationMode mode) {
switch (mode) {
case Tray:
break;
case SingleWindow:
break;
default:
break;
}
}
@ -386,7 +390,7 @@ void FormMain::createConnections() {
// Menu "View" connections.
connect(m_ui->m_actionFullscreen, SIGNAL(toggled(bool)), this, SLOT(switchFullscreenMode()));
connect(m_ui->m_actionSwitchMainMenu, SIGNAL(toggled(bool)), this, SLOT(switchMainMenu()));
connect(m_ui->m_actionSwitchMainWindow, SIGNAL(toggled(bool)), this, SLOT(switchVisibility()));
connect(m_ui->m_actionSwitchMainWindow, SIGNAL(triggered()), this, SLOT(switchVisibility()));
// Menu "Tools" connections.
connect(m_ui->m_actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));

View File

@ -35,6 +35,11 @@ class FormMain : public QMainWindow {
friend class FeedsView;
public:
enum ApplicationMode {
SingleWindow,
Tray
};
// Constructors and destructors.
explicit FormMain(QWidget *parent = 0);
virtual ~FormMain();
@ -92,6 +97,8 @@ class FormMain : public QMainWindow {
// Switches visibility of main window.
void switchVisibility(bool force_hide = false);
void setApplicationMode(ApplicationMode mode);
// Turns on/off fullscreen mode
void switchFullscreenMode();

View File

@ -75,9 +75,9 @@
<addaction name="m_actionFullscreen"/>
<addaction name="m_actionSwitchFeedsList"/>
<addaction name="m_actionSwitchMainMenu"/>
<addaction name="m_actionSwitchMainWindow"/>
</widget>
<addaction name="m_menuShowHide"/>
<addaction name="m_actionSwitchMainWindow"/>
</widget>
<widget class="QMenu" name="m_menuTools">
<property name="title">
@ -367,14 +367,11 @@
</property>
</action>
<action name="m_actionSwitchMainWindow">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="text">
<string>Main &amp;window</string>
<string>Switch visibility of main &amp;window</string>
</property>
<property name="toolTip">
<string>Hides main window if it is visible and shows it if it is hidden.</string>