summaryrefslogtreecommitdiff
path: root/src/bibletime_slots.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bibletime_slots.cpp')
-rw-r--r--src/bibletime_slots.cpp113
1 files changed, 72 insertions, 41 deletions
diff --git a/src/bibletime_slots.cpp b/src/bibletime_slots.cpp
index aaf1b1d..973b8e6 100644
--- a/src/bibletime_slots.cpp
+++ b/src/bibletime_slots.cpp
@@ -7,40 +7,35 @@
*
**********/
-//own includes
#include "bibletime.h"
+#include <QAction>
+#include <QApplication>
+#include <QClipboard>
+#include <QDesktopServices>
+#include <QInputDialog>
+#include <QList>
+#include <QMdiSubWindow>
+#include <QMenu>
+#include <QProcess>
+#include <QtGlobal>
+#include <QToolBar>
+#include "backend/config/cbtconfig.h"
#include "backend/keys/cswordversekey.h"
-
-#include "util/ctoolclass.h"
-#include "util/directoryutil.h"
-
+#include "frontend/cinfodisplay.h"
+#include "frontend/cinputdialog.h"
#include "frontend/cmdiarea.h"
+#include "frontend/bookshelfmanager/btmodulemanagerdialog.h"
+#include "frontend/displaywindow/cbiblereadwindow.h"
+#include "frontend/displaywindow/cdisplaywindow.h"
+#include "frontend/htmldialogs/btaboutdialog.h"
#include "frontend/profile/cprofilemgr.h"
#include "frontend/profile/cprofile.h"
#include "frontend/profile/cprofilewindow.h"
-#include "frontend/settingsdialogs/cconfigurationdialog.h"
-#include "backend/config/cbtconfig.h"
-#include "frontend/cinputdialog.h"
-#include "frontend/cinfodisplay.h"
-#include "frontend/displaywindow/cdisplaywindow.h"
-#include "frontend/displaywindow/cbiblereadwindow.h"
#include "frontend/searchdialog/csearchdialog.h"
-#include "frontend/bookshelfmanager/btmodulemanagerdialog.h"
-#include "frontend/htmldialogs/btaboutdialog.h"
+#include "frontend/settingsdialogs/cconfigurationdialog.h"
+#include "util/directory.h"
-//QT includes
-#include <QClipboard>
-#include <QInputDialog>
-#include <QList>
-#include <QAction>
-#include <QMenu>
-#include <QToolBar>
-#include <QApplication>
-#include <QProcess>
-#include <QMdiSubWindow>
-#include <QtGlobal>
-#include <QDesktopServices>
using namespace Profile;
@@ -69,7 +64,7 @@ using namespace Profile;
/** Opens the optionsdialog of BibleTime. */
void BibleTime::slotSettingsOptions() {
- qDebug("BibleTime::slotSettingsOptions");
+ qDebug() << "BibleTime::slotSettingsOptions";
CConfigurationDialog *dlg = new CConfigurationDialog(this, m_actionCollection);
QObject::connect(dlg, SIGNAL(signalSettingsChanged()), this, SLOT(slotSettingsChanged()) );
@@ -85,11 +80,11 @@ void BibleTime::saveConfigSettings() {
/** Is called when settings in the optionsdialog were changed (ok or apply) */
void BibleTime::slotSettingsChanged() {
- qDebug("BibleTime::slotSettingsChanged");
+ qDebug() << "BibleTime::slotSettingsChanged";
const QString language = CBTConfig::get(CBTConfig::language);
CPointers::backend()->booknameLanguage(language);
-// TODO: update the bookmarks after Bible bookname language has been changed
+// \todo update the bookmarks after Bible bookname language has been changed
// QTreeWidgetItemIterator it(m_mainIndex);
// while (*it) {
// CIndexItemBase* citem = dynamic_cast<CIndexItemBase*>(*it);
@@ -102,12 +97,12 @@ void BibleTime::slotSettingsChanged() {
refreshBibleTimeAccel();
refreshDisplayWindows();
refreshProfileMenus();
- qDebug("BibleTime::slotSettingsChanged");
+ qDebug() << "BibleTime::slotSettingsChanged";
}
/** Opens the sword setup dialog of BibleTime. */
void BibleTime::slotSwordSetupDialog() {
- //TODO: nonmodal dialog, memory management (one instance only!
+ /// \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
@@ -127,7 +122,7 @@ void BibleTime::slotSwordSetupChanged() {
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?
+ \todo should bookshelf manager be updated?
Should there be different signals/slots for visual changes,
i.e. grouping/hiding?
@@ -156,18 +151,24 @@ void BibleTime::slotWindowMenuAboutToShow() {
m_windowCascade_action->setEnabled(false);
m_windowTileVertical_action->setEnabled(false);
m_windowTileHorizontal_action->setEnabled(false);
+ m_windowClose_action->setEnabled(false);
m_windowCloseAll_action->setEnabled(false);
+ m_openWindowsMenu->setEnabled(false);
}
else if (m_mdi->subWindowList().count() == 1) {
- m_windowTileVertical_action->setEnabled( false );
- m_windowTileHorizontal_action->setEnabled( false );
- m_windowCascade_action->setEnabled( false );
- m_windowCloseAll_action->setEnabled( true );
+ m_windowTileVertical_action->setEnabled(false);
+ m_windowTileHorizontal_action->setEnabled(false);
+ m_windowCascade_action->setEnabled(false);
+ m_windowClose_action->setEnabled(true);
+ m_windowCloseAll_action->setEnabled(true);
+ m_openWindowsMenu->setEnabled(true);
// m_windowMenu->insertSeparator();
}
else {
slotUpdateWindowArrangementActions(0); //update the window tile/cascade states
- m_windowCloseAll_action->setEnabled( true );
+ m_windowClose_action->setEnabled(true);
+ m_windowCloseAll_action->setEnabled(true);
+ m_openWindowsMenu->setEnabled(true);
}
// QList<QAction*>::iterator end = m_windowOpenWindowsList.end();
@@ -204,6 +205,23 @@ void BibleTime::slotWindowMenuAboutToShow() {
// }
}
+/** 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) {
+ QAction *openWindowAction = m_openWindowsMenu->addAction(window->windowTitle());
+ openWindowAction->setCheckable(true);
+ openWindowAction->setChecked(window == m_mdi->activeSubWindow());
+ connect(openWindowAction, SIGNAL(triggered()), m_windowMapper, SLOT(map()));
+ m_windowMapper->setMapping(openWindowAction, window);
+ }
+}
+
/** This slot is connected with the windowAutoTile_action object */
void BibleTime::slotUpdateWindowArrangementActions( QAction* clickedAction ) {
/* If a toggle action was clicked we see if it checked ot unchecked and
@@ -325,6 +343,13 @@ void BibleTime::slotToggleToolbar() {
}
}
+/** Sets the active window. */
+void BibleTime::slotSetActiveSubWindow(QWidget* window) {
+ if (!window)
+ return;
+ m_mdi->setActiveSubWindow(dynamic_cast<QMdiSubWindow*>(window));
+}
+
void BibleTime::slotSearchModules() {
//get the modules of the open windows
QList<CSwordModuleInfo*> modules;
@@ -350,13 +375,13 @@ void BibleTime::slotSearchDefaultBible() {
}
void BibleTime::openOnlineHelp_Handbook() {
- QString urlPath = "file://" + util::filesystem::DirectoryUtil::getHandbookDir().canonicalPath() + "/index.html";
- QDesktopServices::openUrl(QUrl(urlPath));
+ QString filePath(util::directory::getHandbookDir().canonicalPath() + "/index.html");
+ QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
}
void BibleTime::openOnlineHelp_Howto() {
- QString urlPath = "file://" + util::filesystem::DirectoryUtil::getHowtoDir().canonicalPath() + "/index.html";
- QDesktopServices::openUrl(QUrl(urlPath));
+ QString filePath(util::directory::getHowtoDir().canonicalPath() + "/index.html");
+ QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
}
void BibleTime::slotOpenAboutDialog() {
@@ -409,7 +434,7 @@ void BibleTime::loadProfile(QAction* action) {
CProfile* p = m_profileMgr.profile( profileName );
Q_ASSERT(p);
if ( p ) {
- m_mdi->deleteAll();
+ m_mdi->closeAllSubWindows();
loadProfile(p);
}
}
@@ -515,3 +540,9 @@ void BibleTime::refreshProfileMenus() {
m_windowDeleteProfileMenu->addAction(p->name());
}
}
+
+// Quit from BibleTime
+void BibleTime::quit() {
+ Search::CSearchDialog::closeDialog();
+ close();
+}