summaryrefslogtreecommitdiff
path: root/src/bibletime_init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bibletime_init.cpp')
-rw-r--r--src/bibletime_init.cpp119
1 files changed, 88 insertions, 31 deletions
diff --git a/src/bibletime_init.cpp b/src/bibletime_init.cpp
index 98db7d9..cbff79f 100644
--- a/src/bibletime_init.cpp
+++ b/src/bibletime_init.cpp
@@ -151,6 +151,13 @@ void BibleTime::insertKeyboardActions( BtActionCollection* const a ) {
a->addAction("autoHorizontal", action);
action = new QAction(a);
+ action->setText(tr("Auto-&tile"));
+ action->setIcon(DU::getIcon(CResMgr::mainMenu::window::arrangementMode::autoTile::icon));
+ action->setShortcut(QKeySequence(CResMgr::mainMenu::window::arrangementMode::autoTile::accel));
+ action->setToolTip(tr("Automatically tile the open windows"));
+ a->addAction("autoTile", action);
+
+ action = new QAction(a);
action->setText(tr("Auto-&cascade"));
action->setIcon(DU::getIcon(CResMgr::mainMenu::window::arrangementMode::autoCascade::icon));
action->setShortcut(QKeySequence(CResMgr::mainMenu::window::arrangementMode::autoCascade::accel));
@@ -165,6 +172,13 @@ void BibleTime::insertKeyboardActions( BtActionCollection* const a ) {
a->addAction("cascade", action);
action = new QAction(a);
+ action->setText(tr("&Tile"));
+ action->setIcon(DU::getIcon(CResMgr::mainMenu::window::tile::icon));
+ action->setShortcut(QKeySequence(CResMgr::mainMenu::window::tile::accel));
+ action->setToolTip(tr("Tile the open windows"));
+ a->addAction("tile", action);
+
+ action = new QAction(a);
action->setText(tr("Tile &vertically"));
action->setIcon(DU::getIcon(CResMgr::mainMenu::window::tileVertical::icon));
action->setShortcut(QKeySequence(CResMgr::mainMenu::window::tileVertical::accel));
@@ -254,10 +268,11 @@ void BibleTime::initActions() {
QAction* tmp = m_actionCollection->action("quit");
fileMenu->addAction(tmp);
- m_mainToolBar->addAction(tmp);
- m_mainToolBar->addSeparator();
connect(tmp, SIGNAL(triggered()), this, SLOT(quit()) );
+
+ // ********** View menu *********************
+
m_windowFullscreen_action = m_actionCollection->action("toggleFullscreen");
m_windowFullscreen_action->setCheckable(true);
viewMenu->addAction(m_windowFullscreen_action);
@@ -282,6 +297,35 @@ void BibleTime::initActions() {
action->setText(tr("Show Mag"));
viewMenu->addAction(action);
+ viewMenu->addSeparator();
+ QMenu* textWindowsMenu = new QMenu(tr("Text windows"));
+ viewMenu->addMenu(textWindowsMenu);
+
+ action = new QAction(tr("Show text area headers"), this);
+ action->setCheckable(true);
+ action->setChecked(CBTConfig::get(CBTConfig::showTextWindowHeaders));
+ connect(action, SIGNAL(toggled(bool)), SLOT(slotToggleTextWindowHeader()));
+ textWindowsMenu->addAction(action);
+
+ action = new QAction(tr("Show navigation"), this);
+ action->setCheckable(true);
+ action->setChecked(CBTConfig::get(CBTConfig::showTextWindowNavigator));
+ connect(action, SIGNAL(toggled(bool)), SLOT(slotToggleTextWindowNavigator()));
+ textWindowsMenu->addAction(action);
+
+ action = new QAction(tr("Show work chooser buttons"), this);
+ action->setCheckable(true);
+ action->setChecked(CBTConfig::get(CBTConfig::showTextWindowModuleSelectorButtons));
+ connect(action, SIGNAL(toggled(bool)), SLOT(slotToggleTextWindowModuleChooser()));
+ textWindowsMenu->addAction(action);
+
+ action = new QAction(tr("Show tools"), this);
+ action->setCheckable(true);
+ action->setChecked(CBTConfig::get(CBTConfig::showTextWindowToolButtons));
+ connect(action, SIGNAL(toggled(bool)), SLOT(slotToggleTextWindowToolButtons()));
+ textWindowsMenu->addAction(action);
+
+ // *************************************
m_mainToolBar->addSeparator();
tmp = m_actionCollection->action("searchOpenWorks");
@@ -316,6 +360,10 @@ void BibleTime::initActions() {
m_windowMenu->addAction(m_windowCascade_action);
connect(m_windowCascade_action, SIGNAL(triggered()), this, SLOT(slotCascade()) );
+ m_windowTile_action = m_actionCollection->action("tile");
+ m_windowMenu->addAction(m_windowTile_action);
+ connect(m_windowTile_action, SIGNAL(triggered()), this, SLOT(slotTile()) );
+
m_windowTileVertical_action = m_actionCollection->action("tileVertically");
m_windowMenu->addAction(m_windowTileVertical_action);
connect(m_windowTileVertical_action, SIGNAL(triggered()), this, SLOT(slotTileVertical()) );
@@ -344,6 +392,11 @@ void BibleTime::initActions() {
arrangementMenu->addAction(m_windowAutoTileHorizontal_action);
connect(m_windowAutoTileHorizontal_action, SIGNAL(triggered()), this, SLOT(slotAutoTileHorizontal()) );
+ m_windowAutoTile_action = m_actionCollection->action("autoTile");
+ m_windowAutoTile_action->setCheckable(true);
+ arrangementMenu->addAction(m_windowAutoTile_action);
+ connect(m_windowAutoTile_action, SIGNAL(triggered()), this, SLOT(slotAutoTile()) );
+
m_windowAutoCascade_action = m_actionCollection->action("autoCascade");
m_windowAutoCascade_action->setCheckable(true);
arrangementMenu->addAction(m_windowAutoCascade_action);
@@ -398,11 +451,6 @@ void BibleTime::initActions() {
/** Initializes the SIGNAL / SLOT connections */
void BibleTime::initConnections() {
- QObject::connect(m_mdi, SIGNAL(sigSetToplevelCaption(const QString&)),
- this, SLOT(setPlainCaption(const QString&)));
- QObject::connect(m_mdi, SIGNAL(createReadDisplayWindow(QList<CSwordModuleInfo*>, const QString&)),
- this, SLOT(createReadDisplayWindow(QList<CSwordModuleInfo*>, const QString&)));
-
if (m_windowMenu) {
QObject::connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotWindowMenuAboutToShow()));
}
@@ -411,15 +459,18 @@ void BibleTime::initConnections() {
}
if (m_openWindowsMenu) {
- QObject::connect(m_openWindowsMenu, SIGNAL(aboutToShow()), this, SLOT(slotOpenWindowsMenuAboutToShow()));
+ QObject::connect(m_openWindowsMenu, SIGNAL(aboutToShow()),
+ this, SLOT(slotOpenWindowsMenuAboutToShow()));
}
else {
qWarning() << "Main window: can't find open windows menu";
}
bool ok;
- ok = connect(m_bookmarksPage, SIGNAL(createReadDisplayWindow(QList<CSwordModuleInfo*>, const QString&)),
- this, SLOT(createReadDisplayWindow(QList<CSwordModuleInfo*>, const QString&)));
+ ok = connect(m_bookmarksPage,
+ SIGNAL(createReadDisplayWindow(QList<CSwordModuleInfo*>, const QString&)),
+ this,
+ SLOT(createReadDisplayWindow(QList<CSwordModuleInfo*>, const QString&)));
Q_ASSERT(ok);
connect(m_bookshelfDock, SIGNAL(moduleOpenTriggered(CSwordModuleInfo*)),
this, SLOT(createReadDisplayWindow(CSwordModuleInfo*)));
@@ -444,21 +495,21 @@ void BibleTime::initSwordConfigFile() {
// If this is not done here, the sword locales.d won't be found
#ifdef Q_WS_WIN
namespace DU = util::directory;
- QString configFile = util::directory::getUserHomeSwordDir().filePath("sword.conf");
- QFile file(configFile);
- if (file.exists()) {
- return;
- }
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- return;
- }
- QTextStream out(&file);
- out << "\n";
- out << "[Install]\n";
- out << "DataPath=" << DU::convertDirSeparators( DU::getSharedSwordDir().absolutePath()) << "\n";
- out << "LocalePath=" << DU::convertDirSeparators(DU::getApplicationSwordDir().absolutePath()) << "\n";
- out << "\n";
- file.close();
+ QString configFile = util::directory::getUserHomeSwordDir().filePath("sword.conf");
+ QFile file(configFile);
+ if (file.exists()) {
+ return;
+ }
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ return;
+ }
+ QTextStream out(&file);
+ out << "\n";
+ out << "[Install]\n";
+ out << "DataPath=" << DU::convertDirSeparators( DU::getSharedSwordDir().absolutePath()) << "\n";
+ out << "LocalePath=" << DU::convertDirSeparators(DU::getApplicationSwordDir().absolutePath()) << "\n";
+ out << "\n";
+ file.close();
#endif
}
@@ -466,7 +517,7 @@ void BibleTime::initSwordConfigFile() {
void BibleTime::initBackends() {
qDebug() << "BibleTime::initBackends";
- initSwordConfigFile();
+ initSwordConfigFile();
sword::StringMgr::setSystemStringMgr( new BTStringMgr() );
sword::SWLog::getSystemLog()->setLogLevel(1);
@@ -479,7 +530,7 @@ void BibleTime::initBackends() {
if (errorCode != CSwordBackend::NoError) {
//show error message that initBackend failed
- /// \todo
+ /// \todo
// switch (errorCode) {
// case CSwordBackend::NoSwordConfig: //mods.d or mods.conf missing
// {
@@ -528,8 +579,8 @@ void BibleTime::applyProfileSettings( CProfile* p ) {
//first Main Window state
restoreState(p->getMainwindowState());
- restoreGeometry(p->getMainwindowGeometry());
- m_windowFullscreen_action->setChecked(isFullScreen());
+ restoreGeometry(p->getMainwindowGeometry());
+ m_windowFullscreen_action->setChecked(isFullScreen());
const CMDIArea::MDIArrangementMode newArrangementMode = p->getMDIArrangementMode();
//make sure actions are updated by calling the slot functions
@@ -544,9 +595,15 @@ void BibleTime::applyProfileSettings( CProfile* p ) {
case CMDIArea::ArrangementModeCascade:
slotAutoCascade();
break;
- default:
+ case CMDIArea::ArrangementModeTile:
+ slotAutoTile();
+ break;
+ case CMDIArea::ArrangementModeManual:
slotManualArrangementMode();
break;
+ default:
+ slotAutoTileVertical();
+ break;
}
}
@@ -555,7 +612,7 @@ void BibleTime::storeProfileSettings( CProfile* p ) {
if (!p || !m_windowFullscreen_action) return;
p->setMainwindowState(saveState());
- p->setMainwindowGeometry(saveGeometry());
+ p->setMainwindowGeometry(saveGeometry());
p->setMDIArrangementMode(m_mdi->getMDIArrangementMode());
}