Skip to content

Commit

Permalink
Qt UI: fix dock menu for Mac OS X
Browse files Browse the repository at this point in the history
These slots are used only in Mac OS X. But due to bug in moc they cannot be
placed in #ifdef block.
  • Loading branch information
tehnick committed Jul 12, 2013
1 parent 0e6f14a commit 24c4cbe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
40 changes: 20 additions & 20 deletions eiskaltdcpp-qt/src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2949,6 +2949,26 @@ void MainWindow::on(dcpp::TimerManagerListener::Second, uint64_t ticks) noexcept
emit coreUpdateStats(map);
}

void MainWindow::slotShowSpeedLimits(){
Notification *N = Notification::getInstance();
if (N)
N->slotShowSpeedLimits();
}

void MainWindow::slotSupressTxt(){
Notification *N = Notification::getInstance();
QAction *act = qobject_cast<QAction*>(sender());
if (N && act)
N->setSupressTxt(act->isChecked());
}

void MainWindow::slotSupressSnd(){
Notification *N = Notification::getInstance();
QAction *act = qobject_cast<QAction*>(sender());
if (N && act)
N->setSupressSnd(act->isChecked());
}

#if defined(Q_WS_MAC)
extern void qt_mac_set_dock_menu(QMenu *menu); // Qt internal function

Expand Down Expand Up @@ -2978,25 +2998,5 @@ void MainWindow::initDockMenuBar(){

qt_mac_set_dock_menu(menu);
}

void MainWindow::slotShowSpeedLimits(){
Notification *N = Notification::getInstance();
if (N)
N->slotShowSpeedLimits();
}

void MainWindow::slotSupressTxt(){
Notification *N = Notification::getInstance();
QAction *act = qobject_cast<QAction*>(sender());
if (N && act)
N->setSupressTxt(act->isChecked());
}

void MainWindow::slotSupressSnd(){
Notification *N = Notification::getInstance();
QAction *act = qobject_cast<QAction*>(sender());
if (N && act)
N->setSupressSnd(act->isChecked());
}
#endif // defined(Q_WS_MAC)

5 changes: 3 additions & 2 deletions eiskaltdcpp-qt/src/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,12 @@ friend class dcpp::Singleton<MainWindow>;
void slotUpdateFavHubMenu();
void slotConnectFavHub(QAction*);

#if defined(Q_WS_MAC)
// These slots are used only in Mac OS X.
// But due to bug in moc they cannot be placed in #ifdef block.
void slotShowSpeedLimits();
void slotSupressTxt();
void slotSupressSnd();
#endif
//

Q_SIGNALS:
void coreLogMessage(const QString&);
Expand Down

0 comments on commit 24c4cbe

Please sign in to comment.