diff options
Diffstat (limited to 'src/bibletime_slots.cpp')
-rw-r--r-- | src/bibletime_slots.cpp | 191 |
1 files changed, 75 insertions, 116 deletions
diff --git a/src/bibletime_slots.cpp b/src/bibletime_slots.cpp index 973b8e6..b1ee3b3 100644 --- a/src/bibletime_slots.cpp +++ b/src/bibletime_slots.cpp @@ -39,28 +39,6 @@ using namespace Profile; -// /* An action which stores a user defined pointer to a widget. -// * @author Joachim Ansorg -// */ -// class KUserDataAction : public KToggleAction { -// public: -// KUserDataAction( QString caption, const KShortcut& shortcut, const QObject* receiver, const char* slot, KActionCollection* actionCollection) -// : KToggleAction(caption, actionCollection), m_userData(0) -// { -// setShortcut(shortcut); -// QObject::connect(this, SIGNAL(triggered()), receiver, slot); -// }; -// -// void setUserData(QWidget* const data) { -// m_userData = data; -// }; -// QWidget* const getUserData() const { -// return m_userData; -// }; -// -// private: -// QWidget* m_userData; -// }; /** Opens the optionsdialog of BibleTime. */ void BibleTime::slotSettingsOptions() { @@ -102,12 +80,7 @@ void BibleTime::slotSettingsChanged() { /** Opens the sword setup dialog of BibleTime. */ void BibleTime::slotSwordSetupDialog() { - /// \todo nonmodal dialog, memory management (one instance only! - //BtModuleManagerDialog *dlg = new BtModuleManagerDialog(this); - BtModuleManagerDialog* dlg = BtModuleManagerDialog::getInstance(this); - //disconnect first because it may be connected already - //QObject::disconnect(dlg, SIGNAL(swordSetupChanged()), this, SLOT(slotSwordSetupChanged()) ); - //connect(dlg, SIGNAL(swordSetupChanged()), SLOT(slotSwordSetupChanged()) ); + BtModuleManagerDialog *dlg = BtModuleManagerDialog::getInstance(this); dlg->showNormal(); dlg->show(); @@ -115,37 +88,9 @@ void BibleTime::slotSwordSetupDialog() { dlg->activateWindow(); } -/** Is called when settings in the sword setup dialog were changed (ok or apply) */ -void BibleTime::slotSwordSetupChanged() { - /* - Refresh everything here what might have changed - these are the mainindex, the searchdialog, the displaywindows - But at first we have to reset the Sword backend to reload the modules - - \todo should bookshelf manager be updated? - Should there be different signals/slots for visual changes, - i.e. grouping/hiding? - - */ - - - //CPointers::deleteBackend(); - //m_backend = new CSwordBackend(); - //CPointers::setBackend(new CSwordBackend()); - //CPointers::backend()->reloadModules(); - - //m_mainIndex->reloadSword(); - - // refresh display windows - //refreshDisplayWindows(); -} - /** Is called just before the window menu is ahown. */ void BibleTime::slotWindowMenuAboutToShow() { Q_ASSERT(m_windowMenu); - if (!m_windowMenu) { - return; - } if ( m_mdi->subWindowList().isEmpty() ) { m_windowCascade_action->setEnabled(false); @@ -170,47 +115,12 @@ void BibleTime::slotWindowMenuAboutToShow() { m_windowCloseAll_action->setEnabled(true); m_openWindowsMenu->setEnabled(true); } - - // QList<QAction*>::iterator end = m_windowOpenWindowsList.end(); - // for (QList<QAction*>::iterator it = m_windowOpenWindowsList.begin(); it != end; ++it ) - // { - //(*it)->unplugAll(); //see kde porting doc - // foreach (QWidget *w, (*it)->associatedWidgets() ) - // { - // w->removeAction(*it); - // } - // } - - //m_windowOpenWindowsList.setAutoDelete(true); - // qDeleteAll(m_windowOpenWindowsList); - // m_windowOpenWindowsList.clear(); - -// if (!m_windowActionCollection) { -// m_windowActionCollection = new KActionCollection(this, KComponentData()); -// } - -// QList<QWidget*> windows = m_mdi->windowList(); -// const int count = windows.count(); -// for ( int i = 0; i < count; ++i ) { -// QWidget* w = windows.at(i); -// Q_ASSERT(w); -// -// KUserDataAction* action = new KUserDataAction(w->windowTitle(), KShortcut(), this, SLOT(slotWindowMenuActivated()), m_windowActionCollection); -// Q_ASSERT(action); -// action->setUserData(w); -// -// m_windowOpenWindowsList.append(action); -// action->setChecked( w == m_mdi->activeWindow() ); -// m_windowMenu->addAction(action); -// } } /** Is called just before the open windows menu is ahown. */ void BibleTime::slotOpenWindowsMenuAboutToShow() { Q_ASSERT(m_openWindowsMenu); - if (!m_openWindowsMenu) { - return; - } + QList<QMdiSubWindow*> windows = m_mdi->usableWindowList(); m_openWindowsMenu->clear(); foreach (QMdiSubWindow *window, windows) { @@ -230,6 +140,7 @@ void BibleTime::slotUpdateWindowArrangementActions( QAction* clickedAction ) { m_windowTileVertical_action->setEnabled( m_windowManualMode_action->isChecked() ); m_windowTileHorizontal_action->setEnabled( m_windowManualMode_action->isChecked() ); m_windowCascade_action->setEnabled( m_windowManualMode_action->isChecked() ); + m_windowTile_action->setEnabled( m_windowManualMode_action->isChecked() ); if (clickedAction) { m_windowManualMode_action->setEnabled( @@ -237,40 +148,58 @@ void BibleTime::slotUpdateWindowArrangementActions( QAction* clickedAction ) { && m_windowTileHorizontal_action != clickedAction && m_windowTileVertical_action != clickedAction && m_windowCascade_action != clickedAction + && m_windowTile_action != clickedAction ); m_windowAutoTileVertical_action->setEnabled( m_windowAutoTileVertical_action != clickedAction ); m_windowAutoTileHorizontal_action->setEnabled( m_windowAutoTileHorizontal_action != clickedAction ); m_windowAutoCascade_action->setEnabled( m_windowAutoCascade_action != clickedAction ); + m_windowAutoTile_action->setEnabled( m_windowAutoTile_action != clickedAction ); } if (clickedAction == m_windowManualMode_action) { m_windowAutoTileVertical_action->setChecked(false); m_windowAutoTileHorizontal_action->setChecked(false); m_windowAutoCascade_action->setChecked(false); - + m_windowAutoTile_action->setChecked(false); + m_mdi->enableWindowMinMaxFlags(true); m_mdi->setMDIArrangementMode( CMDIArea::ArrangementModeManual ); } else if (clickedAction == m_windowAutoTileVertical_action) { m_windowManualMode_action->setChecked(false); m_windowAutoTileHorizontal_action->setChecked(false); m_windowAutoCascade_action->setChecked(false); - + m_windowAutoTile_action->setChecked(false); + m_mdi->enableWindowMinMaxFlags(false); m_mdi->setMDIArrangementMode( CMDIArea::ArrangementModeTileVertical ); } else if (clickedAction == m_windowAutoTileHorizontal_action) { m_windowManualMode_action->setChecked(false); m_windowAutoTileVertical_action->setChecked(false); m_windowAutoCascade_action->setChecked(false); - + m_windowAutoTile_action->setChecked(false); + m_mdi->enableWindowMinMaxFlags(false); m_mdi->setMDIArrangementMode( CMDIArea::ArrangementModeTileHorizontal ); } + else if (clickedAction == m_windowAutoTile_action) { + m_windowManualMode_action->setChecked(false); + m_windowAutoTileHorizontal_action->setChecked(false); + m_windowAutoTileVertical_action->setChecked(false); + m_windowAutoCascade_action->setChecked(false); + m_mdi->enableWindowMinMaxFlags(false); + m_mdi->setMDIArrangementMode( CMDIArea::ArrangementModeTile ); + } else if (clickedAction == m_windowAutoCascade_action) { m_windowManualMode_action->setChecked(false); m_windowAutoTileHorizontal_action->setChecked(false); m_windowAutoTileVertical_action->setChecked(false); - + m_windowAutoTile_action->setChecked(false); + m_mdi->enableWindowMinMaxFlags(false); m_mdi->setMDIArrangementMode( CMDIArea::ArrangementModeCascade ); } + else if (clickedAction == m_windowTile_action) { + m_mdi->setMDIArrangementMode( CMDIArea::ArrangementModeManual ); + m_mdi->myTile(); + } else if (clickedAction == m_windowCascade_action) { m_mdi->setMDIArrangementMode( CMDIArea::ArrangementModeManual ); m_mdi->myCascade(); @@ -299,6 +228,15 @@ void BibleTime::slotAutoTileVertical() { slotUpdateWindowArrangementActions( m_windowAutoTileVertical_action ); } +/** This slot is connected with the windowAutoTile_action object */ +void BibleTime::slotAutoTile() { + slotUpdateWindowArrangementActions( m_windowAutoTile_action ); +} + +void BibleTime::slotTile() { + slotUpdateWindowArrangementActions( m_windowTile_action ); +} + void BibleTime::slotCascade() { slotUpdateWindowArrangementActions( m_windowCascade_action ); } @@ -316,22 +254,6 @@ void BibleTime::slotAutoCascade() { slotUpdateWindowArrangementActions( m_windowAutoCascade_action ); } -void BibleTime::slotWindowMenuActivated() { - if (!m_windowMenu) { - return; - } - - /* const KUserDataAction* action = dynamic_cast<const KUserDataAction*>(sender()); - Q_ASSERT(action); - if (action) { - QWidget* const window = action->getUserData(); - Q_ASSERT(window); - if ( window ) { - window->setFocus(); - } - }*/ -} - /** Shows/hides the toolbar */ void BibleTime::slotToggleToolbar() { Q_ASSERT(m_mainToolBar); @@ -343,6 +265,30 @@ void BibleTime::slotToggleToolbar() { } } +void BibleTime::slotToggleTextWindowHeader() { + bool currentState = CBTConfig::get(CBTConfig::showTextWindowHeaders); + CBTConfig::set(CBTConfig::showTextWindowHeaders, !currentState); + emit toggledTextWindowHeader(!currentState); +} + +void BibleTime::slotToggleTextWindowNavigator() { + bool currentState = CBTConfig::get(CBTConfig::showTextWindowNavigator); + CBTConfig::set(CBTConfig::showTextWindowNavigator, !currentState); + emit toggledTextWindowNavigator(!currentState); +} + +void BibleTime::slotToggleTextWindowToolButtons() { + bool currentState = CBTConfig::get(CBTConfig::showTextWindowToolButtons); + CBTConfig::set(CBTConfig::showTextWindowToolButtons, !currentState); + emit toggledTextWindowToolButtons(!currentState); +} + +void BibleTime::slotToggleTextWindowModuleChooser() { + bool currentState = CBTConfig::get(CBTConfig::showTextWindowModuleSelectorButtons); + CBTConfig::set(CBTConfig::showTextWindowModuleSelectorButtons, !currentState); + emit toggledTextWindowModuleChooser(!currentState); +} + /** Sets the active window. */ void BibleTime::slotSetActiveSubWindow(QWidget* window) { if (!window) @@ -411,7 +357,7 @@ void BibleTime::saveProfile(CProfile* profile) { storeProfileSettings(profile); QList<CProfileWindow*> profileWindows; - foreach (QMdiSubWindow* w, m_mdi->subWindowList()) { + foreach (QMdiSubWindow* w, m_mdi->subWindowList(QMdiArea::StackingOrder)) { CDisplayWindow* displayWindow = dynamic_cast<CDisplayWindow*>(w->widget()); if (!displayWindow) { continue; @@ -503,7 +449,20 @@ void BibleTime::deleteProfile(QAction* action) { } void BibleTime::toggleFullscreen() { - m_windowFullscreen_action->isChecked() ? showFullScreen() : showNormal(); + if (m_windowFullscreen_action->isChecked()) { + // set full screen mode + m_WindowWasMaximizedBeforeFullScreen = isMaximized(); + showFullScreen(); + } + else { + // restore previous non-full screen mode + if (m_WindowWasMaximizedBeforeFullScreen) { + showMaximized(); + } + else { + showNormal(); + } + } m_mdi->triggerWindowUpdate(); } @@ -543,6 +502,6 @@ void BibleTime::refreshProfileMenus() { // Quit from BibleTime void BibleTime::quit() { - Search::CSearchDialog::closeDialog(); - close(); + Search::CSearchDialog::closeDialog(); + close(); } |