summaryrefslogtreecommitdiff
path: root/src/bibletime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bibletime.cpp')
-rw-r--r--src/bibletime.cpp92
1 files changed, 66 insertions, 26 deletions
diff --git a/src/bibletime.cpp b/src/bibletime.cpp
index 687ec23..f2478d9 100644
--- a/src/bibletime.cpp
+++ b/src/bibletime.cpp
@@ -10,10 +10,12 @@
#include "bibletime.h"
#include <cstdlib>
+#include <iostream>
#include <ctime>
#include <QAction>
#include <QApplication>
#include <QCloseEvent>
+#include <QDate>
#include <QDebug>
#include <QInputDialog>
#include <QMdiSubWindow>
@@ -43,27 +45,55 @@
using namespace Profile;
-BibleTime::BibleTime() {
+BibleTime::BibleTime()
+ : m_WindowWasMaximizedBeforeFullScreen(false) {
namespace DU = util::directory;
- QPixmap pm;
- if (!pm.load(DU::getPicsDir().canonicalPath().append( "/startuplogo.png"))) {
- qWarning("Can't load startuplogo! Check your installation.");
- }
- QSplashScreen splash(pm);
- QString splashHtml("<div style='background:transparent;color:white;font-weight:bold'>%1</div>");
- if (CBTConfig::get(CBTConfig::logo)) {
+ QSplashScreen splash;
+ bool showSplash = CBTConfig::get(CBTConfig::logo);
+ QString splashHtml;
+
+ if (showSplash) {
+ splashHtml = "<div style='background:transparent;color:white;font-weight:bold'>%1"
+ "</div>";
+ const QDate date(QDate::currentDate());
+ const int day = date.day();
+ const int month = date.month();
+ QString splashImage(DU::getPicsDir().canonicalPath().append("/"));
+
+ if ((month >= 12 && day >= 24) || (month <= 1 && day < 6)) {
+ splashImage.append("startuplogo_christmas.png");
+ } else {
+ splashImage.append("startuplogo.png");
+ }
+
+ QPixmap pm;
+ if (!pm.load(splashImage)) {
+ qWarning("Can't load startuplogo! Check your installation.");
+ }
+ splash.setPixmap(pm);
splash.show();
+
+ splash.showMessage(splashHtml.arg(tr("Initializing the SWORD engine...")),
+ Qt::AlignCenter);
}
- splash.showMessage(splashHtml.arg(tr("Initializing the SWORD engine...")), Qt::AlignCenter);
initBackends();
- splash.showMessage(splashHtml.arg(tr("Creating BibleTime's user interface...")), Qt::AlignCenter);
+
+ if (showSplash) {
+ splash.showMessage(splashHtml.arg(tr("Creating BibleTime's user interface...")),
+ Qt::AlignCenter);
+ }
initView();
- splash.showMessage(splashHtml.arg(tr("Initializing menu- and toolbars...")), Qt::AlignCenter);
+
+ if (showSplash) {
+ splash.showMessage(splashHtml.arg(tr("Initializing menu- and toolbars...")),
+ Qt::AlignCenter);
+ }
initActions();
initConnections();
readSettings();
- setPlainCaption(QString());
+
+ setWindowTitle("BibleTime " BT_VERSION);
setWindowIcon(DU::getIcon(CResMgr::mainWindow::icon));
}
@@ -86,6 +116,7 @@ void BibleTime::saveSettings() {
*/
CBTConfig::set(CBTConfig::autoTileVertical, m_windowAutoTileVertical_action->isChecked());
CBTConfig::set(CBTConfig::autoTileHorizontal, m_windowAutoTileHorizontal_action->isChecked());
+ CBTConfig::set(CBTConfig::autoTile, m_windowAutoTile_action->isChecked());
CBTConfig::set(CBTConfig::autoCascade, m_windowAutoCascade_action->isChecked());
CProfile* p = m_profileMgr.startupProfile();
@@ -113,6 +144,11 @@ void BibleTime::readSettings() {
m_windowManualMode_action->setChecked(false);
slotAutoTileHorizontal();
}
+ else if ( CBTConfig::get(CBTConfig::autoTile) ) {
+ m_windowAutoTile_action->setChecked(true);
+ m_windowManualMode_action->setChecked(false);
+ slotAutoTile();
+ }
else if ( CBTConfig::get(CBTConfig::autoCascade) ) {
m_windowAutoCascade_action->setChecked(true);
m_windowManualMode_action->setChecked(false);
@@ -264,21 +300,19 @@ void BibleTime::restoreWorkspace() {
}
}
-/** Sets the plain caption of the main window */
-void BibleTime::setPlainCaption(const QString& title) {
- QString suffix;
- //Watch out, subtitles must be appended with the form " - [%s]", otherwise
- //QMdiSubWindow will mess up when it is maximized
- if (!title.isEmpty()) {
- suffix = QString(" - [").append(title).append("]");
- }
- QMainWindow::setWindowTitle( QString("BibleTime ").append(BT_VERSION) + suffix );
-}
-
/** Processes the commandline options given to BibleTime. */
void BibleTime::processCommandline() {
QStringList args = qApp->QCoreApplication::arguments();
+ if (args.contains("--help") || args.contains("-h") || args.contains("/h") || args.contains("/?")) {
+ std::cout << "BibleTime" << std::endl << "--help (-h, /h, /?): Show this help message and exit"
+ << std::endl << "--ignore-session: open a clean session" << std:: endl << "--open-default-bible <ref>: "
+ << "Open the default Bible with the reference <ref>" << std::endl;
+ std::cout << "Some Qt arguments:" << std::endl << "-reverse: reverse the UI layout direction"
+ << std::endl;
+ exit(0);
+ //printHelpAndExit();
+ }
if ( !CBTConfig::get(CBTConfig::crashedTwoTimes) &&
!args.contains("--ignore-session") ) {
restoreWorkspace();
@@ -310,7 +344,13 @@ void BibleTime::processCommandline() {
}
bool BibleTime::event(QEvent* event) {
- if (event->type() == QEvent::Close)
- Search::CSearchDialog::closeDialog();
- return QMainWindow::event(event);
+ if (event->type() == QEvent::Close)
+ Search::CSearchDialog::closeDialog();
+ return QMainWindow::event(event);
+}
+
+QAction* BibleTime::getAction(const QString& actionName)
+{
+ return m_actionCollection->action(actionName);
}
+