summaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/bookshelfmanager/btconfigdialog.cpp27
-rw-r--r--src/frontend/bookshelfmanager/btconfigdialog.h5
-rw-r--r--src/frontend/bookshelfmanager/btinstallmgr.cpp22
-rw-r--r--src/frontend/bookshelfmanager/btinstallmgr.h12
-rw-r--r--src/frontend/bookshelfmanager/btmodulemanagerdialog.cpp20
-rw-r--r--src/frontend/bookshelfmanager/btmodulemanagerdialog.h4
-rw-r--r--src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.cpp157
-rw-r--r--src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h23
-rw-r--r--src/frontend/bookshelfmanager/indexpage/btindexpage.cpp37
-rw-r--r--src/frontend/bookshelfmanager/indexpage/btindexpage.h2
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.cpp129
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.h7
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallpage.cpp106
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallpage.h3
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallpathdialog.cpp166
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallpathdialog.h10
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp37
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.h13
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallthread.cpp41
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallthread.h6
-rw-r--r--src/frontend/bookshelfmanager/installpage/btsourcearea.cpp82
-rw-r--r--src/frontend/bookshelfmanager/installpage/btsourcearea.h12
-rw-r--r--src/frontend/bookshelfmanager/installpage/btsourcewidget.cpp171
-rw-r--r--src/frontend/bookshelfmanager/installpage/btsourcewidget.h15
-rw-r--r--src/frontend/bookshelfmanager/instbackend.cpp128
-rw-r--r--src/frontend/bookshelfmanager/instbackend.h12
-rw-r--r--src/frontend/bookshelfmanager/removepage/btremovepage.cpp53
-rw-r--r--src/frontend/bookshelfmanager/removepage/btremovepage.h7
-rw-r--r--src/frontend/btaboutmoduledialog.cpp14
-rw-r--r--src/frontend/btaboutmoduledialog.h5
-rw-r--r--src/frontend/btbookshelfdockwidget.cpp23
-rw-r--r--src/frontend/btbookshelfdockwidget.h10
-rw-r--r--src/frontend/cdragdrop.cpp7
-rw-r--r--src/frontend/cdragdrop.h4
-rw-r--r--src/frontend/cdragdropmgr.cpp262
-rw-r--r--src/frontend/cdragdropmgr.h160
-rw-r--r--src/frontend/cexportmanager.cpp46
-rw-r--r--src/frontend/cexportmanager.h11
-rw-r--r--src/frontend/cinfodisplay.cpp44
-rw-r--r--src/frontend/cinfodisplay.h10
-rw-r--r--src/frontend/cinputdialog.cpp19
-rw-r--r--src/frontend/cinputdialog.h4
-rw-r--r--src/frontend/cmdiarea.cpp122
-rw-r--r--src/frontend/cmdiarea.h116
-rw-r--r--src/frontend/cmodulechooserdialog.cpp42
-rw-r--r--src/frontend/cmodulechooserdialog.h7
-rw-r--r--src/frontend/cmoduleindexdialog.cpp29
-rw-r--r--src/frontend/cmoduleindexdialog.h27
-rw-r--r--src/frontend/cprinter.cpp12
-rw-r--r--src/frontend/cprinter.h5
-rw-r--r--src/frontend/crossrefrendering.cpp31
-rw-r--r--src/frontend/crossrefrendering.h20
-rw-r--r--src/frontend/display/btcolorwidget.cpp8
-rw-r--r--src/frontend/display/btcolorwidget.h21
-rw-r--r--src/frontend/display/btfontsizewidget.cpp6
-rw-r--r--src/frontend/display/btfontsizewidget.h19
-rw-r--r--src/frontend/display/bthtmlfindtext.cpp10
-rw-r--r--src/frontend/display/bthtmlfindtext.h3
-rw-r--r--src/frontend/display/bthtmljsobject.cpp31
-rw-r--r--src/frontend/display/bthtmljsobject.h3
-rw-r--r--src/frontend/display/bthtmlreaddisplay.cpp47
-rw-r--r--src/frontend/display/bthtmlreaddisplay.h11
-rw-r--r--src/frontend/display/cdisplay.cpp41
-rw-r--r--src/frontend/display/cdisplay.h12
-rw-r--r--src/frontend/display/chtmlwritedisplay.cpp36
-rw-r--r--src/frontend/display/chtmlwritedisplay.h16
-rw-r--r--src/frontend/display/cplainwritedisplay.cpp29
-rw-r--r--src/frontend/display/cplainwritedisplay.h16
-rw-r--r--src/frontend/display/creaddisplay.cpp21
-rw-r--r--src/frontend/display/creaddisplay.h10
-rw-r--r--src/frontend/display/cwritedisplay.cpp14
-rw-r--r--src/frontend/display/cwritedisplay.h11
-rw-r--r--src/frontend/displaywindow/btactioncollection.cpp12
-rw-r--r--src/frontend/displaywindow/btactioncollection.h10
-rw-r--r--src/frontend/displaywindow/bttoolbarpopupaction.cpp8
-rw-r--r--src/frontend/displaywindow/bttoolbarpopupaction.h4
-rw-r--r--src/frontend/displaywindow/cbiblereadwindow.cpp51
-rw-r--r--src/frontend/displaywindow/cbiblereadwindow.h19
-rw-r--r--src/frontend/displaywindow/cbookreadwindow.cpp25
-rw-r--r--src/frontend/displaywindow/cbookreadwindow.h10
-rw-r--r--src/frontend/displaywindow/cbuttons.cpp26
-rw-r--r--src/frontend/displaywindow/cbuttons.h11
-rw-r--r--src/frontend/displaywindow/ccommentaryreadwindow.cpp28
-rw-r--r--src/frontend/displaywindow/ccommentaryreadwindow.h10
-rw-r--r--src/frontend/displaywindow/cdisplaywindow.cpp61
-rw-r--r--src/frontend/displaywindow/cdisplaywindow.h28
-rw-r--r--src/frontend/displaywindow/cdisplaywindowfactory.cpp41
-rw-r--r--src/frontend/displaywindow/cdisplaywindowfactory.h28
-rw-r--r--src/frontend/displaywindow/chtmlwritewindow.cpp42
-rw-r--r--src/frontend/displaywindow/chtmlwritewindow.h11
-rw-r--r--src/frontend/displaywindow/clexiconreadwindow.cpp70
-rw-r--r--src/frontend/displaywindow/clexiconreadwindow.h12
-rw-r--r--src/frontend/displaywindow/cmodulechooserbar.cpp10
-rw-r--r--src/frontend/displaywindow/cmodulechooserbar.h8
-rw-r--r--src/frontend/displaywindow/cmodulechooserbutton.cpp31
-rw-r--r--src/frontend/displaywindow/cmodulechooserbutton.h9
-rw-r--r--src/frontend/displaywindow/cplainwritewindow.cpp43
-rw-r--r--src/frontend/displaywindow/cplainwritewindow.h8
-rw-r--r--src/frontend/displaywindow/creadwindow.cpp34
-rw-r--r--src/frontend/displaywindow/creadwindow.h7
-rw-r--r--src/frontend/displaywindow/cwritewindow.cpp15
-rw-r--r--src/frontend/displaywindow/cwritewindow.h8
-rw-r--r--src/frontend/htmldialogs/btaboutdialog.cpp43
-rw-r--r--src/frontend/htmldialogs/btaboutdialog.h5
-rw-r--r--src/frontend/htmldialogs/bttabhtmldialog.cpp19
-rw-r--r--src/frontend/htmldialogs/bttabhtmldialog.h2
-rw-r--r--src/frontend/keychooser/bthistory.cpp42
-rw-r--r--src/frontend/keychooser/bthistory.h25
-rw-r--r--src/frontend/keychooser/cbookkeychooser.cpp17
-rw-r--r--src/frontend/keychooser/cbookkeychooser.h10
-rw-r--r--src/frontend/keychooser/cbooktreechooser.cpp23
-rw-r--r--src/frontend/keychooser/cbooktreechooser.h20
-rw-r--r--src/frontend/keychooser/ckeychooser.cpp22
-rw-r--r--src/frontend/keychooser/ckeychooser.h12
-rw-r--r--src/frontend/keychooser/ckeychooserwidget.cpp25
-rw-r--r--src/frontend/keychooser/ckeychooserwidget.h12
-rw-r--r--src/frontend/keychooser/clexiconkeychooser.cpp25
-rw-r--r--src/frontend/keychooser/clexiconkeychooser.h14
-rw-r--r--src/frontend/keychooser/cscrollbutton.cpp7
-rw-r--r--src/frontend/keychooser/cscrollbutton.h8
-rw-r--r--src/frontend/keychooser/cscrollerwidgetset.cpp8
-rw-r--r--src/frontend/keychooser/cscrollerwidgetset.h10
-rw-r--r--src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp11
-rw-r--r--src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h2
-rw-r--r--src/frontend/keychooser/versekeychooser/btversekeymenu.cpp8
-rw-r--r--src/frontend/keychooser/versekeychooser/btversekeymenu.h1
-rw-r--r--src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp33
-rw-r--r--src/frontend/keychooser/versekeychooser/cbiblekeychooser.h13
-rw-r--r--src/frontend/keychooser/versekeychooser/ckeyreferencewidget.cpp49
-rw-r--r--src/frontend/keychooser/versekeychooser/ckeyreferencewidget.h13
-rw-r--r--src/frontend/mainindex/bookmarks/btbookmarkfolder.cpp22
-rw-r--r--src/frontend/mainindex/bookmarks/btbookmarkfolder.h4
-rw-r--r--src/frontend/mainindex/bookmarks/btbookmarkitem.cpp21
-rw-r--r--src/frontend/mainindex/bookmarks/btbookmarkitem.h4
-rw-r--r--src/frontend/mainindex/bookmarks/btbookmarkitembase.cpp7
-rw-r--r--src/frontend/mainindex/bookmarks/btbookmarkitembase.h9
-rw-r--r--src/frontend/mainindex/bookmarks/btbookmarkloader.cpp28
-rw-r--r--src/frontend/mainindex/bookmarks/btbookmarkloader.h6
-rw-r--r--src/frontend/mainindex/bookmarks/cbookmarkindex.cpp123
-rw-r--r--src/frontend/mainindex/bookmarks/cbookmarkindex.h31
-rw-r--r--src/frontend/mainindex/bookshelf/actionenum.h24
-rw-r--r--src/frontend/mainindex/bookshelf/btindexfolder.cpp18
-rw-r--r--src/frontend/mainindex/bookshelf/btindexfolder.h29
-rw-r--r--src/frontend/mainindex/bookshelf/btindexitem.cpp18
-rw-r--r--src/frontend/mainindex/bookshelf/btindexitem.h47
-rw-r--r--src/frontend/mainindex/bookshelf/btindexmodule.cpp89
-rw-r--r--src/frontend/mainindex/bookshelf/btindexmodule.h38
-rw-r--r--src/frontend/mainindex/bookshelf/cbookshelfindex.cpp714
-rw-r--r--src/frontend/mainindex/bookshelf/cbookshelfindex.h206
-rw-r--r--src/frontend/mainindex/bookshelf/chidemodulechooserdialog.cpp68
-rw-r--r--src/frontend/mainindex/bookshelf/chidemodulechooserdialog.h42
-rw-r--r--src/frontend/mainindex/btbookshelfview.cpp1
-rw-r--r--src/frontend/mainindex/btbookshelfview.h1
-rw-r--r--src/frontend/profile/cprofile.cpp97
-rw-r--r--src/frontend/profile/cprofile.h35
-rw-r--r--src/frontend/profile/cprofilemgr.cpp11
-rw-r--r--src/frontend/profile/cprofilemgr.h9
-rw-r--r--src/frontend/profile/cprofilewindow.cpp12
-rw-r--r--src/frontend/profile/cprofilewindow.h13
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp18
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysisdialog.h9
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysisitem.cpp11
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysisitem.h8
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysislegenditem.cpp10
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysislegenditem.h7
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysisscene.cpp21
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysisscene.h16
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysisview.cpp6
-rw-r--r--src/frontend/searchdialog/analysis/csearchanalysisview.h2
-rw-r--r--src/frontend/searchdialog/btsearchoptionsarea.cpp61
-rw-r--r--src/frontend/searchdialog/btsearchoptionsarea.h14
-rw-r--r--src/frontend/searchdialog/btsearchresultarea.cpp59
-rw-r--r--src/frontend/searchdialog/btsearchresultarea.h17
-rw-r--r--src/frontend/searchdialog/chistorycombobox.cpp6
-rw-r--r--src/frontend/searchdialog/chistorycombobox.h1
-rw-r--r--src/frontend/searchdialog/cmoduleresultview.cpp91
-rw-r--r--src/frontend/searchdialog/cmoduleresultview.h21
-rw-r--r--src/frontend/searchdialog/crangechooserdialog.cpp50
-rw-r--r--src/frontend/searchdialog/crangechooserdialog.h13
-rw-r--r--src/frontend/searchdialog/csearchdialog.cpp69
-rw-r--r--src/frontend/searchdialog/csearchdialog.h20
-rw-r--r--src/frontend/searchdialog/csearchmodulechooserdialog.cpp26
-rw-r--r--src/frontend/searchdialog/csearchmodulechooserdialog.h25
-rw-r--r--src/frontend/searchdialog/csearchresultview.cpp42
-rw-r--r--src/frontend/searchdialog/csearchresultview.h6
-rw-r--r--src/frontend/settingsdialogs/btshortcutsdialog.cpp19
-rw-r--r--src/frontend/settingsdialogs/btshortcutsdialog.h2
-rw-r--r--src/frontend/settingsdialogs/btshortcutseditor.cpp22
-rw-r--r--src/frontend/settingsdialogs/btshortcutseditor.h4
-rw-r--r--src/frontend/settingsdialogs/cacceleratorsettings.cpp24
-rw-r--r--src/frontend/settingsdialogs/cacceleratorsettings.h16
-rw-r--r--src/frontend/settingsdialogs/cconfigurationdialog.cpp23
-rw-r--r--src/frontend/settingsdialogs/cconfigurationdialog.h30
-rw-r--r--src/frontend/settingsdialogs/cdisplaysettings.cpp25
-rw-r--r--src/frontend/settingsdialogs/cdisplaysettings.h3
-rw-r--r--src/frontend/settingsdialogs/cfontchooser.cpp13
-rw-r--r--src/frontend/settingsdialogs/cfontchooser.h32
-rw-r--r--src/frontend/settingsdialogs/clanguagesettings.cpp65
-rw-r--r--src/frontend/settingsdialogs/clanguagesettings.h35
-rw-r--r--src/frontend/settingsdialogs/clistwidget.cpp10
-rw-r--r--src/frontend/settingsdialogs/clistwidget.h21
-rw-r--r--src/frontend/settingsdialogs/cswordsettings.cpp48
-rw-r--r--src/frontend/settingsdialogs/cswordsettings.h29
203 files changed, 2393 insertions, 4245 deletions
diff --git a/src/frontend/bookshelfmanager/btconfigdialog.cpp b/src/frontend/bookshelfmanager/btconfigdialog.cpp
index 0fcbc5a..565765d 100644
--- a/src/frontend/bookshelfmanager/btconfigdialog.cpp
+++ b/src/frontend/bookshelfmanager/btconfigdialog.cpp
@@ -7,23 +7,22 @@
*
**********/
-
-#include "btconfigdialog.h"
-
-#include "util/directoryutil.h"
-#include "util/ctoolclass.h"
+#include "frontend/bookshelfmanager/btconfigdialog.h"
#include <QDialog>
-#include <QStackedWidget>
+#include <QDialogButtonBox>
+#include <QEvent>
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QLabel>
#include <QListWidget>
#include <QListView>
#include <QListWidgetItem>
+#include <QStackedWidget>
#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QDialogButtonBox>
-#include <QFrame>
-#include <QEvent>
+#include "util/directory.h"
+#include "util/tool.h"
+
BtConfigDialog::BtConfigDialog(QWidget* parent)
: QDialog(parent),
@@ -63,11 +62,13 @@ BtConfigDialog::BtConfigDialog(QWidget* parent)
BtConfigDialog::~BtConfigDialog() {}
void BtConfigDialog::addPage(BtConfigPage* pageWidget) {
+ namespace DU = util::directory;
+
// this is a friend
pageWidget->m_parentDialog = this;
QVBoxLayout* containerLayout = new QVBoxLayout;
- QLabel* headerLabel = CToolClass::explanationLabel(pageWidget, pageWidget->header(), pageWidget->label());
+ QLabel* headerLabel = util::tool::explanationLabel(pageWidget, pageWidget->header(), pageWidget->label());
containerLayout->addWidget(headerLabel);
containerLayout->addWidget(pageWidget);
QWidget* containerWidget = new QWidget(m_pageWidget);
@@ -76,7 +77,7 @@ void BtConfigDialog::addPage(BtConfigPage* pageWidget) {
QListWidgetItem* item = new QListWidgetItem(m_contentsList);
- item->setIcon(util::filesystem::DirectoryUtil::getIcon(pageWidget->iconName()));
+ item->setIcon(DU::getIcon(pageWidget->iconName()));
item->setText(pageWidget->header());
item->setTextAlignment(Qt::AlignHCenter);
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
diff --git a/src/frontend/bookshelfmanager/btconfigdialog.h b/src/frontend/bookshelfmanager/btconfigdialog.h
index 8773a83..547cb4e 100644
--- a/src/frontend/bookshelfmanager/btconfigdialog.h
+++ b/src/frontend/bookshelfmanager/btconfigdialog.h
@@ -10,14 +10,13 @@
#ifndef BTCONFIGDIALOG_H
#define BTCONFIGDIALOG_H
-
#include <QDialog>
-#include <QWidget>
#include <QDebug>
+#include <QWidget>
-class BtConfigPage;
+class BtConfigPage;
class QListWidgetItem;
class QListWidget;
class QStackedWidget;
diff --git a/src/frontend/bookshelfmanager/btinstallmgr.cpp b/src/frontend/bookshelfmanager/btinstallmgr.cpp
index 799fa0d..ace804f 100644
--- a/src/frontend/bookshelfmanager/btinstallmgr.cpp
+++ b/src/frontend/bookshelfmanager/btinstallmgr.cpp
@@ -7,31 +7,27 @@
*
**********/
-//BibleTime includes
-#include "btinstallmgr.h"
+#include "frontend/bookshelfmanager/btinstallmgr.h"
-#include "frontend/bookshelfmanager/instbackend.h"
#include "backend/managers/cswordbackend.h"
-
-//Qt includes
-#include <QObject>
+#include "frontend/bookshelfmanager/instbackend.h"
+#include <QDebug>
#include <QList>
+#include <QObject>
#include <QString>
#include <QStringList>
-#include <QDebug>
-
-//sword includes
+// Sword includes:
#include <installmgr.h>
#include <ftptrans.h>
-using namespace sword;
+using namespace sword;
BtInstallMgr::BtInstallMgr()
: InstallMgr(instbackend::configPath().toLatin1(), this),
m_firstCallOfPreStatus(true) { //use this class also as status reporter
- qDebug("BtInstallMgr::BtInstallMgr");
+ qDebug() << "BtInstallMgr::BtInstallMgr";
this->setFTPPassive(true);
}
@@ -41,13 +37,13 @@ BtInstallMgr::~BtInstallMgr() {
}
bool BtInstallMgr::isUserDisclaimerConfirmed() const {
- // TODO: Check from config if it's been confirmed with "don't show this anymore" checked.
+ // \todo Check from config if it's been confirmed with "don't show this anymore" checked.
// Create a dialog with the message, checkbox and Continue/Cancel, Cancel as default.
return true;
}
void BtInstallMgr::statusUpdate(double dltotal, double dlnow) {
- //qDebug("BtInstallMgr::statusUpdate");
+ //qDebug() << "BtInstallMgr::statusUpdate";
if (dlnow > dltotal)
dlnow = dltotal;
diff --git a/src/frontend/bookshelfmanager/btinstallmgr.h b/src/frontend/bookshelfmanager/btinstallmgr.h
index 0561b96..7eff1ae 100644
--- a/src/frontend/bookshelfmanager/btinstallmgr.h
+++ b/src/frontend/bookshelfmanager/btinstallmgr.h
@@ -10,19 +10,19 @@
#ifndef NEWBTINSTALLMGR_H
#define NEWBTINSTALLMGR_H
-//sword includes
-#include <installmgr.h>
-#include <ftptrans.h>
-
-//Qt includes
#include <QObject>
+
#include <QList>
#include <QString>
#include <QStringList>
-class CSwordBackend;
+// Sword includes:
+#include <installmgr.h>
+#include <ftptrans.h>
+class CSwordBackend;
+
typedef QList<sword::InstallSource*> InstallSourceList;
/**
diff --git a/src/frontend/bookshelfmanager/btmodulemanagerdialog.cpp b/src/frontend/bookshelfmanager/btmodulemanagerdialog.cpp
index b361965..b261305 100644
--- a/src/frontend/bookshelfmanager/btmodulemanagerdialog.cpp
+++ b/src/frontend/bookshelfmanager/btmodulemanagerdialog.cpp
@@ -7,21 +7,19 @@
*
**********/
-#include "btmodulemanagerdialog.h"
-
-#include "installpage/btinstallpage.h"
-#include "removepage/btremovepage.h"
-#include "indexpage/btindexpage.h"
+#include "frontend/bookshelfmanager/btmodulemanagerdialog.h"
+#include <QDialogButtonBox>
+#include "backend/config/cbtconfig.h"
+#include "backend/managers/cswordbackend.h"
+#include "frontend/bookshelfmanager/indexpage/btindexpage.h"
+#include "frontend/bookshelfmanager/installpage/btinstallpage.h"
+#include "frontend/bookshelfmanager/removepage/btremovepage.h"
#include "util/cpointers.h"
#include "util/dialogutil.h"
-#include "backend/managers/cswordbackend.h"
-#include "backend/config/cbtconfig.h"
-
-#include <QDialogButtonBox>
-static BtModuleManagerDialog* m_staticModuleManagerDialog = 0;
+static BtModuleManagerDialog *m_staticModuleManagerDialog = 0;
BtModuleManagerDialog* BtModuleManagerDialog::getInstance(QWidget* parent) {
if (!m_staticModuleManagerDialog) {
@@ -67,7 +65,7 @@ BtModuleManagerDialog::~BtModuleManagerDialog() {
// The QWidget close() sends close event, so does closing by the window X button.
void BtModuleManagerDialog::closeEvent(QCloseEvent*) {
- qDebug("BtModuleManagerDialog::closeEvent");
+ qDebug() << "BtModuleManagerDialog::closeEvent";
}
void BtModuleManagerDialog::loadDialogSettings() {
diff --git a/src/frontend/bookshelfmanager/btmodulemanagerdialog.h b/src/frontend/bookshelfmanager/btmodulemanagerdialog.h
index ff8c35f..c51efd2 100644
--- a/src/frontend/bookshelfmanager/btmodulemanagerdialog.h
+++ b/src/frontend/bookshelfmanager/btmodulemanagerdialog.h
@@ -7,11 +7,11 @@
*
**********/
-
#ifndef BTMODULEMANAGERDIALOG_H
#define BTMODULEMANAGERDIALOG_H
-#include "btconfigdialog.h"
+#include "frontend/bookshelfmanager/btconfigdialog.h"
+
class QWidget;
diff --git a/src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.cpp b/src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.cpp
index eca4498..47e274c 100644
--- a/src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.cpp
+++ b/src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.cpp
@@ -7,35 +7,33 @@
*
**********/
-//BT includes
-#include "cswordsetupinstallsourcesdialog.h"
-
-#include "frontend/bookshelfmanager/instbackend.h"
+#include "frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h"
#include <boost/scoped_ptr.hpp>
-
-//Qt includes
-#include <QLayout>
-#include <QLabel>
#include <QComboBox>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QMessageBox>
+#include <QDir>
#include <QFileInfo>
+#include <QFileDialog>
#include <QGridLayout>
#include <QHBoxLayout>
+#include <QLabel>
+#include <QLayout>
+#include <QLineEdit>
+#include <QPushButton>
#include <QVBoxLayout>
-#include <QFileDialog>
-#include <QDir>
-
-
+#include <QDialogButtonBox>
+#include <QProgressDialog>
+#include <QApplication>
+#include <QDebug>
+#include "frontend/bookshelfmanager/instbackend.h"
+#include "util/dialogutil.h"
const QString PROTO_FILE( QObject::tr("Local") ); //Local path
const QString PROTO_FTP( QObject::tr("Remote") ); //Remote path
-
CSwordSetupInstallSourcesDialog::CSwordSetupInstallSourcesDialog(/*QWidget *parent*/)
- : QDialog() {
+ : QDialog(),
+ m_remoteListAdded(false) {
setWindowTitle(tr("New Installation Source"));
QVBoxLayout* mainLayout = new QVBoxLayout( this );
@@ -48,7 +46,7 @@ CSwordSetupInstallSourcesDialog::CSwordSetupInstallSourcesDialog(/*QWidget *pare
captionLayout->addWidget( label );
m_captionEdit = new QLineEdit( this );
- m_captionEdit->setText("Crosswire Bible Society");
+ m_captionEdit->setText("CrossWire Bible Society");
captionLayout->addWidget( m_captionEdit );
mainLayout->addSpacing( 10 );
@@ -83,24 +81,22 @@ CSwordSetupInstallSourcesDialog::CSwordSetupInstallSourcesDialog(/*QWidget *pare
mainLayout->addSpacing( 10 );
- QHBoxLayout* buttonLayout = new QHBoxLayout( this );
- mainLayout->addLayout(buttonLayout);
- buttonLayout->addStretch();
- QPushButton* okButton = new QPushButton( tr("Ok"), this);
- QPushButton* discardButton = new QPushButton( tr("Discard"), this);
- buttonLayout->addWidget( discardButton);
- buttonLayout->addWidget( okButton);
- buttonLayout->addStretch();
-
- connect( okButton, SIGNAL( clicked() ), this, SLOT( slotOk() ) );
- connect( discardButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Save, Qt::Horizontal, this);
+ util::prepareDialogBox(buttonBox);
+ QPushButton* getListButton = new QPushButton(tr("Get list..."), this);
+ getListButton->setToolTip(tr("Download a list of sources from CrossWire server and add sources"));
+ buttonBox->addButton(getListButton, QDialogButtonBox::ActionRole);
+ connect(getListButton, SIGNAL(clicked()), SLOT(slotGetListClicked()));
+ mainLayout->addWidget(buttonBox);
+ connect(buttonBox, SIGNAL(accepted()), SLOT(slotOk()));
+ connect(buttonBox, SIGNAL(rejected()), SLOT(reject()));
connect( m_protocolCombo, SIGNAL( activated(int) ), this, SLOT( slotProtocolChanged() ) );
-
}
+
void CSwordSetupInstallSourcesDialog::slotOk() {
//run a few tests to validate the input first
if ( m_captionEdit->text().trimmed().isEmpty() ) { //no caption
- QMessageBox::information( this, tr( "Error" ), tr("Please provide a caption."), QMessageBox::Retry);
+ util::showInformation( this, tr( "Error" ), tr("Please provide a caption."));
return;
}
@@ -108,25 +104,25 @@ void CSwordSetupInstallSourcesDialog::slotOk() {
//sword::InstallSource is = BTInstallMgr::Tool::RemoteConfig::source( &iMgr, m_captionEdit->text() );
sword::InstallSource is = instbackend::source(m_captionEdit->text());
if ( (QString)is.caption.c_str() == m_captionEdit->text() ) { //source already exists
- QMessageBox::information( this, tr( "Error" ),
- tr("A source with this caption already exists.<br>Please provide a different caption."), QMessageBox::Retry);
+ util::showInformation( this, tr( "Error" ),
+ tr("A source with this caption already exists.<br/>Please provide a different caption."));
return;
}
if ( m_protocolCombo->currentText() == PROTO_FTP &&
m_serverEdit->text().trimmed().isEmpty() ) { //no server name
- QMessageBox::information( this, tr( "Error" ), tr("Please provide a server name."), QMessageBox::Retry);
+ util::showInformation( this, tr( "Error" ), tr("Please provide a server name."));
return;
}
if ( m_protocolCombo->currentText() == PROTO_FILE) {
const QFileInfo fi( m_pathEdit->text() );
if (!fi.exists() || !fi.isReadable()) { //no valid and readable path
- QMessageBox::information( this, tr( "Error" ), tr("Please provide a valid, readable path."), QMessageBox::Retry);
+ util::showInformation( this, tr( "Error" ), tr("Please provide a valid, readable path."));
return;
}
else if ( m_pathEdit->text().isEmpty() ) {
- QMessageBox::information( this, tr( "Error" ), tr("Please provide a path."), QMessageBox::Retry);
+ util::showInformation( this, tr( "Error" ), tr("Please provide a path."));
}
}
@@ -155,28 +151,83 @@ void CSwordSetupInstallSourcesDialog::slotProtocolChanged() {
}
-sword::InstallSource CSwordSetupInstallSourcesDialog::getSource() {
+void CSwordSetupInstallSourcesDialog::slotGetListClicked() {
+ QString message(tr("List of sources will be downloaded from a remote server. Sources will be added to the current list. New source will replace an old one if it has the same label. You can later remove the sources you don't want to keep.\n\nDo you want to continue?"));
+ QMessageBox::StandardButton answer = util::showQuestion(this, tr("Get source list from remote server?"), message, QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
+ if (answer == QMessageBox::No) {
+ return;
+ }
+ qDebug() << "Ok, create installmgr";
+ BtInstallMgr iMgr;
+
+ m_progressDialog = new QProgressDialog("", tr("Cancel"), 0 , 100, this);
+ m_progressDialog->setWindowTitle(tr("Downloading List"));
+ m_progressDialog->setMinimumDuration(0);
+ connect(m_progressDialog, SIGNAL(canceled()), SLOT(slotRefreshCanceled()));
+ m_currentInstallMgr = &iMgr; //for the progress dialog
+ // connect this directly to the dialog setValue(int) if possible
+ connect(&iMgr, SIGNAL(percentCompleted(const int, const int)), SLOT(slotRefreshProgress(const int, const int)));
+
+ m_progressDialog->show();
+ qApp->processEvents();
+ this->slotRefreshProgress(0, 0);
+ m_progressDialog->setLabelText(tr("Connecting..."));
+ m_progressDialog->setValue(0);
+ qApp->processEvents();
+ qWarning() << "Start downloading the list of sources";
+ int ret = iMgr.refreshRemoteSourceConfiguration();
+ bool success = false;
+ if ( !ret ) { //make sure the sources were updated sucessfully
+ qDebug() << "download succeeded";
+ success = true;
+ m_progressDialog->setValue(100); //make sure the dialog closes
+ m_remoteListAdded = true;
+ accept();
+ }
+ else {
+ qWarning("InstallMgr: getting remote list returned an error.");
+ success = false;
+ }
+ delete m_progressDialog;
+ m_progressDialog = 0;
+}
- boost::scoped_ptr<CSwordSetupInstallSourcesDialog> dlg( new CSwordSetupInstallSourcesDialog() );
- sword::InstallSource newSource(""); //empty, invalid Source
+void CSwordSetupInstallSourcesDialog::slotRefreshProgress(const int, const int current) {
+ if (m_progressDialog) {
+ if (m_progressDialog->labelText() != tr("Refreshing...")) {
+ m_progressDialog->setLabelText(tr("Refreshing..."));
+ }
+ m_progressDialog->setValue(current);
+ }
+ qApp->processEvents();
+}
- if (dlg->exec() == QDialog::Accepted) {
- if (dlg->m_protocolCombo->currentText() == PROTO_FTP) {
- newSource.type = "FTP";
- newSource.source = dlg->m_serverEdit->text().toUtf8();
+void CSwordSetupInstallSourcesDialog::slotRefreshCanceled() {
+ Q_ASSERT(m_currentInstallMgr);
+ if (m_currentInstallMgr) {
+ m_currentInstallMgr->terminate();
+ }
+ qApp->processEvents();
+}
- //a message to the user would be nice, but we're in message freeze right now (1.5.1)
- if (dlg->m_serverEdit->text().right(1) == "/") { //remove a trailing slash
- newSource.source = dlg->m_serverEdit->text().mid(0, dlg->m_serverEdit->text().length() - 1).toUtf8();
- }
- }
- else {
- newSource.type = "DIR";
- newSource.source = "local";
+sword::InstallSource CSwordSetupInstallSourcesDialog::getSource() {
+ sword::InstallSource newSource(""); //empty, invalid Source
+ if (m_protocolCombo->currentText() == PROTO_FTP) {
+ newSource.type = "FTP";
+ newSource.source = m_serverEdit->text().toUtf8();
+ //a message to the user would be nice, but we're in message freeze right now (1.5.1)
+ if (m_serverEdit->text().right(1) == "/") { //remove a trailing slash
+ newSource.source = m_serverEdit->text().mid(0, m_serverEdit->text().length() - 1).toUtf8();
}
- newSource.caption = dlg->m_captionEdit->text().toUtf8();
- newSource.directory = dlg->m_pathEdit->text().toUtf8();
}
+ else {
+ newSource.type = "DIR";
+ newSource.source = "local";
+ }
+ newSource.caption = m_captionEdit->text().toUtf8();
+ newSource.directory = m_pathEdit->text().toUtf8();
+ newSource.uid = newSource.source;
+
return newSource;
}
diff --git a/src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h b/src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h
index d875cda..64c7f21 100644
--- a/src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h
+++ b/src/frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h
@@ -7,39 +7,44 @@
*
**********/
-
#ifndef CSWORDSETUPINSTALLSOURCESDIALOG_H
#define CSWORDSETUPINSTALLSOURCESDIALOG_H
-#include "frontend/bookshelfmanager/btinstallmgr.h"
-
#include <QDialog>
+#include "frontend/bookshelfmanager/btinstallmgr.h"
+
+// Sword includes:
#include <installmgr.h>
-class QLabel;
+
class QComboBox;
+class QLabel;
class QLineEdit;
-
-
+class QProgressDialog;
class CSwordSetupInstallSourcesDialog : public QDialog {
Q_OBJECT
public:
- static sword::InstallSource getSource();
-
- protected:
+ sword::InstallSource getSource();
+ bool wasRemoteListAdded() {return m_remoteListAdded;}
CSwordSetupInstallSourcesDialog();
protected slots:
void slotOk();
void slotProtocolChanged();
+ void slotGetListClicked();
+ void slotRefreshCanceled();
+ void slotRefreshProgress(const int, const int current);
private:
QLabel *m_serverLabel;
QLineEdit *m_captionEdit, *m_serverEdit, *m_pathEdit;
QComboBox *m_protocolCombo;
+ QProgressDialog* m_progressDialog;
+ BtInstallMgr* m_currentInstallMgr;
+ bool m_remoteListAdded;
};
diff --git a/src/frontend/bookshelfmanager/indexpage/btindexpage.cpp b/src/frontend/bookshelfmanager/indexpage/btindexpage.cpp
index 2a628c9..df388dd 100644
--- a/src/frontend/bookshelfmanager/indexpage/btindexpage.cpp
+++ b/src/frontend/bookshelfmanager/indexpage/btindexpage.cpp
@@ -7,31 +7,28 @@
*
**********/
-#include "btindexpage.h"
+#include "frontend/bookshelfmanager/indexpage/btindexpage.h"
-#include "frontend/cmoduleindexdialog.h"
-#include "backend/config/cbtconfig.h"
-
-#include "util/ctoolclass.h"
-#include "util/cresmgr.h"
-#include "util/cpointers.h"
-#include "util/directoryutil.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/managers/cswordbackend.h"
-
-//Qt includes
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QTreeWidget>
-#include <QTreeWidgetItem>
#include <QCheckBox>
#include <QDir>
+#include <QHBoxLayout>
#include <QPushButton>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QVBoxLayout>
+#include "backend/config/cbtconfig.h"
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "backend/managers/cswordbackend.h"
+#include "frontend/cmoduleindexdialog.h"
+#include "util/directory.h"
+#include "util/cpointers.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
BtIndexPage::BtIndexPage()
: BtConfigPage() {
+ namespace DU = util::directory;
QVBoxLayout *vboxLayout;
QHBoxLayout *hboxLayout;
@@ -65,15 +62,15 @@ BtIndexPage::BtIndexPage()
// configure the list view
m_moduleList->setHeaderLabels( (QStringList(tr("Work")) << tr("Index size")) );
m_moduleList->setRootIsDecorated(true);
- m_moduleList->setColumnWidth(0, CToolClass::mWidth(m_moduleList, 20) );
+ m_moduleList->setColumnWidth(0, util::tool::mWidth(m_moduleList, 20) );
//m_moduleList->setTextAlignment(1, Qt::AlignRight); see doc...
m_moduleList->setSortingEnabled(false);
m_autoDeleteOrphanedIndicesBox->setChecked( CBTConfig::get( CBTConfig::autoDeleteOrphanedIndices ) );
// icons for our buttons
- m_createButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::indexpage::create_icon));
- m_deleteButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::indexpage::delete_icon));
+ m_createButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::indexpage::create_icon));
+ m_deleteButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::indexpage::delete_icon));
// connect our signals/slots
connect(m_createButton, SIGNAL(clicked()), this, SLOT(createIndices()));
diff --git a/src/frontend/bookshelfmanager/indexpage/btindexpage.h b/src/frontend/bookshelfmanager/indexpage/btindexpage.h
index 139c4a7..aa13eb0 100644
--- a/src/frontend/bookshelfmanager/indexpage/btindexpage.h
+++ b/src/frontend/bookshelfmanager/indexpage/btindexpage.h
@@ -7,13 +7,13 @@
*
**********/
-
#ifndef BTINDEXPAGE_H
#define BTINDEXPAGE_H
#include "frontend/bookshelfmanager/btconfigdialog.h"
#include "backend/btmoduletreeitem.h"
+
class QCheckBox;
class QTreeWidget;
class QTreeWidgetItem;
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.cpp b/src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.cpp
index 1668a87..8fd87ec 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.cpp
+++ b/src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.cpp
@@ -1,132 +1,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-#include "btinstallmodulechooserdialog.h"
+#include "frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.h"
-#include "frontend/cmodulechooserdialog.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/btmoduletreeitem.h"
-
-#include <QString>
+#include <QBrush>
+#include <QDebug>
#include <QList>
-#include <QWidget>
+#include <QPushButton>
#include <QString>
#include <QTreeWidgetItem>
-#include <QBrush>
-#include <QPushButton>
-
-#include <QDebug>
+#include <QWidget>
+#include "backend/btmoduletreeitem.h"
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/cmodulechooserdialog.h"
BtInstallModuleChooserDialog::BtInstallModuleChooserDialog(QWidget* parent, QString title, QString label, QList<CSwordModuleInfo*>* empty)
: CModuleChooserDialog(parent, title, label, empty) {
- qDebug("BtInstallModuleChooserDialog::BtInstallModuleChooserDialog start");
+ qDebug() << "BtInstallModuleChooserDialog::BtInstallModuleChooserDialog start";
init();
okButton()->setText(tr("Install"));
m_nameList = QStringList();
@@ -163,16 +60,16 @@ void BtInstallModuleChooserDialog::initModuleItem(QString name, QTreeWidgetItem*
void BtInstallModuleChooserDialog::slotItemChecked(QTreeWidgetItem* item, int column) {
QString moduleName = item->text(0);
- qDebug("BtInstallModuleChooserDialog::slotItemChecked start");
+ qDebug() << "BtInstallModuleChooserDialog::slotItemChecked start";
// handle only non-toplevel items which has duplicates and where the first column was changed
if (item->parent() && column == 0 && (findModuleItemsByName(moduleName).count() > 1)) {
//prevent handling when the color is changed
if (item->data(1, Qt::UserRole).toBool() == false) {
- qDebug("was not updating");
+ qDebug() << "was not updating";
item->setData(1, Qt::UserRole, true);
}
else {
- qDebug("was updating");
+ qDebug() << "was updating";
item->setData(1, Qt::UserRole, false);
return;
}
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.h b/src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.h
index 788dbf5..06144ff 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.h
+++ b/src/frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.h
@@ -12,17 +12,16 @@
#include "frontend/cmodulechooserdialog.h"
+#include <QList>
+#include <QMap>
#include <QObject>
#include <QString>
-#include <QMap>
-#include <QList>
-class BTModuleTreeItem;
+class BTModuleTreeItem;
class QWidget;
class QTreeWidgetItem;
-
/**
* Confirmation dialog for installation. Lets the user
* uncheck modules from the list.
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallpage.cpp b/src/frontend/bookshelfmanager/installpage/btinstallpage.cpp
index 4fe9c41..ecdf7e3 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallpage.cpp
+++ b/src/frontend/bookshelfmanager/installpage/btinstallpage.cpp
@@ -7,58 +7,48 @@
*
**********/
-
-#include "btinstallpage.h"
-
-#include "btinstallpathdialog.h"
-#include "btinstallprogressdialog.h"
-#include "btsourcewidget.h"
-#include "btsourcearea.h"
-
-#include "frontend/bookshelfmanager/btinstallmgr.h"
-#include "frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h"
-#include "frontend/bookshelfmanager/btconfigdialog.h"
-#include "frontend/bookshelfmanager/instbackend.h"
-#include "frontend/bookshelfmanager/btmodulemanagerdialog.h"
-
-#include "frontend/cmodulechooserdialog.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/managers/cswordbackend.h"
-#include "backend/config/cbtconfig.h"
-
-#include "util/cpointers.h"
-#include "util/ctoolclass.h"
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-
-#include <boost/scoped_ptr.hpp>
-
+#include "frontend/bookshelfmanager/installpage/btinstallpage.h"
#include <QAction>
#include <QApplication>
-#include <QWidget>
#include <QButtonGroup>
#include <QComboBox>
#include <QDialog>
+#include <QFileInfo>
#include <QHBoxLayout>
+#include <QHeaderView>
#include <QLabel>
+#include <QMessageBox>
+#include <QProgressBar>
+#include <QProgressDialog>
#include <QPushButton>
-#include <QToolButton>
#include <QSpacerItem>
-#include <QTabBar>
#include <QStackedWidget>
+#include <QTabBar>
+#include <QTimer>
#include <QTreeWidget>
#include <QTreeWidgetItem>
+#include <QToolButton>
#include <QVBoxLayout>
-#include <QFileInfo>
-#include <QMessageBox>
-#include <QProgressDialog>
-#include <QTimer>
-#include <QProgressBar>
-
-#include <QHeaderView>
+#include <QWidget>
+#include "backend/config/cbtconfig.h"
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "backend/managers/cswordbackend.h"
+#include "frontend/bookshelfmanager/btconfigdialog.h"
+#include "frontend/bookshelfmanager/btinstallmgr.h"
+#include "frontend/bookshelfmanager/btmodulemanagerdialog.h"
+#include "frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h"
+#include "frontend/bookshelfmanager/installpage/btinstallpathdialog.h"
+#include "frontend/bookshelfmanager/installpage/btinstallprogressdialog.h"
+#include "frontend/bookshelfmanager/installpage/btsourcewidget.h"
+#include "frontend/bookshelfmanager/installpage/btsourcearea.h"
+#include "frontend/bookshelfmanager/instbackend.h"
+#include "frontend/cmodulechooserdialog.h"
+#include "util/directory.h"
+#include "util/cpointers.h"
+#include "util/cresmgr.h"
+// Sword includes:
#include <swversion.h>
@@ -68,13 +58,13 @@
BtInstallPage::BtInstallPage()
: BtConfigPage() {
- qDebug("BtInstallPage::BtInstallPage() start");
+ qDebug() << "BtInstallPage::BtInstallPage() start";
initView();
initConnections();
}
void BtInstallPage::setInstallEnabled(bool b) {
- qDebug("void BtInstallPage::setInstallEnabled(bool b) start");
+ qDebug() << "void BtInstallPage::setInstallEnabled(bool b) start";
m_installButton->setEnabled(b);
}
@@ -83,7 +73,9 @@ QString BtInstallPage::selectedInstallPath() {
}
void BtInstallPage::initView() {
- qDebug("void BtInstallPage::initView() start");
+ namespace DU = util::directory;
+
+ qDebug() << "void BtInstallPage::initView() start";
QVBoxLayout *mainLayout = new QVBoxLayout(this);
// installation path chooser
@@ -95,24 +87,24 @@ void BtInstallPage::initView() {
int right;
pathLayout->getContentsMargins(&left, &top, &right, &bottom);
pathLayout->setContentsMargins(left, top + 7, right, bottom + 7 );
- QSpacerItem *pathSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
- QLabel* pathLabel = new QLabel(tr("Install path:"));
+ QLabel* pathLabel = new QLabel(tr("Install folder:"));
m_pathCombo = new QComboBox();
- m_pathCombo->setToolTip(tr("The path where the new works will be installed"));
+ m_pathCombo->setMinimumContentsLength(20);
+ m_pathCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
+ m_pathCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+ m_pathCombo->setToolTip(tr("The folder where the new works will be installed"));
+ m_pathCombo->view()->setTextElideMode(Qt::ElideMiddle);
initPathCombo(); // set the paths and the current path
- //m_configurePathButton = new QPushButton(tr("Configure...")); //TODO: icon only?
m_configurePathButton = new QToolButton(this);
- m_configurePathButton->setToolTip(tr("Configure paths where works are installed"));
- m_configurePathButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::installpage::path_icon));
+ m_configurePathButton->setToolTip(tr("Configure folders where works are installed and found"));
+ m_configurePathButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::installpage::path_icon));
- pathLayout->addItem(pathSpacer);
pathLayout->addWidget(pathLabel);
pathLayout->addWidget(m_pathCombo);
pathLayout->addWidget(m_configurePathButton);
mainLayout->addLayout(pathLayout);
// Source widget
- //QTabWidget* m_sourcesTabWidget;
m_sourceWidget = new BtSourceWidget(this);
mainLayout->addWidget(m_sourceWidget);
// Install button
@@ -122,7 +114,7 @@ void BtInstallPage::initView() {
installButtonLayout->addItem(installButtonSpacer);
m_installButton = new QPushButton(tr("Install..."), this);
m_installButton->setToolTip(tr("Install or update selected works"));
- m_installButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::installpage::install_icon));
+ m_installButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::installpage::install_icon));
m_installButton->setEnabled(false);
installButtonLayout->addWidget(m_installButton);
@@ -130,7 +122,7 @@ void BtInstallPage::initView() {
}
void BtInstallPage::initConnections() {
- qDebug("void BtInstallPage::initConnections() start");
+ qDebug() << "void BtInstallPage::initConnections() start";
QObject::connect(m_pathCombo, SIGNAL(activated(const QString&)), this , SLOT(slotPathChanged(const QString&)));
QObject::connect(m_configurePathButton, SIGNAL(clicked()), this, SLOT(slotEditPaths()));
QObject::connect(m_installButton, SIGNAL(clicked()), m_sourceWidget, SLOT(slotInstall()) );
@@ -140,14 +132,20 @@ void BtInstallPage::initConnections() {
}
void BtInstallPage::initPathCombo() {
- qDebug("void BtInstallPage::initPathCombo() start");
+ qDebug() << "void BtInstallPage::initPathCombo() start";
//populate the combo list
m_pathCombo->clear();
QStringList targets = instbackend::targetList();
for (QStringList::iterator it = targets.begin(); it != targets.end(); ++it) {
+ // Add the path only if it's writable
if ((*it).isEmpty()) continue;
- m_pathCombo->addItem(*it);
+ QDir dir(*it);
+ if (!dir.exists()) continue;
+ if (!dir.isReadable()) continue;
+ QFileInfo fi( dir.canonicalPath());
+ if (!fi.isWritable()) continue;
+ m_pathCombo->addItem(util::directory::convertDirSeparators(*it));
}
// choose the current value from config but check whether we have so many items
@@ -161,7 +159,7 @@ void BtInstallPage::slotPathChanged(const QString& /*pathText*/) {
}
void BtInstallPage::slotEditPaths() {
- qDebug("void BtInstallPage::slotEditPaths() start");
+ qDebug() << "void BtInstallPage::slotEditPaths() start";
BtInstallPathDialog* dlg = new BtInstallPathDialog();
int result = dlg->exec();
@@ -177,7 +175,7 @@ QString BtInstallPage::iconName() {
return CResMgr::bookshelfmgr::installpage::icon;
}
QString BtInstallPage::label() {
- // TODO: move the warning to a dialog which is shown when adding a source.
+ // \todo move the warning to a dialog which is shown when adding a source.
return tr("Install and update works. Add remote or local sources, refresh them, select the works to be installed/updated and click Install.<br/><b>WARNING:</b> If you live in a persecuted country and don't want to risk detection don't use remote sources.");
}
QString BtInstallPage::header() {
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallpage.h b/src/frontend/bookshelfmanager/installpage/btinstallpage.h
index 41493f8..fde9919 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallpage.h
+++ b/src/frontend/bookshelfmanager/installpage/btinstallpage.h
@@ -10,16 +10,15 @@
#ifndef BTINSTALLPAGE_H
#define BTINSTALLPAGE_H
-
#include "frontend/bookshelfmanager/btconfigdialog.h"
#include <QString>
+// Sword includes:
#include <installmgr.h>
class BtSourceWidget;
-
class QComboBox;
class QPushButton;
class QToolButton;
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallpathdialog.cpp b/src/frontend/bookshelfmanager/installpage/btinstallpathdialog.cpp
index 27b3d3a..c6175d5 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallpathdialog.cpp
+++ b/src/frontend/bookshelfmanager/installpage/btinstallpathdialog.cpp
@@ -7,32 +7,31 @@
*
**********/
-#include "btinstallpathdialog.h"
+#include "frontend/bookshelfmanager/installpage/btinstallpathdialog.h"
-#include "frontend/bookshelfmanager/instbackend.h"
-
-#include "util/ctoolclass.h"
-#include "util/dialogutil.h"
-#include "util/directoryutil.h"
-#include "util/cresmgr.h"
-
-#include <QString>
+#include <QDebug>
#include <QDialog>
+#include <QDialogButtonBox>
#include <QDir>
+#include <QFileDialog>
#include <QGridLayout>
+#include <QHeaderView>
#include <QLabel>
+#include <QPushButton>
+#include <QString>
#include <QTreeWidget>
#include <QTreeWidgetItem>
-#include <QPushButton>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QHeaderView>
-#include <QDialogButtonBox>
+#include "frontend/bookshelfmanager/instbackend.h"
+#include "util/dialogutil.h"
+#include "util/directory.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
-#include <QDebug>
BtInstallPathDialog::BtInstallPathDialog() {
- setWindowTitle(tr("Bookshelf Paths"));
+ namespace DU = util::directory;
+
+ setWindowTitle(tr("Bookshelf Folders"));
QVBoxLayout *mainLayout;
QHBoxLayout *viewLayout;
@@ -40,15 +39,17 @@ BtInstallPathDialog::BtInstallPathDialog() {
mainLayout = new QVBoxLayout(this);
viewLayout = new QHBoxLayout();
- QString l1 = tr("Works can be installed in one or more directories. After setting up directories here you can choose one of them in Install page.");
- QString l2 = tr("BibleTime and the Sword library find the modules from all of these directories. If the directory is removed here it still exists in the system with all the works in it. \".sword\" directory in your home directory is always used automatically and can't be removed or added.");
+ QString l1 = tr("Works can be installed in one or more folders. After setting up folders here you can choose one of them in Install page.");
+ /// \bug The following string has an extra space character:
+ QString l2 = tr("BibleTime and the SWORD library find the works from all of these folders. If a folder is removed here it still exists in the system with all the works in it.");
- QLabel* mainLabel = CToolClass::explanationLabel(this,
- tr("Configure bookshelf paths"), l1 + QString("<small><br><br>") + l2 + QString("</small>"));
+ QLabel* mainLabel = util::tool::explanationLabel(this,
+ tr("Configure bookshelf folders"), l1 + QString("<small><br/><br/>") + l2 + QString("</small>"));
mainLayout->addWidget(mainLabel);
QString swordConfPath = instbackend::swordConfigFilename();
- QLabel* confPathLabel = new QLabel(tr("Configuration file for the paths is: ").append("<b>%1</b>").arg(swordConfPath), this);
+ /// \todo After releasing 2.4, change the following line to: QLabel *confPathLabel = new QLabel(tr("Configuration file for the folders is: <b>%1</b>").arg(swordConfPath), this);
+ QLabel* confPathLabel = new QLabel(tr("Configuration file for the folders is: ").append("<b>%1</b>").arg(swordConfPath), this);
confPathLabel->setWordWrap(true);
mainLayout->addWidget(confPathLabel);
@@ -56,32 +57,40 @@ BtInstallPathDialog::BtInstallPathDialog() {
m_swordPathListBox = new QTreeWidget(this);
m_swordPathListBox->header()->hide();
- QDir swordDir = instbackend::swordDir();
+ QString rwfolderitem(tr("Folders where new works can be installed"));
+ m_writableItem = new QTreeWidgetItem(m_swordPathListBox, QStringList(rwfolderitem));;
+ m_writableItem->setFlags(Qt::ItemIsEnabled);
+ m_readableItem = new QTreeWidgetItem(m_swordPathListBox, QStringList(tr("Read-only folders")));;
+ m_readableItem->setFlags(Qt::ItemIsEnabled);
+ m_nonexistingItem = new QTreeWidgetItem(m_swordPathListBox, QStringList(tr("Nonexistent folders")));;
+ m_nonexistingItem->setFlags(Qt::ItemIsEnabled);
+
QStringList targets = instbackend::targetList();
+
foreach (QString pathname, targets) {
- if (pathname.isEmpty() || QDir(pathname) == swordDir) continue;
- new QTreeWidgetItem(m_swordPathListBox, QStringList(pathname) );
+ addPathToList(pathname);
}
+ updateTopLevelItems();
viewLayout->addWidget(m_swordPathListBox);
QVBoxLayout* buttonLayout = new QVBoxLayout();
m_addButton = new QPushButton(tr("Add..."), this);
- m_addButton->setToolTip(tr("Add new path"));
- m_addButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::paths::add_icon));
+ m_addButton->setToolTip(tr("Add new folder"));
+ m_addButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::paths::add_icon));
connect(m_addButton, SIGNAL(clicked()), this, SLOT(slotAddClicked()));
buttonLayout->addWidget(m_addButton);
m_editButton = new QPushButton(tr("Edit..."), this);
- m_editButton->setToolTip(tr("Edit the selected path"));
- m_editButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::paths::edit_icon));
+ m_editButton->setToolTip(tr("Edit the selected folder"));
+ m_editButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::paths::edit_icon));
connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEditClicked()));
buttonLayout->addWidget(m_editButton);
m_removeButton = new QPushButton(tr("Remove"), this);
- m_removeButton->setToolTip(tr("Remove the selected path"));
- m_removeButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::paths::remove_icon));
+ m_removeButton->setToolTip(tr("Remove the selected folder"));
+ m_removeButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::paths::remove_icon));
connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveClicked()));
buttonLayout->addWidget(m_removeButton);
@@ -98,12 +107,65 @@ BtInstallPathDialog::BtInstallPathDialog() {
mainLayout->addWidget(buttonBox);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ //clumsy way to set width. Could someone please fix Qt to have an easy way to set widget sizes?
+ int textWidth = fontMetrics().width(rwfolderitem.append("MMMMMMMMMM"));
+ int buttonWidth = m_addButton->width();
+ resize(textWidth + buttonWidth, size().height());
+}
+
+BtInstallPathDialog::~BtInstallPathDialog() {
+ m_swordPathListBox->invisibleRootItem()->takeChildren();
+ delete m_readableItem;
+ delete m_writableItem;
+ delete m_nonexistingItem;
+}
+
+void BtInstallPathDialog::updateTopLevelItems() {
+ qDebug() << "BtInstallPathDialog::updateTopLevelItems";
+ if (m_writableItem->childCount()) {
+ m_writableItem->setHidden(false);
+ m_swordPathListBox->expandItem(m_writableItem);
+ } else {
+ m_writableItem->setHidden(true);
+ }
+ if (m_readableItem->childCount()) {
+ m_readableItem->setHidden(false);
+ m_swordPathListBox->expandItem(m_readableItem);
+ } else {
+ m_readableItem->setHidden(true);
+ }
+ if (m_nonexistingItem->childCount()) {
+ m_nonexistingItem->setHidden(false);
+ m_swordPathListBox->expandItem(m_nonexistingItem);
+ } else {
+ m_nonexistingItem->setHidden(true);
+ }
+}
+
+void BtInstallPathDialog::addPathToList(QString pathname) {
+ if (pathname.isEmpty()) return;
+ QTreeWidgetItem* i = 0;
+ QDir dir(pathname);
+ if (!dir.exists()) {
+ i = new QTreeWidgetItem(m_nonexistingItem, QStringList(pathname) );
+ } else if (dir.isReadable()) {
+ const QFileInfo fi( dir.canonicalPath() );
+ if (fi.isWritable()) {
+ i = new QTreeWidgetItem(m_writableItem, QStringList(pathname) );
+ } else {
+ i = new QTreeWidgetItem(m_readableItem, QStringList(pathname) );
+ }
+ }
+ if (i && QDir(pathname) == instbackend::swordDir()) {
+ i->setFlags(Qt::NoItemFlags);
+ i->setToolTip(0, tr("This default folder in your home directory can't be removed"));
+ }
}
void BtInstallPathDialog::slotEditClicked() {
if (QTreeWidgetItem* i = m_swordPathListBox->currentItem()) {
- QString dirname = QFileDialog::getExistingDirectory(this, tr("Choose directory"), i->text(0), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+ QString dirname = QFileDialog::getExistingDirectory(this, tr("Choose Folder"), i->text(0), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if (dirname.isEmpty()) { // if user cancelled the dialog
return;
@@ -112,16 +174,19 @@ void BtInstallPathDialog::slotEditClicked() {
if (dir.isReadable()) {
const QFileInfo fi( dir.canonicalPath() );
if (!fi.exists() || !fi.isWritable()) {
- const int result = QMessageBox::warning(this, tr("Use Directory?"), tr("This directory is not writable, so works can not be installed here using BibleTime. Do you want to use this directory instead of the previous value?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
+ const int result = util::showWarning(this, tr("Use Folder?"), tr("This folder is not writable, so works can not be installed here using BibleTime. Do you want to use this folder instead of the previous value?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (result != QMessageBox::Yes) return;
}
- i->setText(0, dir.absolutePath()); // absolute, not canonical
+ //i->setText(0, dir.absolutePath()); // absolute, not canonical
+ addPathToList(dir.absolutePath());
+ delete i;
+ updateTopLevelItems();
}
}
}
void BtInstallPathDialog::slotAddClicked() {
- QString dirname = QFileDialog::getExistingDirectory(this, tr("Choose directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+ QString dirname = QFileDialog::getExistingDirectory(this, tr("Choose Folder"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if (dirname.isEmpty()) { // if user cancelled the dialog
return;
}
@@ -129,36 +194,39 @@ void BtInstallPathDialog::slotAddClicked() {
if (dir.isReadable()) {
const QFileInfo fi( dir.canonicalPath() );
if (!fi.exists() || !fi.isWritable()) {
- const int result = QMessageBox::warning(this, tr("Warning"), tr("This directory is not writable, so works can not be installed here using BibleTime. Do you still want to add it to the list of bookshelf directories?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
+ const int result = util::showWarning(this, tr("Use Folder?"), tr("This folder is not writable, so works can not be installed here using BibleTime. Do you still want to add it to the list of bookshelf folders?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (result != QMessageBox::Yes) {
return;
}
}
- new QTreeWidgetItem(m_swordPathListBox, QStringList(dir.canonicalPath()) );
+ addPathToList(util::directory::convertDirSeparators(dir.canonicalPath()));
+ updateTopLevelItems();
}
}
void BtInstallPathDialog::slotRemoveClicked() {
- QTreeWidgetItem* i = m_swordPathListBox->currentItem();
- if (i) {
+ qDebug() << "BtInstallPathDialog::slotRemoveClicked";
+ QTreeWidgetItem* i = m_swordPathListBox->selectedItems().value(0);
+ qDebug() << i;
+ if (i && i->parent() != m_swordPathListBox->invisibleRootItem()) {
+ qDebug() << "delete" << i;
delete i;
}
+ updateTopLevelItems();
}
void BtInstallPathDialog::writeSwordConfig() {
- qDebug("BtInstallPathDialog::writeSwordConfig");
- if (m_swordPathListBox->topLevelItemCount() >= 0) {
- QStringList targets;
- QTreeWidgetItemIterator it(m_swordPathListBox);
- while (*it) {
- if (!(*it)->text(0).isEmpty()) {
- targets << (*it)->text(0);
- }
- ++it;
+ qDebug() << "BtInstallPathDialog::writeSwordConfig";
+ QStringList targets;
+ QTreeWidgetItemIterator it(m_swordPathListBox, QTreeWidgetItemIterator::NoChildren|QTreeWidgetItemIterator::Enabled|QTreeWidgetItemIterator::NotHidden);
+ while (*it) {
+ if (!(*it)->text(0).isEmpty()) {
+ targets << (*it)->text(0);
}
- qDebug() << "save the target list" << targets;
- instbackend::setTargetList(targets); //creates new Sword config
+ ++it;
}
+ qDebug() << "save the target list" << targets;
+ instbackend::setTargetList(targets); //creates new Sword config
}
void BtInstallPathDialog::accept() {
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallpathdialog.h b/src/frontend/bookshelfmanager/installpage/btinstallpathdialog.h
index b2f18a1..e72da3c 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallpathdialog.h
+++ b/src/frontend/bookshelfmanager/installpage/btinstallpathdialog.h
@@ -12,14 +12,16 @@
#include <QDialog>
+
class QPushButton;
class QTreeWidget;
-
+class QTreeWidgetItem;
class BtInstallPathDialog : public QDialog {
Q_OBJECT
public:
BtInstallPathDialog();
+ ~BtInstallPathDialog();
public slots:
virtual void accept();
@@ -31,13 +33,17 @@ class BtInstallPathDialog : public QDialog {
private:
void writeSwordConfig();
+ void updateTopLevelItems();
+ void addPathToList(QString path);
private:
QPushButton* m_editButton;
QPushButton* m_addButton;
QPushButton* m_removeButton;
QTreeWidget* m_swordPathListBox;
-
+ QTreeWidgetItem* m_writableItem;
+ QTreeWidgetItem* m_readableItem;
+ QTreeWidgetItem* m_nonexistingItem;
};
#endif
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp b/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp
index 7883220..365d5c8 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp
+++ b/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp
@@ -7,26 +7,22 @@
*
**********/
-#include "btinstallprogressdialog.h"
+#include "frontend/bookshelfmanager/installpage/btinstallprogressdialog.h"
-#include "btinstallthread.h"
-
-#include "util/ctoolclass.h"
-#include "util/cpointers.h"
-#include "backend/managers/cswordbackend.h"
-
-#include <QTreeWidget>
-#include <QTreeWidgetItem>
+#include <QApplication>
+#include <QCloseEvent>
+#include <QDebug>
#include <QDialog>
#include <QHeaderView>
+#include <QMultiMap>
#include <QProgressBar>
#include <QPushButton>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
#include <QVBoxLayout>
-#include <QApplication>
-#include <QCloseEvent>
-#include <QMultiMap>
-
-#include <QDebug>
+#include "backend/managers/cswordbackend.h"
+#include "frontend/bookshelfmanager/installpage/btinstallthread.h"
+#include "util/cpointers.h"
BtInstallProgressDialog::BtInstallProgressDialog(QWidget* parent, QTreeWidget* selectedModulesTreeWidget, QString destination)
@@ -41,7 +37,7 @@ BtInstallProgressDialog::BtInstallProgressDialog(QWidget* parent, QTreeWidget* s
m_statusWidget->header()->setStretchLastSection(false);
m_statusWidget->header()->setResizeMode(1, QHeaderView::Stretch);
m_statusWidget->header()->setMovable(false);
- //m_statusWidget->setColumnWidth(1, CToolClass::mWidth(m_statusWidget, 2));
+ //m_statusWidget->setColumnWidth(1, util::tool::mWidth(m_statusWidget, 2));
foreach (QTreeWidgetItem* sourceItem, selectedModulesTreeWidget->invisibleRootItem()->takeChildren()) {
// create items and threads for modules under this source
@@ -125,7 +121,7 @@ void BtInstallProgressDialog::startThreads() {
t->start();
}
- qDebug("BtInstallProgressDialog::startThreads end");
+ qDebug() << "BtInstallProgressDialog::startThreads end";
}
BtInstallProgressDialog::~BtInstallProgressDialog() {}
@@ -133,7 +129,8 @@ BtInstallProgressDialog::~BtInstallProgressDialog() {}
void BtInstallProgressDialog::slotOneItemCompleted(QString module, QString source, int status) {
QString message;
- //status comes from the sword installer. TODO: Additionally we should check that there are files really installed.
+ //status comes from the sword installer.
+ /// \todo Additionally we should check that there are files really installed.
if (status != 0) {
message = tr("Failed");
}
@@ -189,7 +186,7 @@ void BtInstallProgressDialog::oneItemStoppedOrCompleted(QString module, QString
}
void BtInstallProgressDialog::slotStopInstall() {
- qDebug("BtInstallProgressDialog::slotStopInstall");
+ qDebug() << "BtInstallProgressDialog::slotStopInstall";
// Clear the waiting threads map, stop all running threads.
@@ -205,7 +202,7 @@ void BtInstallProgressDialog::slotStopInstall() {
}
void BtInstallProgressDialog::slotStatusUpdated(QString module, int status) {
- //qDebug("BtInstallProgressDialog::slotStatusUpdated");
+ //qDebug() << "BtInstallProgressDialog::slotStatusUpdated";
//qDebug() << "module:" << module << "status:" << status;
// find the progress bar for this module and update the value
QWidget* itemWidget = m_statusWidget->itemWidget(getItem(module) , 1);
@@ -234,7 +231,7 @@ QTreeWidgetItem* BtInstallProgressDialog::getItem(QString moduleName) {
}
void BtInstallProgressDialog::closeEvent(QCloseEvent* event) {
- qDebug("BtInstallProgressDialog::closeEvent");
+ qDebug() << "BtInstallProgressDialog::closeEvent";
if (event->spontaneous()) {
event->ignore();
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.h b/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.h
index 79c6331..1d8113a 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.h
+++ b/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.h
@@ -11,18 +11,15 @@
#define BTINSTALLPROGRESSDIALOG_H
#include <QDialog>
-#include <QString>
+
#include <QMultiMap>
+#include <QString>
-class QTreeWidget;
-class QTreeWidgetItem;
class BtInstallThread;
+class QTreeWidget;
+class QTreeWidgetItem;
-
-/**
-
-*/
class BtInstallProgressDialog : public QDialog {
Q_OBJECT
public:
@@ -50,7 +47,7 @@ class BtInstallProgressDialog : public QDialog {
private:
- //TODO: using maps is tedious and error prone. Find better solution for handling the modules
+ /// \todo using maps is tedious and error prone. Find better solution for handling the modules
// and their states.
QMultiMap<QString, BtInstallThread*> m_waitingThreads;
QMultiMap<QString, BtInstallThread*> m_runningThreads;
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallthread.cpp b/src/frontend/bookshelfmanager/installpage/btinstallthread.cpp
index 48e38ce..53ae071 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallthread.cpp
+++ b/src/frontend/bookshelfmanager/installpage/btinstallthread.cpp
@@ -7,23 +7,22 @@
*
**********/
-#include "btinstallthread.h"
-
-#include "frontend/bookshelfmanager/btinstallmgr.h"
-#include "frontend/bookshelfmanager/instbackend.h"
-#include "util/cpointers.h"
-#include "backend/managers/cswordbackend.h"
+#include "frontend/bookshelfmanager/installpage/btinstallthread.h"
#include <QApplication>
+#include <QDebug>
+#include <QDir>
#include <QString>
#include <QThread>
-#include <QDir>
-
-#include <QDebug>
+#include "backend/managers/cswordbackend.h"
+#include "frontend/bookshelfmanager/btinstallmgr.h"
+#include "frontend/bookshelfmanager/instbackend.h"
+#include "util/cpointers.h"
-// sword
+// Sword includes:
#include <filemgr.h>
+
BtInstallThread::BtInstallThread(QObject* parent, QString moduleName, QString sourceName, QString destinationName)
: QThread(parent),
done(false),
@@ -44,12 +43,13 @@ void BtInstallThread::run() {
emit preparingInstall(m_module, m_source);
-
+ //This is 0 before set here - remember when using the value when cancelling
+ // the installation before this has been run
m_installSource.reset(new sword::InstallSource(instbackend::source(m_source)));
m_backendForSource.reset(instbackend::backend(*m_installSource));
//make sure target/mods.d and target/modules exist
- //TODO: move this to some common precondition
+ /// \todo move this to some common precondition
QDir dir(m_destination);
if (!dir.exists()) {
dir.mkdir(m_destination);
@@ -68,7 +68,7 @@ void BtInstallThread::run() {
QObject::connect(m_iMgr, SIGNAL(downloadStarted()), this, SLOT(slotDownloadStarted()), Qt::QueuedConnection);
//check whether it's an update. If yes, remove existing module first
- //TODO: silently removing without undo if the user cancels the update is WRONG!!!
+ /// \todo silently removing without undo if the user cancels the update is WRONG!!!
removeModule();
// manager for the destination path
@@ -112,35 +112,36 @@ void BtInstallThread::slotStopInstall() {
qDebug() << "BtInstallThread::slotStopInstall 2";
//qApp->processEvents();
// wait to terminate for some secs. We rather let the execution go on and cleaning up to fail than the app to freeze
- int notRun = this->wait(200);
+ int notRun = this->wait(25000);
if (notRun) {
this->terminate();
- this->wait(2);
+ this->wait(10000);
qDebug() << "installthread (" << m_module << ") terminated, delete m_iMgr";
delete m_iMgr; // this makes sure the ftp library will be cleaned up in the destroyer
m_iMgr = 0;
}
qDebug() << "BtInstallThread::slotStopInstall 3";
// cleanup: remove the module, remove the temp files
- if (true) {
+ // if installation has already started
+ if (m_installSource.get() != 0) {
qDebug() << "BtInstallThread::slotStopInstall 4";
// remove the installed module, just to be sure because mgr may
// have been terminated when copying files
removeModule();
removeTempFiles();
qDebug() << "BtInstallThread::slotStopInstall will emit installStopped...";
- emit installStopped(m_module, m_source);
}
+ emit installStopped(m_module, m_source);
}
}
void BtInstallThread::slotManagerStatusUpdated(int totalProgress, int /*fileProgress*/) {
- //qDebug("BtInstallThread::slotManagerStatusUpdated");
+ //qDebug() << "BtInstallThread::slotManagerStatusUpdated";
emit statusUpdated(m_module, totalProgress);
}
void BtInstallThread::slotDownloadStarted() {
- qDebug("BtInstallThread::slotDownloadStarted");
+ qDebug() << "BtInstallThread::slotDownloadStarted";
emit downloadStarted(m_module);
}
@@ -176,7 +177,7 @@ void BtInstallThread::removeModule() {
}
void BtInstallThread::removeTempFiles() {
- qDebug("BtInstallThread::removeTempFiles start");
+ qDebug() << "BtInstallThread::removeTempFiles start";
// (take the remote conf file for this module, take DataPath,
// take the absolute path of the InstallMgr)
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallthread.h b/src/frontend/bookshelfmanager/installpage/btinstallthread.h
index 8a8cb37..a50910f 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallthread.h
+++ b/src/frontend/bookshelfmanager/installpage/btinstallthread.h
@@ -10,11 +10,11 @@
#ifndef BTINSTALLTHREAD_H
#define BTINSTALLTHREAD_H
-#include "frontend/bookshelfmanager/btinstallmgr.h"
-
#include <QThread>
#include <boost/scoped_ptr.hpp>
+#include "frontend/bookshelfmanager/btinstallmgr.h"
+
class BtInstallProgressDialog;
@@ -78,7 +78,7 @@ class BtInstallThread : public QThread {
BtInstallMgr* m_iMgr;
//BtInstallMgr m_iMgr;
boost::scoped_ptr<sword::InstallSource> m_installSource;
- //TODO: it would be best to get the backend from the bookshelf manager install page
+ /// \todo it would be best to get the backend from the bookshelf manager install page
// where it has already been created. Could fasten the progress dialog startup.
boost::scoped_ptr<CSwordBackend> m_backendForSource;
diff --git a/src/frontend/bookshelfmanager/installpage/btsourcearea.cpp b/src/frontend/bookshelfmanager/installpage/btsourcearea.cpp
index cfdc8bb..ca85822 100644
--- a/src/frontend/bookshelfmanager/installpage/btsourcearea.cpp
+++ b/src/frontend/bookshelfmanager/installpage/btsourcearea.cpp
@@ -7,19 +7,7 @@
*
**********/
-#include "btsourcearea.h"
-
-#include "frontend/bookshelfmanager/instbackend.h"
-
-#include "util/ctoolclass.h"
-#include "util/cpointers.h"
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-
-#include "backend/managers/cswordbackend.h"
-#include "frontend/btaboutmoduledialog.h"
-
-#include <installmgr.h>
+#include "frontend/bookshelfmanager/installpage/btsourcearea.h"
#include <QString>
#include <QWidget>
@@ -32,9 +20,19 @@
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QHeaderView>
-
#include <QDebug>
#include <QTime>
+#include "backend/managers/cswordbackend.h"
+#include "frontend/bookshelfmanager/instbackend.h"
+#include "frontend/btaboutmoduledialog.h"
+#include "util/directory.h"
+#include "util/cpointers.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
+
+// Sword includes:
+#include <installmgr.h>
+
// ****************************************************************
// ******** Installation source and module list widget ************
@@ -45,46 +43,40 @@ BtSourceArea::BtSourceArea(const QString& sourceName)
m_sourceName(sourceName),
m_treeAlreadyInitialized(false),
m_remoteBackend(0) { //important!
+ setObjectName(sourceName);
m_checkedModules = QMap<QString, bool>();
qDebug() << "BtSourceArea::BtSourceArea, " << m_sourceName;
initView();
}
BtSourceArea::~BtSourceArea() {
+ qDebug() << "BtSourceArea::~BtSourceArea" << m_sourceName;
delete m_remoteBackend;
}
void BtSourceArea::initView() {
- qDebug("BtSourceArea::initView");
+ namespace DU = util::directory;
+
+ qDebug() << "BtSourceArea::initView";
QVBoxLayout *mainLayout = new QVBoxLayout(this);
- //QHBoxLayout *refreshLabelLayout = new QHBoxLayout();
- //QLabel *refreshLabel = new QLabel(tr("Last refreshed:"));
- //m_refreshTimeLabel = new QLabel();
- //QSpacerItem *refreshLabelSpacer = new QSpacerItem(201, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
- //refreshLabelLayout->addWidget(refreshLabel);
- //refreshLabelLayout->addWidget(m_refreshTimeLabel);
- //refreshLabelLayout->addItem(refreshLabelSpacer);
- // TODO: or would it be better to integrate this information into the tooltip
- // of the source tab?
- //mainLayout->addLayout(refreshLabelLayout);
// source related button row
QHBoxLayout *sourceLayout = new QHBoxLayout();
m_refreshButton = new QPushButton(tr("Refresh..."));
m_refreshButton->setToolTip(tr("Refresh the list of works from this source"));
- m_refreshButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::installpage::refresh_icon));
+ m_refreshButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::installpage::refresh_icon));
//m_refreshButton->setEnabled(false);
QSpacerItem *sourceSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
//m_editButton = new QPushButton(tr("Edit..."));
- //m_editButton->setEnabled(false); // TODO after writing the edit widget
+ /// \todo after writing the edit widget:
+ //m_editButton->setEnabled(false);
m_deleteButton = new QPushButton(tr("Delete..."));
m_deleteButton->setToolTip(tr("Delete this source"));
- m_deleteButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::installpage::delete_icon));
+ m_deleteButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::installpage::delete_icon));
//m_deleteButton->setEnabled(false);
m_addButton = new QPushButton(tr("Add..."));
m_addButton->setToolTip(tr("Add new source"));
- m_addButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::installpage::add_icon));
+ m_addButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::installpage::add_icon));
sourceLayout->addWidget(m_refreshButton);
sourceLayout->addItem(sourceSpacer);
@@ -96,7 +88,7 @@ void BtSourceArea::initView() {
// There are no views for the stack yet, see initSources
m_view = new QTreeWidget(this);
m_view->setHeaderLabels(QStringList() << tr("Work") << tr("Description"));
- m_view->setColumnWidth(0, CToolClass::mWidth(m_view, 20));
+ m_view->setColumnWidth(0, util::tool::mWidth(m_view, 20));
mainLayout->addWidget(m_view);
connect(m_view, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), SLOT(slotItemDoubleClicked(QTreeWidgetItem*, int)));
@@ -104,6 +96,11 @@ void BtSourceArea::initView() {
connect(this, SIGNAL(signalCreateTree()), SLOT(slotCreateTree()), Qt::QueuedConnection);
}
+void BtSourceArea::prepareRemove() {
+ // don't create tree anymore, this will be removed
+ disconnect(this, SIGNAL(signalCreateTree()), this, SLOT(slotCreateTree()));
+}
+
QSize BtSourceArea::sizeHint() const {
return QSize(100, m_refreshButton->height() + (m_view->header()->height() * 5));
}
@@ -116,7 +113,7 @@ void BtSourceArea::initTreeFirstTime() {
}
void BtSourceArea::createModuleTree() {
- qDebug("BtSourceArea::createModuleTree start");
+ qDebug() << "BtSourceArea::createModuleTree start";
// Start creating tree with a queued connection.
// This makes showing the dialog possible even before the tree is initialized.
emit signalCreateTree();
@@ -133,8 +130,7 @@ void BtSourceArea::slotCreateTree() {
disconnect(m_view, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(slotSelectionChanged(QTreeWidgetItem*, int)) );
m_view->clear();
- // TODO: if the tree already exists for this source,
- // maybe the selections should be preserved
+ /// \todo if the tree already exists for this source, maybe the selections should be preserved
m_checkedModules.clear();
sword::InstallSource is = instbackend::source(m_sourceName);
@@ -181,11 +177,13 @@ void BtSourceArea::addToTree(BTModuleTreeItem* item, QTreeWidgetItem* widgetItem
QString installedV;
if (!installedModule) {
- // possible TODO: save the module list of a source before refreshing,
- // compare after refreshing, mark the newly added modules
- //if not newly added:
- //state: installable (no indicator)
- //else: status: newly added, color yellow
+ /**
+ \todo maybe? save the module list of a source before refreshing,
+ compare after refreshing, mark the newly added modules if
+ not newly added:
+ state: installable (no indicator)
+ else: status: newly added, color yellow
+ */
} else { // the module is already installed
QBrush bg(QColor(255, 153, 153)); /// \bug Possible color conflict
widgetItem->setBackground(0, bg);
@@ -206,7 +204,7 @@ void BtSourceArea::addToTree(BTModuleTreeItem* item, QTreeWidgetItem* widgetItem
QString descr(mInfo->config(CSwordModuleInfo::Description));
- QString toolTipText = CToolClass::remoteModuleToolTip(mInfo, installedV);
+ QString toolTipText = util::tool::remoteModuleToolTip(mInfo, installedV);
widgetItem->setText(1, descr);
widgetItem->setToolTip(0, toolTipText);
@@ -226,7 +224,7 @@ QMap<QString, bool>* BtSourceArea::selectedModules() {
// when a module is checked/unchecked
void BtSourceArea::slotSelectionChanged(QTreeWidgetItem* item, int column) {
- //qDebug("BtSourceArea::slotSelectionChanged");
+ //qDebug() << "BtSourceArea::slotSelectionChanged";
// modify the internal list of selected (actually checked) modules
// if() leaves groups away
if (!item->childCount() && column == 0) {
@@ -269,7 +267,7 @@ bool BtSourceArea::InstalledFilter::filter(CSwordModuleInfo* mInfo) {
//qDebug() << "BtSourceArea::InstalledFilter::filter, module " << mInfo->name();
CSwordModuleInfo* const installedModule = CPointers::backend()->findModuleByName(mInfo->name());
if (installedModule) {
- //qDebug("already installed, check if it's an update...");
+ //qDebug() << "already installed, check if it's an update...";
const sword::SWVersion installedVersion(installedModule->config(CSwordModuleInfo::ModuleVersion).toLatin1());
const sword::SWVersion newVersion(mInfo->config(CSwordModuleInfo::ModuleVersion).toLatin1());
if (installedVersion >= newVersion) {
diff --git a/src/frontend/bookshelfmanager/installpage/btsourcearea.h b/src/frontend/bookshelfmanager/installpage/btsourcearea.h
index e39efef..ece20ed 100644
--- a/src/frontend/bookshelfmanager/installpage/btsourcearea.h
+++ b/src/frontend/bookshelfmanager/installpage/btsourcearea.h
@@ -10,15 +10,16 @@
#ifndef BTSOURCEAREA_H
#define BTSOURCEAREA_H
-#include "backend/btmoduletreeitem.h"
+#include <QWidget>
#include <boost/scoped_ptr.hpp>
+#include <QApplication>
+#include <QMap>
+#include "backend/btmoduletreeitem.h"
+// Sword includes:
#include <installmgr.h>
-#include <QWidget>
-#include <QMap>
-#include <QApplication>
class QTreeWidget;
class QTreeWidgetItem;
@@ -54,6 +55,7 @@ class BtSourceArea : public QWidget {
~BtSourceArea();
void initView();
+ void prepareRemove();
/** Reimplemented from QWidget. */
virtual QSize sizeHint() const;
void initTreeFirstTime();
@@ -89,8 +91,6 @@ class BtSourceArea : public QWidget {
QPushButton* m_editButton;
QPushButton* m_deleteButton;
QPushButton* m_addButton;
-
-
};
#endif
diff --git a/src/frontend/bookshelfmanager/installpage/btsourcewidget.cpp b/src/frontend/bookshelfmanager/installpage/btsourcewidget.cpp
index f18935a..8c43837 100644
--- a/src/frontend/bookshelfmanager/installpage/btsourcewidget.cpp
+++ b/src/frontend/bookshelfmanager/installpage/btsourcewidget.cpp
@@ -7,44 +7,42 @@
*
**********/
-#include "btsourcewidget.h"
+#include "frontend/bookshelfmanager/installpage/btsourcewidget.h"
-#include "btinstallpage.h"
-#include "btsourcearea.h"
-#include "btinstallprogressdialog.h"
-#include "btinstallmodulechooserdialog.h"
-
-#include "frontend/bookshelfmanager/btmodulemanagerdialog.h"
-#include "frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h"
-#include "frontend/bookshelfmanager/btinstallmgr.h"
-#include "frontend/bookshelfmanager/instbackend.h"
-
-
-#include <QString>
-#include <QWidget>
-#include <QTabWidget>
-#include <QMessageBox>
-#include <QProgressDialog>
-#include <QPushButton>
#include <QApplication>
#include <QFileInfo>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QProgressDialog>
+#include <QPushButton>
+#include <QString>
#include <QTabBar>
+#include <QTabWidget>
#include <QTreeWidget>
#include <QTreeWidgetItem>
-#include <QHBoxLayout>
-#include <QLabel>
+#include <QWidget>
+#include "frontend/bookshelfmanager/btinstallmgr.h"
+#include "frontend/bookshelfmanager/btmodulemanagerdialog.h"
+#include "frontend/bookshelfmanager/cswordsetupinstallsourcesdialog.h"
+#include "frontend/bookshelfmanager/installpage/btinstallmodulechooserdialog.h"
+#include "frontend/bookshelfmanager/installpage/btinstallpage.h"
+#include "frontend/bookshelfmanager/installpage/btinstallprogressdialog.h"
+#include "frontend/bookshelfmanager/installpage/btsourcearea.h"
+#include "frontend/bookshelfmanager/instbackend.h"
+#include "util/dialogutil.h"
-// ****************************************************************
-// ******** Tab Widget that holds source widgets ******************
-// ****************************************************************
+/**
+* Tab Widget that holds source widgets
+*/
BtSourceWidget::BtSourceWidget(BtInstallPage* parent)
: QTabWidget(parent),
m_page(parent) {
- qDebug("BtSourceWidget::BtSourceWidget start");
+ qDebug() << "BtSourceWidget::BtSourceWidget start";
initSources();
-
- // TODO: choose the page from config
+ // send queued event because "Delete" is initiated from tab which should be deleted
+ connect(this, SIGNAL(sigInitSources()), SLOT(initSources()), Qt::QueuedConnection);
+ /// \todo choose the page from config
}
@@ -58,56 +56,57 @@ QString BtSourceWidget::currentSourceName() {
}
void BtSourceWidget::initSourceConnections() {
- qDebug("void BtSourceWidget::initSourceConnections() start");
+ qDebug() << "void BtSourceWidget::initSourceConnections() start";
if (area()) {
connect(area()->m_refreshButton, SIGNAL(clicked()), SLOT(slotRefresh()));
//connect(area()->m_editButton, SIGNAL(clicked()), SLOT(slotEdit()));
- connect(area()->m_deleteButton, SIGNAL(clicked()), SLOT(slotDelete()));
+ connect(area()->m_deleteButton, SIGNAL(clicked()), SLOT(slotDelete()), Qt::QueuedConnection);
connect(area()->m_addButton, SIGNAL(clicked()), SLOT(slotAdd()));
connect(area(), SIGNAL(signalSelectionChanged(QString, int)), SLOT(slotModuleSelectionChanged(QString, int)) );
}
- qDebug("void BtSourceWidget::initSourceConnections() end");
+ qDebug() << "void BtSourceWidget::initSourceConnections() end";
}
void BtSourceWidget::slotEdit() {
- qDebug("BtSourceWidget::slotEdit");
- // open the source editor dialog
+ qDebug() << "BtSourceWidget::slotEdit";
+ /// \todo open the source editor dialog
// if the source was changed, init the sources
}
void BtSourceWidget::slotDelete() {
- qDebug("void BtSourceWidget::slotDelete() start");
+ qDebug() << "void BtSourceWidget::slotDelete() start";
// ask for confirmation
- int ret = QMessageBox::warning(this, tr("Delete Source?"),
- tr("Do you really want to delete this source?"),
- QMessageBox::Yes | QMessageBox::No);
+ int ret = util::showWarning(this, tr("Delete Source?"),
+ tr("Do you really want to delete this source?"),
+ QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
instbackend::deleteSource(currentSourceName());
-
- // remove the UI elements
- m_sourceNameList.removeAt(currentIndex());
- QWidget* w = currentWidget();
- removeTab(currentIndex());
- delete w;
+ initSources();
}
}
void BtSourceWidget::slotAdd() {
- qDebug("void BtSourceWidget::slotAdd() start");
- qDebug("open the old dialog, TODO: write new one");
- sword::InstallSource newSource = CSwordSetupInstallSourcesDialog::getSource();
- if ( !((QString)newSource.type.c_str()).isEmpty() ) { // we have a valid source to add
- instbackend::addSource(newSource);
- addSource(QString(newSource.caption.c_str()));
+
+ boost::scoped_ptr<CSwordSetupInstallSourcesDialog> dlg( new CSwordSetupInstallSourcesDialog() );
+ sword::InstallSource newSource(""); //empty, invalid Source
+
+ if (dlg->exec() == QDialog::Accepted) {
+ if (!dlg->wasRemoteListAdded()) {
+ newSource = dlg->getSource();
+ if ( !((QString)newSource.type.c_str()).isEmpty() ) { // we have a valid source to add
+ instbackend::addSource(newSource);
+ }
+ }
+ initSources();
}
}
void BtSourceWidget::slotRefresh() {
- qDebug("void BtSourceWidget::slotRefresh() start");
+ qDebug() << "void BtSourceWidget::slotRefresh() start";
// (re)build the module cache for the source
QString sourceName = currentSourceName();
@@ -117,18 +116,18 @@ void BtSourceWidget::slotRefresh() {
m_progressDialog->setWindowTitle(tr("Refreshing Source"));
m_progressDialog->setMinimumDuration(0);
- // TODO: get rid of the backend code, BtInstallMgr and progressdialog could handle this
+ /// \todo get rid of the backend code, BtInstallMgr and progressdialog could handle this
//write method BtInstallMgr::slotRefreshCanceled()
connect(m_progressDialog, SIGNAL(canceled()), SLOT(slotRefreshCanceled()));
// BACKEND CODE **********************************************************
// would this be possible: instbackend::refreshSource( arguments );
- qDebug("void BtSourceWidget::slotRefresh 1");
+ qDebug() << "void BtSourceWidget::slotRefresh 1";
BtInstallMgr iMgr;
m_currentInstallMgr = &iMgr; //for the progress dialog
sword::InstallSource is = instbackend::source(sourceName);
bool success = false;
- qDebug("void BtSourceWidget::slotRefresh 2");
+ qDebug() << "void BtSourceWidget::slotRefresh 2";
// connect this directly to the dialog setValue(int) if possible
connect(&iMgr, SIGNAL(percentCompleted(const int, const int)), SLOT(slotRefreshCompleted(const int, const int)));
@@ -139,11 +138,7 @@ void BtSourceWidget::slotRefresh() {
m_progressDialog->setLabelText(tr("Connecting..."));
m_progressDialog->setValue(0);
qApp->processEvents();
- //qApp->flush();
- //qApp->processEvents();
- //m_progressDialog->repaint();
- //qApp->processEvents();
- qDebug("void BtSourceWidget::slotRefresh 3");
+ qDebug() << "void BtSourceWidget::slotRefresh 3";
bool successful = iMgr.refreshRemoteSource( &is );
if (!successful ) { //make sure the sources were updated sucessfully
success = true;
@@ -164,14 +159,14 @@ void BtSourceWidget::slotRefresh() {
// rebuild the view tree and refresh the view
if (success) {
- qDebug("void BtSourceWidget::slotRefresh 4");
+ qDebug() << "void BtSourceWidget::slotRefresh 4";
area()->createModuleTree();
}
}
-//TODO: try to move this to BtInstallMgr
+/// \todo try to move this to BtInstallMgr
void BtSourceWidget::slotRefreshCanceled() {
- qDebug("BtSourceWidget::slotRefreshCanceled");
+ qDebug() << "BtSourceWidget::slotRefreshCanceled";
Q_ASSERT(m_currentInstallMgr);
if (m_currentInstallMgr) {
m_currentInstallMgr->terminate();
@@ -179,9 +174,9 @@ void BtSourceWidget::slotRefreshCanceled() {
qApp->processEvents();
}
-//TODO: try to move this to progress dialog
+/// \todo try to move this to progress dialog
void BtSourceWidget::slotRefreshCompleted(const int, const int current) {
- qDebug("BtSourceWidget::slotRefreshCompleted");
+ qDebug() << "BtSourceWidget::slotRefreshCompleted";
if (m_progressDialog) {
if (m_progressDialog->labelText() != tr("Refreshing...")) {
m_progressDialog->setLabelText(tr("Refreshing..."));
@@ -193,18 +188,32 @@ void BtSourceWidget::slotRefreshCompleted(const int, const int current) {
// init the tabbar, setup the module tree for the current source
void BtSourceWidget::initSources() {
- qDebug("void BtSourceWidget::initSources() start");
+ qDebug() << "void BtSourceWidget::initSources() start";
+
+ //first clear all sources
+ //int i = count();
+ for (int i = count()-1; i >= 0; i--) {
+ BtSourceArea* a = dynamic_cast<BtSourceArea*>(widget(i));
+ a->prepareRemove();
+ }
+ for (int i = count()-1; i >= 0; i--) {
+ qDebug() << "remove tab"<<tabText(i);
+ QWidget* w = widget(i);
+ removeTab(i);
+ delete w;
+ qDebug() << "deleted";
+ }
+ m_sourceNameList.clear();
// ***** Use the backend to get the list of sources *****
instbackend::initPassiveFtpMode();
QStringList sourceList = instbackend::sourceList();
-
+ qDebug() << "got the source list from backend:" << sourceList;
// Add a default entry, the Crosswire main repository
- // TODO: this is easy for the user, but should the edit dialog
- // open automatically?
if (!sourceList.count()) {
+ /// \todo Open a dialog which asks whether to get list from server and add sources
sword::InstallSource is("FTP"); //default return value
- is.caption = "Crosswire";
+ is.caption = "CrossWire Bible Society";
is.source = "ftp.crosswire.org";
is.directory = "/pub/sword/raw";
// passive ftp is not needed here, it's the default
@@ -214,7 +223,7 @@ void BtSourceWidget::initSources() {
sourceList = instbackend::sourceList();
//Q_ASSERT( sourceList.count() > 0 );
}
- qDebug("void BtSourceWidget::initSources 1");
+ qDebug() << "void BtSourceWidget::initSources 1";
// Add the sources to the widget
foreach (QString sourceName, sourceList) {
addSource(sourceName);
@@ -222,8 +231,8 @@ void BtSourceWidget::initSources() {
// connect this after the tabs have been created,
// otherwise the signal is caught too early.
QObject::connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotTabSelected(int)));
- qDebug("void BtSourceWidget::initSources end");
- // TODO: select the current source from the config
+ qDebug() << "void BtSourceWidget::initSources end";
+ /// \todo select the current source from the config
// It's important to choose something because the tree is not initialized until now
setCurrentIndex(0);
slotTabSelected(0); // setting the index wasn't enough if there were only 1 tab
@@ -237,7 +246,7 @@ void BtSourceWidget::initSources() {
}
void BtSourceWidget::addSource(const QString& sourceName) {
- qDebug("void BtSourceWidget::addSource(const QString& sourceName) start");
+ qDebug() << "void BtSourceWidget::addSource(const QString& sourceName) start, with name" << sourceName;
// The source has already been added to the backend.
QString type;
@@ -254,10 +263,10 @@ void BtSourceWidget::addSource(const QString& sourceName) {
QFileInfo fi( is.directory.c_str() );
path = is.directory.c_str();
if (!(fi.isDir() )) {
- path = path + QString(" ") + tr("Not a directory!"); //TODO: change this
+ path = path + QString(" ") + tr("Not a directory!"); /// \todo change this
}
if (!fi.isReadable()) {
- path = path + QString(" ") + tr("Not readable!"); //TODO: change this
+ path = path + QString(" ") + tr("Not readable!"); /// \todo change this
}
}
@@ -265,7 +274,7 @@ void BtSourceWidget::addSource(const QString& sourceName) {
BtSourceArea* area = new BtSourceArea(sourceName);
int tabNumber = this->addTab(area, sourceName);
- // TODO: add "remote/local", server, path etc.
+ /// \todo add "remote/local", server, path etc.
QString toolTip(QString("<p style='white-space:pre'>") + sourceName + QString("<br/><b>") + type + QString("</b> ") + server + path + QString("</p>"));
tabBar()->setTabToolTip(tabNumber, toolTip);
@@ -273,13 +282,13 @@ void BtSourceWidget::addSource(const QString& sourceName) {
setCurrentIndex(tabNumber);
m_sourceNameList.append(sourceName);
initSourceConnections();
- qDebug("BtSourceWidget::addSource end");
+ qDebug() << "BtSourceWidget::addSource end";
}
//
void BtSourceWidget::slotModuleSelectionChanged(QString sourceName, int selectedCount) {
- //TODO: editing sources should update the map also
- qDebug("BtSourceWidget::slotModuleSelectionChanged start");
+ /// \todo editing sources should update the map also
+ qDebug() << "BtSourceWidget::slotModuleSelectionChanged start";
int overallCount = 0;
m_selectedModulesCountMap.insert(sourceName, selectedCount);
@@ -302,7 +311,7 @@ void BtSourceWidget::slotTabSelected(int /*index*/) {
}
void BtSourceWidget::slotInstall() {
- qDebug("void BtInstallPage::slotInstall start");
+ qDebug() << "void BtInstallPage::slotInstall start";
// check that the destination path is writable, do nothing if not and user doesn't want to continue
QDir dir = QDir(dynamic_cast<BtInstallPage*>(parent())->selectedInstallPath());
@@ -317,7 +326,7 @@ void BtSourceWidget::slotInstall() {
canWrite = false;
}
if (!canWrite) {
- const int result = QMessageBox::warning(this, tr("Warning"), tr("The destination directory is not writable or does not exist. Installation will fail unless this has first been fixed."), QMessageBox::Ignore | QMessageBox::Cancel, QMessageBox::Cancel);
+ const int result = util::showWarning(this, tr("Warning"), tr("The destination directory is not writable or does not exist. Installation will fail unless this has first been fixed."), QMessageBox::Ignore | QMessageBox::Cancel, QMessageBox::Cancel);
if (result != QMessageBox::Ignore) {
return;
}
@@ -373,18 +382,18 @@ void BtSourceWidget::slotStopInstall(QTreeWidget* /*treeWidget*/) {
void BtSourceWidget::slotInstallAccepted(QList<CSwordModuleInfo*> /*modules*/, QTreeWidget* treeWidget) {
qDebug() << "BtSourceWidget::slotInstallAccepted";
- //TODO: first remove all modules which will be updated from the module list
+ /// \todo first remove all modules which will be updated from the module list
// but what modules? all with the same real name? (there may be _n modules...)
BtModuleManagerDialog* parentDialog = dynamic_cast<BtModuleManagerDialog*>(dynamic_cast<BtInstallPage*>(parent())->parentDialog());
BtInstallProgressDialog* dlg = new BtInstallProgressDialog(parentDialog, treeWidget, dynamic_cast<BtInstallPage*>(parent())->selectedInstallPath());
- if (!parentDialog) qDebug("error, wrong parent!");
+ if (!parentDialog) qDebug() << "error, wrong parent!";
m_page->setInstallEnabled(false);
// the progress dialog is now modal, it can be made modeless later.
dlg->exec();
- qDebug("BtSourceWidget::slotInstallAccepted end");
+ qDebug() << "BtSourceWidget::slotInstallAccepted end";
}
diff --git a/src/frontend/bookshelfmanager/installpage/btsourcewidget.h b/src/frontend/bookshelfmanager/installpage/btsourcewidget.h
index 46b7d0a..fbe8426 100644
--- a/src/frontend/bookshelfmanager/installpage/btsourcewidget.h
+++ b/src/frontend/bookshelfmanager/installpage/btsourcewidget.h
@@ -9,16 +9,16 @@
#ifndef BTSOURCEWIDGET_H
#define BTSOURCEWIDGET_H
-class CSwordModuleInfo;
-
#include <QTabWidget>
-#include <QString>
+
#include <QMap>
+#include <QString>
+
class BtInstallMgr;
class BtInstallPage;
class BtSourceArea;
-
+class CSwordModuleInfo;
class QProgressDialog;
class QTreeWidget;
@@ -46,13 +46,13 @@ class BtSourceWidget : public QTabWidget {
private:
void initSourceConnections();
- /** Add tabs/views for each source. */
- void initSources();
/** Add one source to tabs/stack. */
void addSource(const QString& sourceName);
private slots:
+ /** Add tabs/views for each source. */
+ void initSources();
void slotRefresh();
@@ -72,7 +72,8 @@ class BtSourceWidget : public QTabWidget {
void slotTabSelected(int index);
void slotInstallAccepted(QList<CSwordModuleInfo*> mi, QTreeWidget* treeWidget);
-
+ signals:
+ void sigInitSources();
private:
QStringList m_sourceNameList;
diff --git a/src/frontend/bookshelfmanager/instbackend.cpp b/src/frontend/bookshelfmanager/instbackend.cpp
index caf1e08..d671430 100644
--- a/src/frontend/bookshelfmanager/instbackend.cpp
+++ b/src/frontend/bookshelfmanager/instbackend.cpp
@@ -7,31 +7,26 @@
*
**********/
-#include "instbackend.h"
+#include "frontend/bookshelfmanager/instbackend.h"
-#include "frontend/bookshelfmanager/btinstallmgr.h"
-#include "backend/managers/cswordbackend.h"
-
-#include "util/cpointers.h"
-#include "util/directoryutil.h"
-
-//Qt includes
+#include <functional>
+#include <map>
+#include <QDebug>
+#include <QDir>
#include <QFile>
#include <QFileInfo>
-#include <QDir>
-#include <QMessageBox>
-
-#include <QDebug>
+#include <utility>
+#include "backend/managers/cswordbackend.h"
+#include "frontend/bookshelfmanager/btinstallmgr.h"
+#include "util/cpointers.h"
+#include "util/directory.h"
+#include "util/dialogutil.h"
-//Sword includes
+// Sword includes:
#include <filemgr.h>
#include <swconfig.h>
#include <swbuf.h>
-//Stl includes
-#include <functional>
-#include <map>
-#include <utility>
using namespace sword;
@@ -39,7 +34,7 @@ namespace instbackend {
/** Adds the source described by Source to the backend. */
bool addSource(sword::InstallSource& source) {
- qDebug("backend::addSource");
+ qDebug() << "backend::addSource";
SWConfig config(configFilename().toLatin1());
if (!strcmp(source.type, "FTP")) {
//make sure the path doesn't have a trailing slash, sword doesn't like it
@@ -58,7 +53,7 @@ bool addSource(sword::InstallSource& source) {
/** Returns the Source struct. */
sword::InstallSource source(QString name) {
- qDebug("backend::source");
+ qDebug() << "backend::source";
BtInstallMgr mgr;
InstallSourceMap::iterator source = mgr.sources.find(name.toLatin1().data());
if (source != mgr.sources.end()) {
@@ -93,7 +88,7 @@ sword::InstallSource source(QString name) {
/** Deletes the source. */
bool deleteSource(QString name) {
- qDebug("backend::deleteSource");
+ qDebug() << "backend::deleteSource";
sword::InstallSource is = source(name );
SWConfig config(configFilename().toLatin1());
@@ -105,28 +100,48 @@ bool deleteSource(QString name) {
: config["Sources"].equal_range("DIRSource");
ConfigEntMap::iterator it = range.first;
+ SWBuf sourceConfigEntry = is.getConfEnt();
+ bool notFound = true;
while (it != range.second) {
- if (it->second == is.getConfEnt()) {
- // qWarning("found the source!");
+ //SWORD lib gave us a "nice" surprise: getConfEnt() adds uid, so old sources added by BT are not recognized here
+ if (it->second == sourceConfigEntry) {
config["Sources"].erase(it);
+ notFound = false;
break;
}
++it;
}
+ if (notFound) {
+ qDebug() << "source was not found, try without uid";
+ //try again without uid
+ QString sce(sourceConfigEntry.c_str());
+ QStringList l = sce.split('|');
+ l.removeLast();
+ sce = l.join("|").append("|");
+ it = range.first;
+ while (it != range.second) {
+ qDebug() << it->second;
+ if (it->second == sce) {
+ config["Sources"].erase(it);
+ break;
+ }
+ ++it;
+ }
+ }
config.Save();
- return true; //TODO: dummy
+ return true; /// \todo dummy
}
/** Refreshes the remote source module list. */
bool refreshSource(QString /*name*/) {
// not possible until manager and progressdialog work together
- return true; //TODO: dummy
+ return true; /// \todo dummy
}
/** Returns the moduleinfo list for the source. Delete the pointer after using. IS THIS POSSIBLE?*/
QList<CSwordModuleInfo*> moduleList(QString /*name*/) {
- QList<CSwordModuleInfo*> list; //TODO: dummy
+ QList<CSwordModuleInfo*> list; /// \todo dummy
return list;
}
@@ -135,10 +150,8 @@ bool isRemote(const sword::InstallSource& source) {
}
const QString configPath() {
- const char *envhomedir = getenv("HOME");
- QString confPath = QString(envhomedir ? envhomedir : ".");
- confPath.append("/.sword/InstallMgr");
-
+ QString confPath = util::directory::getUserHomeSwordDir().absolutePath();
+ confPath.append("/InstallMgr");
return confPath;
}
@@ -147,16 +160,18 @@ const QString configFilename() {
}
QStringList targetList() {
- qDebug("backend::targetList");
+ qDebug() << "backend::targetList";
QStringList names = CPointers::backend()->swordDirList();
return names;
}
bool setTargetList( const QStringList& targets ) {
- qDebug("backend::setTargetList");
+ namespace DU = util::directory;
+
+ qDebug() << "backend::setTargetList";
//saves a new Sword config using the provided target list
//QString filename = KGlobal::dirs()->saveLocation("data", "bibletime/") + "sword.conf"; //default is to assume the real location isn't writable
- //QString filename = util::filesystem::DirectoryUtil::getUserBaseDir().canonicalPath().append("/.sword/sword.conf");
+ //QString filename = util::DirectoryUtil::getUserBaseDir().canonicalPath().append("/.sword/sword.conf");
//bool directAccess = false;
QString filename = swordConfigFilename();
QFileInfo i(filename);
@@ -177,15 +192,30 @@ bool setTargetList( const QStringList& targets ) {
else {
// There is no way to save to the file
qWarning() << "The Sword config file is not writable!";
- QMessageBox::warning(0, QObject::tr("Can't write file"), QObject::tr("The Sword config file can't be written!"));
+ util::showWarning(0, QObject::tr("Can't write file"), QObject::tr("The Sword config file can't be written!"));
return false;
}
+
+ filename = util::directory::convertDirSeparators(filename);
SWConfig conf(filename.toLocal8Bit());
conf.Sections.clear();
+
+#ifdef Q_WS_WIN
+ // On Windows, add the sword directory to the config file.
+ QString swordPath = DU::convertDirSeparators( DU::getApplicationSwordDir().absolutePath());
+ conf["Install"].insert(
+ std::make_pair( SWBuf("LocalePath"), swordPath.toLocal8Bit().data() )
+ );
+#endif
+
bool setDataPath = false;
for (QStringList::const_iterator it = targets.begin(); it != targets.end(); ++it) {
- QString t = *it;
- if (t.contains( util::filesystem::DirectoryUtil::getUserHomeDir().canonicalPath().append("/.sword") )) {
+ QString t = DU::convertDirSeparators(*it);
+#ifdef Q_WS_WIN
+ if (t.contains(DU::convertDirSeparators(DU::getUserHomeDir().canonicalPath().append("\\Sword")))) {
+#else
+ if (t.contains(DU::getUserHomeDir().canonicalPath().append("/.sword"))) {
+#endif
//we don't want $HOME/.sword in the config
continue;
}
@@ -202,7 +232,7 @@ bool setTargetList( const QStringList& targets ) {
}
QStringList sourceList() {
- qDebug("backend::sourceList");
+ qDebug() << "backend::sourceList";
BtInstallMgr mgr;
Q_ASSERT(mgr.installConf);
@@ -233,23 +263,37 @@ QStringList sourceList() {
void initPassiveFtpMode() {
- qDebug("backend::initPassiveFtpMode");
+ qDebug() << "backend::initPassiveFtpMode";
SWConfig config(configFilename().toLatin1());
config["General"]["PassiveFTP"] = "true";
config.Save();
}
const QString swordConfigFilename() {
- qDebug("backend::swordConfigFilename");
- qDebug() << util::filesystem::DirectoryUtil::getUserHomeDir().absolutePath().append("/.sword/sword.conf");
- return util::filesystem::DirectoryUtil::getUserHomeDir().absolutePath().append("/.sword/sword.conf");
+ namespace DU = util::directory;
+
+ qDebug() << "backend::swordConfigFilename";
+#ifdef Q_WS_WIN
+ qDebug() << DU::getUserHomeDir().absolutePath().append("/Sword/sword.conf");
+ return DU::getUserHomeDir().absolutePath().append("/Sword/sword.conf");
+// return DU::getApplicationDir().absolutePath().append("/sword.conf");
+#else
+ qDebug() << DU::getUserHomeDir().absolutePath().append("/.sword/sword.conf");
+ return DU::getUserHomeDir().absolutePath().append("/.sword/sword.conf");
+#endif
}
const QDir swordDir() {
- return QDir(util::filesystem::DirectoryUtil::getUserHomeDir().absolutePath().append("/.sword/"));
+ namespace DU = util::directory;
+
+#ifdef Q_WS_WIN
+ return QDir(DU::getUserHomeDir().absolutePath().append("/Sword/"));
+#else
+ return QDir(DU::getUserHomeDir().absolutePath().append("/.sword/"));
+#endif
}
CSwordBackend* backend( const sword::InstallSource& is) {
- qDebug("backend::backend");
+ qDebug() << "backend::backend";
CSwordBackend* ret = 0;
if (isRemote(is)) {
ret = new CSwordBackend( QString(is.localShadow.c_str()), false );
diff --git a/src/frontend/bookshelfmanager/instbackend.h b/src/frontend/bookshelfmanager/instbackend.h
index 4f60ed9..3a98e5a 100644
--- a/src/frontend/bookshelfmanager/instbackend.h
+++ b/src/frontend/bookshelfmanager/instbackend.h
@@ -10,16 +10,16 @@
#ifndef INSTBACKEND_H
#define INSTBACKEND_H
-#include "backend/managers/cswordbackend.h"
-
-class CSwordModuleInfo;
-
-#include <QString>
#include <QDir>
+#include <QString>
+#include "backend/managers/cswordbackend.h"
+// Sword includes:
#include <installmgr.h>
+class CSwordModuleInfo;
+
namespace instbackend {
/** Adds the source to the backend. */
@@ -55,7 +55,7 @@ const QString configPath();
const QString configFilename();
/** Sets the passive mode for as default.
-* TODO: see if we can en/disable this per source.
+* \todo see if we can en/disable this per source.
*/
void initPassiveFtpMode();
diff --git a/src/frontend/bookshelfmanager/removepage/btremovepage.cpp b/src/frontend/bookshelfmanager/removepage/btremovepage.cpp
index cd8f687..1cc6398 100644
--- a/src/frontend/bookshelfmanager/removepage/btremovepage.cpp
+++ b/src/frontend/bookshelfmanager/removepage/btremovepage.cpp
@@ -7,38 +7,35 @@
*
**********/
+#include "frontend/bookshelfmanager/removepage/btremovepage.h"
-#include "btremovepage.h"
-
-
+#include <QDebug>
+#include <QGridLayout>
+#include <QLabel>
+#include <QList>
+#include <QMultiMap>
+#include <QPushButton>
+#include <QString>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
#include "backend/btmoduletreeitem.h"
#include "backend/config/cbtconfig.h"
#include "backend/drivers/cswordmoduleinfo.h"
-
-#include "util/ctoolclass.h"
+#include "util/directory.h"
+#include "util/dialogutil.h"
#include "util/cpointers.h"
-#include "util/directoryutil.h"
#include "util/cresmgr.h"
+#include "util/tool.h"
+// Sword includes:
#include <swmgr.h>
#include <installmgr.h>
-#include <QString>
-#include <QGridLayout>
-#include <QLabel>
-#include <QPushButton>
-#include <QTreeWidget>
-#include <QTreeWidgetItem>
-#include <QMessageBox>
-#include <QList>
-#include <QMultiMap>
-
-#include <QDebug>
-
-
BtRemovePage::BtRemovePage()
: BtConfigPage() {
+ namespace DU = util::directory;
+
QGridLayout* layout = new QGridLayout(this);
layout->setMargin(5);
@@ -48,13 +45,13 @@ BtRemovePage::BtRemovePage()
m_view = new QTreeWidget(this);
m_view->setHeaderLabels(QStringList() << tr("Work") << tr("Install path"));
- m_view->setColumnWidth(0, CToolClass::mWidth(m_view, 20));
+ m_view->setColumnWidth(0, util::tool::mWidth(m_view, 20));
layout->addWidget( m_view, 2, 0, 1, 2);
m_removeButton = new QPushButton(tr("Remove..."), this);
m_removeButton->setToolTip(tr("Remove the selected works"));
- m_removeButton->setIcon( util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::removepage::remove_icon) );
+ m_removeButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::removepage::remove_icon));
m_removeButton->setEnabled(false);
layout->addWidget(m_removeButton, 3, 1, Qt::AlignRight);
@@ -89,7 +86,7 @@ void BtRemovePage::populateModuleList() {
// receive signal when user checks modules
connect(m_view, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(slotSelectionChanged(QTreeWidgetItem*, int)) );
- qDebug("BtSourceArea::createModuleTree end");
+ qDebug() << "BtSourceArea::createModuleTree end";
}
void BtRemovePage::addToTree(BTModuleTreeItem* item, QTreeWidgetItem* widgetItem) {
@@ -111,11 +108,11 @@ void BtRemovePage::addToTree(BTModuleTreeItem* item, QTreeWidgetItem* widgetItem
widgetItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
widgetItem->setCheckState(0, Qt::Unchecked);
- //TODO: add the relevant information in to item or tooltip
+ /// \todo add the relevant information in to item or tooltip
// (install path, is still available from some source)
QString descr(mInfo->config(CSwordModuleInfo::AbsoluteDataPath));
- QString toolTipText = CToolClass::moduleToolTip(mInfo);
+ QString toolTipText = util::tool::moduleToolTip(mInfo);
widgetItem->setText(1, descr);
widgetItem->setToolTip(0, toolTipText);
widgetItem->setToolTip(1, descr);
@@ -139,7 +136,7 @@ void BtRemovePage::slotRemoveModules() {
.append("\n\n")
.append(tr("Do you really want to remove them from your system?"));
- if ((QMessageBox::question(this, tr("Remove Works?"), message, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)) { //Yes was pressed.
+ if ((util::showQuestion(this, tr("Remove Works?"), message, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)) { //Yes was pressed.
// Update the module list before really removing. Remember deleting the pointers later.
QList<CSwordModuleInfo*> toBeDeleted = CPointers::backend()->takeModulesFromList(moduleNames);
@@ -181,12 +178,12 @@ void BtRemovePage::slotRemoveModules() {
void BtRemovePage::slotSelectionChanged(QTreeWidgetItem* item, int column) {
- //qDebug("BtRemovePage::slotSelectionChanged");
+ //qDebug() << "BtRemovePage::slotSelectionChanged";
// modify the internal list of checked modules
// if() leaves groups away
if (!item->childCount() && column == 0) {
CSwordModuleInfo* mInfo = 0;
- //qDebug("BtRemovePage::slotSelectionChanged");
+ //qDebug() << "BtRemovePage::slotSelectionChanged";
foreach (CSwordModuleInfo* module, CPointers::backend()->moduleList()) {
if (module->name() == item->text(0) && module->config(CSwordModuleInfo::AbsoluteDataPath) == item->text(1)) {
mInfo = module;
@@ -213,7 +210,7 @@ void BtRemovePage::slotSelectionChanged(QTreeWidgetItem* item, int column) {
}
void BtRemovePage::slotItemDoubleClicked(QTreeWidgetItem* /*item*/, int /*column*/) {
- // TODO: Open the About dialog.
+ // \todo Open the About dialog.
}
void BtRemovePage::slotSwordSetupChanged() {
diff --git a/src/frontend/bookshelfmanager/removepage/btremovepage.h b/src/frontend/bookshelfmanager/removepage/btremovepage.h
index 782fcc0..920b1ee 100644
--- a/src/frontend/bookshelfmanager/removepage/btremovepage.h
+++ b/src/frontend/bookshelfmanager/removepage/btremovepage.h
@@ -7,23 +7,20 @@
*
**********/
-
#ifndef BTREMOVEPAGE_H
#define BTREMOVEPAGE_H
#include "frontend/bookshelfmanager/btconfigdialog.h"
-#include "backend/btmoduletreeitem.h"
-#include <QString>
#include <QMultiMap>
+#include <QString>
+#include "backend/btmoduletreeitem.h"
-//class BTModuleTreeItem;
class QTreeWidget;
class QTreeWidgetItem;
class QPushButton;
-
class BtRemovePage : public BtConfigPage {
Q_OBJECT
diff --git a/src/frontend/btaboutmoduledialog.cpp b/src/frontend/btaboutmoduledialog.cpp
index e67d42b..9241b71 100644
--- a/src/frontend/btaboutmoduledialog.cpp
+++ b/src/frontend/btaboutmoduledialog.cpp
@@ -2,20 +2,20 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2008 by the BibleTime developers.
+* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-#include "btaboutmoduledialog.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "util/dialogutil.h"
-
-#include <QWidget>
#include <QDialog>
+#include <QDialogButtonBox>
#include <QTextEdit>
#include <QVBoxLayout>
-#include <QDialogButtonBox>
+#include <QWidget>
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/btaboutmoduledialog.h"
+#include "util/dialogutil.h"
+
BTAboutModuleDialog::BTAboutModuleDialog(QWidget* parent, CSwordModuleInfo* info)
: QDialog(parent) {
diff --git a/src/frontend/btaboutmoduledialog.h b/src/frontend/btaboutmoduledialog.h
index c5ee7ca..65c0696 100644
--- a/src/frontend/btaboutmoduledialog.h
+++ b/src/frontend/btaboutmoduledialog.h
@@ -12,13 +12,14 @@
#include <QDialog>
+
class CSwordModuleInfo;
class QWidget;
/**
- Dialog to show the information about a module.
+ Dialog to show the information about a module.
- @author The BibleTime team <info@bibletime.info>
+ @author The BibleTime team <info@bibletime.info>
*/
class BTAboutModuleDialog : public QDialog {
Q_OBJECT
diff --git a/src/frontend/btbookshelfdockwidget.cpp b/src/frontend/btbookshelfdockwidget.cpp
index 9c6877d..bedebcb 100644
--- a/src/frontend/btbookshelfdockwidget.cpp
+++ b/src/frontend/btbookshelfdockwidget.cpp
@@ -26,7 +26,7 @@
#include <QVBoxLayout>
#include "backend/bookshelfmodel/btbookshelfmodel.h"
#include "backend/bookshelfmodel/btbookshelftreemodel.h"
-#include "backend/bookshelfmodel/btcheckstatefilterproxymodel.h"
+#include "backend/bookshelfmodel/btmodulehiddenfilterproxymodel.h"
#include "backend/bookshelfmodel/btmodulenamefilterproxymodel.h"
#include "backend/config/cbtconfig.h"
#include "backend/drivers/cswordmoduleinfo.h"
@@ -35,7 +35,8 @@
#include "frontend/mainindex/btbookshelfview.h"
#include "util/cpointers.h"
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
+#include "util/directory.h"
+
BtBookshelfDockWidget::BtBookshelfDockWidget(QWidget *parent, Qt::WindowFlags f)
: QDockWidget(parent, f) {
@@ -49,16 +50,16 @@ BtBookshelfDockWidget::BtBookshelfDockWidget(QWidget *parent, Qt::WindowFlags f)
QVariant v(settings->value("grouping"));
if (v.canConvert<BtBookshelfTreeModel::Grouping>()) {
m_bookshelfTreeModel = new BtBookshelfTreeModel(v.value<BtBookshelfTreeModel::Grouping>(), this);
- } else {
+ }
+ else {
m_bookshelfTreeModel = new BtBookshelfTreeModel(this);
}
}
settings->endGroup();
- m_bookshelfTreeModel->setDefaultChecked(true);
+ m_bookshelfTreeModel->setDefaultChecked(BtBookshelfTreeModel::MODULE_HIDDEN);
m_bookshelfTreeModel->setSourceModel(CPointers::backend()->model());
- m_filterProxyModel = new BtCheckStateFilterProxyModel(this);
- m_filterProxyModel->setFilterRole(BtBookshelfTreeModel::CheckStateRole);
+ m_filterProxyModel = new BtModuleHiddenFilterProxyModel(this);
m_filterProxyModel->setSourceModel(m_bookshelfTreeModel);
m_nameFilterProxyModel = new BtModuleNameFilterProxyModel(this);
m_nameFilterProxyModel->setSourceModel(m_filterProxyModel);
@@ -71,6 +72,8 @@ BtBookshelfDockWidget::BtBookshelfDockWidget(QWidget *parent, Qt::WindowFlags f)
QVBoxLayout *layout(new QVBoxLayout);
layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *toolBar(new QHBoxLayout);
+ // Add a small margin between the edge of the window and the label (looks better)
+ toolBar->setContentsMargins(3,0,0,0);
m_nameFilterLabel = new QLabel(this);
toolBar->addWidget(m_nameFilterLabel);
@@ -107,6 +110,8 @@ BtBookshelfDockWidget::BtBookshelfDockWidget(QWidget *parent, Qt::WindowFlags f)
this, SLOT(showItemContextMenu(CSwordModuleInfo*, QPoint)));
connect(m_view, SIGNAL(moduleActivated(CSwordModuleInfo*)),
this, SIGNAL(moduleOpenTriggered(CSwordModuleInfo*)));
+ connect(m_bookshelfTreeModel, SIGNAL(moduleChecked(CSwordModuleInfo*,bool)),
+ this, SLOT(moduleChecked(CSwordModuleInfo*,bool)));
retranslateInterface();
}
@@ -130,7 +135,7 @@ bool BtBookshelfDockWidget::eventFilter(QObject *object, QEvent *event) {
}
void BtBookshelfDockWidget::initMenus() {
- typedef util::filesystem::DirectoryUtil DU;
+ namespace DU = util::directory;
namespace RM = CResMgr::mainIndex;
m_contextMenu = new QMenu(this);
@@ -235,6 +240,10 @@ void BtBookshelfDockWidget::retranslateInterface() {
m_itemAboutAction->setText(tr("&About..."));
}
+void BtBookshelfDockWidget::moduleChecked(CSwordModuleInfo *module, bool c) {
+ module->setHidden(!c);
+}
+
void BtBookshelfDockWidget::showContextMenu(QPoint pos) {
m_contextMenu->popup(pos);
}
diff --git a/src/frontend/btbookshelfdockwidget.h b/src/frontend/btbookshelfdockwidget.h
index 988bb3c..165ebae 100644
--- a/src/frontend/btbookshelfdockwidget.h
+++ b/src/frontend/btbookshelfdockwidget.h
@@ -15,10 +15,11 @@
#include <QDockWidget>
+
class CSwordModuleInfo;
class BtBookshelfView;
class BtBookshelfTreeModel;
-class BtCheckStateFilterProxyModel;
+class BtModuleHiddenFilterProxyModel;
class BtModuleNameFilterProxyModel;
class QAction;
class QActionGroup;
@@ -47,6 +48,7 @@ class BtBookshelfDockWidget: public QDockWidget {
void retranslateInterface();
protected slots:
+ void moduleChecked(CSwordModuleInfo *module, bool checked);
void showContextMenu(QPoint pos);
void groupingActionTriggered(QAction *action);
void showHideEnabled(bool enable);
@@ -55,9 +57,9 @@ class BtBookshelfDockWidget: public QDockWidget {
protected:
// Models:
- BtBookshelfTreeModel *m_bookshelfTreeModel;
- BtCheckStateFilterProxyModel *m_filterProxyModel;
- BtModuleNameFilterProxyModel *m_nameFilterProxyModel;
+ BtBookshelfTreeModel *m_bookshelfTreeModel;
+ BtModuleHiddenFilterProxyModel *m_filterProxyModel;
+ BtModuleNameFilterProxyModel *m_nameFilterProxyModel;
// Widgets:
QWidget *m_widget;
diff --git a/src/frontend/cdragdrop.cpp b/src/frontend/cdragdrop.cpp
index c217d51..d595162 100644
--- a/src/frontend/cdragdrop.cpp
+++ b/src/frontend/cdragdrop.cpp
@@ -7,13 +7,12 @@
*
**********/
+#include "frontend/cdragdrop.h"
-#include "cdragdrop.h"
-
-#include <QString>
#include <QByteArray>
-#include <QMimeData>
#include <QList>
+#include <QMimeData>
+#include <QString>
BTMimeData::BTMimeData() {}
diff --git a/src/frontend/cdragdrop.h b/src/frontend/cdragdrop.h
index 0380808..3c4481f 100644
--- a/src/frontend/cdragdrop.h
+++ b/src/frontend/cdragdrop.h
@@ -7,8 +7,6 @@
*
**********/
-
-
#ifndef CDRAGDROP_H
#define CDRAGDROP_H
@@ -26,7 +24,7 @@ class BookmarkItem {
/** Returns the key */
const QString& key() const {
return m_key;
- } ;
+ }
/** Returns the module name */
const QString& module() const {
return m_moduleName;
diff --git a/src/frontend/cdragdropmgr.cpp b/src/frontend/cdragdropmgr.cpp
deleted file mode 100644
index d2e2d00..0000000
--- a/src/frontend/cdragdropmgr.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-
-
-#include "cdragdropmgr.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/managers/cswordbackend.h"
-#include "backend/keys/cswordversekey.h"
-#include "util/cpointers.h"
-
-//Sword includes
-#include "versekey.h"
-
-//Qt includes
-#include <qevent.h>
-#include <qdom.h>
-//Added by qt3to4:
-#include <Q3CString>
-
-
-//This is the old old d'n'd system. Use cdragdrop instead.
-
-
-CDragDropMgr::BTDrag::BTDrag( const QString& xml, QWidget* dragSource, const char* name)
- : Q3TextDrag(xml, dragSource, name) {}
-;
-
-//static function to see whether we can decode tje given mime type
-bool CDragDropMgr::BTDrag::canDecode( const QMimeSource * mime ) {
- if ( mime->provides("BibleTime/DND") ) { //we can decode this type!
- return true;
- }
- return false; //not yet implemented
-};
-
-bool CDragDropMgr::BTDrag::provides( const char* type ) const {
- return (type == "BibleTime/DND"); //return only true if the type is BibleTime/DND
-};
-
-const char* CDragDropMgr::BTDrag::format( int i ) const {
- if ( i == 0) { //we support only one format!
- return "BibleTime/DND";
- };
- return 0;
-};
-
-bool CDragDropMgr::BTDrag::decode(const QMimeSource* e, QString& str) {
- if (canDecode(e)) {
- str = QString( e->encodedData( "BibleTime/DND" ) );
- return true;
- }
- return false;
-};
-
-bool CDragDropMgr::BTDrag::decode(const QMimeSource* e, QString& str, Q3CString& /*subtype*/) {
- return decode(e, str);
-};
-
-QByteArray CDragDropMgr::BTDrag::encodedData( const char* /*type*/ ) const {
- return Q3TextDrag::encodedData("text/plain"); //hack because QTextDrag only accepts text/plainand not our BibleTime/DND type
-};
-
-///////////////////////////// new class //////////////////////
-
-CDragDropMgr::Item::Item( const QString& text )
- : m_type(Text),
- m_bookmarkModuleName(QString::null),
- m_bookmarkKey(QString::null),
- m_bookmarkDescription(QString::null),
- m_text(text) {}
-
-CDragDropMgr::Item::Item( const QString& moduleName, const QString& key, const QString& description )
- : m_type(Bookmark),
- m_bookmarkModuleName(moduleName),
- m_bookmarkKey(key),
- m_bookmarkDescription(description),
- m_text(QString::null) {
- //we have to make sure the key is saved in it's english representation, so we convert it
- if (CSwordModuleInfo* mod = CPointers::backend()->findModuleByName( moduleName )) {
- if (mod->type() == CSwordModuleInfo::Bible || mod->type() == CSwordModuleInfo::Commentary) {
- CSwordVerseKey vk(0);
- vk.key( key );
- vk.setLocale("en");
-
- m_bookmarkKey = vk.key();
- // qWarning("english key of %s is %s", key.latin1(), m_bookmarkKey.latin1());
- }
- }
-}
-
-CDragDropMgr::Item::~Item() {}
-
-const CDragDropMgr::Item::Type& CDragDropMgr::Item::type() const {
- //returns the type of drag & drop action this item represents
- return m_type;
-}
-
-/** Returns the text which is used by this DragDrop Item, only valid if type() == Text */
-const QString& CDragDropMgr::Item::text() const {
- // Q_ASSERT(!m_text.isEmpty());
- return m_text;
-}
-
-/** Returns the key, ony valid if type() == Bookmark */
-const QString& CDragDropMgr::Item::bookmarkKey() const {
- // Q_ASSERT(!m_bookmarkKey.isEmpty());
- return m_bookmarkKey;
-}
-
-/** Returns the bookmark module, ony valid if type() == Bookmark */
-const QString& CDragDropMgr::Item::bookmarkModule() const {
- // Q_ASSERT(!m_bookmarkModuleName.isEmpty());
- return m_bookmarkModuleName;
-}
-
-/** Returns the bookmark description, ony valid if type() == Bookmark */
-const QString& CDragDropMgr::Item::bookmarkDescription() const {
- // Q_ASSERT(!m_bookmarkDescription.isEmpty());
- return m_bookmarkDescription;
-}
-
-////////////////////////////////// NEW CLASS //////////////////////////
-
-CDragDropMgr::CDragDropMgr() {}
-
-CDragDropMgr::~CDragDropMgr() {}
-
-const bool CDragDropMgr::canDecode( const QMimeSource* const mime ) {
- if (CDragDropMgr::BTDrag::canDecode(mime)) {
- return true;
- }
- else if ( Q3TextDrag::canDecode(mime) ) {
- qWarning("QTextDrag can decode this mime!");
- return true;
- };
- return false;
-};
-
-Q3DragObject* const CDragDropMgr::dragObject( CDragDropMgr::ItemList& items, QWidget* dragSource ) {
- if ( items.count() ) {
- //process the items and set the data to the dragobject we return later
- QDomDocument doc("DOC");
- doc.appendChild( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
- QDomElement content = doc.createElement("BibleTimeDND");
- content.setAttribute("syntaxVersion", "1.0");
- doc.appendChild(content);
-
- CDragDropMgr::ItemList::iterator it;
- for ( it = items.begin(); it != items.end(); ++it ) {
- Item item = (*it);
- if (item.type() == Item::Bookmark) { //a bookmark was dragged
- //append the XML stuff for a bookmark
- QDomElement bookmark = doc.createElement("BOOKMARK");
- bookmark.setAttribute("key", item.bookmarkKey());
- bookmark.setAttribute("description", item.bookmarkDescription());
- bookmark.setAttribute("moduleName", item.bookmarkModule());
-
- content.appendChild(bookmark);
- }
- else if (item.type() == Item::Text) { //plain text was dragged
- //append the XML stuff for plain text
- QDomElement plainText = doc.createElement("TEXT");
- plainText.setAttribute("text", item.text());
-
- content.appendChild(plainText);
- }
- }
-
- BTDrag* dragObject = new BTDrag( doc.toString(), dragSource );
- // qWarning("DND data created: %s", (const char*)doc.toString().utf8());
- return dragObject;
- };
- return 0;
-};
-
-CDragDropMgr::ItemList CDragDropMgr::decode( const QMimeSource* const src) {
- //if the drag was started by another widget which doesn't use CDragDropMgr (a drag created by QTextDrag)
- if (canDecode(src) && Q3TextDrag::canDecode(src)) { //if we can decode but it's a QTextDrag and not a BTDrag object
- QString text;
- Q3TextDrag::decode(src, text);
- // qWarning(text.latin1());
-
- CDragDropMgr::ItemList dndItems;
- dndItems.append( Item(text) );
- return dndItems;
- }
- else if (!canDecode(src)) { //if we can't decode it
- return CDragDropMgr::ItemList();
- };
-
- QString xmlData;
- BTDrag::decode(src, xmlData);
-
- if (xmlData.isEmpty()) { //something went wrong!
- // qWarning("CDragDropMgr::decode: empty xml data!");
- return CDragDropMgr::ItemList();
- }
- // else {
- // qWarning("Drag&Drop data is: %s", xmlData.latin1());
- // }
-
- //we can handle the dropEvent and have xml data to work on!
- ItemList dndItems;
-
- QDomDocument doc;
- doc.setContent( xmlData );
-
- QDomElement document = doc.documentElement();
- if ( document.tagName() != "BibleTimeDND" ) { //BibleTime was used in syntax version 1.0
- qWarning("DragDropMgr::decode: Missing BibleTimeDND doc");
- return CDragDropMgr::ItemList();
- }
- // see if there's a section with the name MAINWINDOW
- QDomElement elem = document.firstChild().toElement();
- while (!elem.isNull()) {
- if (elem.tagName() == "BOOKMARK") { //we found a bookmark!
- // qWarning("found a bookmark!");
- const QString key = elem.hasAttribute("key") ? elem.attribute("key") : QString::null;
- const QString moduleName = elem.hasAttribute("moduleName") ? elem.attribute("moduleName") : QString::null;
- const QString description = elem.hasAttribute("description") ? elem.attribute("description") : QString::null;
-
- dndItems.append( CDragDropMgr::Item(moduleName, key, description) );
- }
- else if (elem.tagName() == "TEXT") { //we found a plain text passage!
- const QString text = elem.hasAttribute("text") ? elem.attribute("text") : QString::null;
- dndItems.append( CDragDropMgr::Item(text) );
- };
- elem = elem.nextSibling().toElement();
- };
-
- return dndItems;
-};
-
-/** Returns which type the given drop event has, if it's a mixed one (both bookmarks and plain text), which shouldn't happen, it return Item::Unknown. */
-CDragDropMgr::Item::Type CDragDropMgr::dndType( const QMimeSource* e ) {
- ItemList dndItems = decode(e);
- if (dndItems.isEmpty()) {//wrong dropEvent or something strange
- return Item::Unknown;
- };
-
- //check whether all items have the ssame type, if they do return the type
- //as soon as two items have different types return Item::Unknown
- ItemList::Iterator it;
- Item::Type type = Item::Unknown;
- for ( it = dndItems.begin(); it != dndItems.end(); ++it ) {
- if ( type == Item::Unknown) { //if Unknown is set this is the first loop, don't return Unknown
- type = (*it).type();
- }
- else if (type != (*it).type() ) {//items have different type, return Item::Unknown
- return Item::Unknown;
- };
- };
- return type;
-}
diff --git a/src/frontend/cdragdropmgr.h b/src/frontend/cdragdropmgr.h
deleted file mode 100644
index c57514d..0000000
--- a/src/frontend/cdragdropmgr.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-
-
-#ifndef CDRAGDROPMGR_H
-#define CDRAGDROPMGR_H
-
-//Qt includes
-#include <QString>
-#include <q3cstring.h>
-#include <q3dragobject.h>
-#include <q3valuelist.h>
-//Added by qt3to4:
-#include <QDropEvent>
-
-//forward declarations
-class QDropEvent;
-class QWidget;
-
-/** This class is the drag'n' drop manager for BibleTime.
- *
- * This d'n'd system is replaced with the new classes in cdragdrop.h/cpp. (cdragdropmgr will be deleted later.)
- *
- * The dnd is managed by XML code, which defines the type of the drag/drop, the items and the action (moe, copy etc.).
- * It's possible to create the XML code by passing a list of keys etc.
- *
- * Functions:
- * - dnd_type(), returns either CDragDropMgr::Action_Drag or CDragDropMgr::Action_Drop
- * - dnd_action(), returns either CDragDropMgr::Move or CDragDropMgr::Copy
- * - dnd_acceptDrop(), returns true or false. True if the drop could be handled by the CDragDropMgr class, otherwise false
- *
- *
- * The functions which create the XML stuff can't be reimplemented, too. Otherwise we could not guarantee for good XML code
- * which works everywhere.
- *
- * @author The BibleTime team
- */
-class CDragDropMgr {
- public:
- //The class which represents one single drag&drop entry (e.g. a bookmark or a portion of text)
- class Item {
- public:
- /**
- * The possible types of Drag&Drop actions.
- */
- enum Type {
- Bookmark = 0, /* A bookmark: Has a key, a module and a description*/
- Text, /* Simple text, e.g. can be dropped on a module to start a search in this module using the dropped text */
- Unknown /* For situatiosn like CDragDropMgr::dndType */
- };
- /**
- * This function returns the type of drag this item has
- */
- const CDragDropMgr::Item::Type& type() const;
- /**
- * Returns the key, ony valid if type() == Bookmark
- */
- const QString& bookmarkKey() const;
- /**
- * Returns the module name, ony valid if type() == Bookmark
- */
- const QString& bookmarkModule() const;
- /**
- * Returns the bookmark description, ony valid if type() == Bookmark
- */
- const QString& bookmarkDescription() const;
- /**
- * Returns the text which is used by this DragDrop Item, only valid if type() == Text
- */
- const QString& text() const;
-
- // protected:
- friend class CDragDropMgr;
- /*
- * We use protected constructor and destructor because creation of objects
- * of this class sould only be possible for CDragDropMgr
- */
-
- /** Constructor for a text item
- * This constructor automatically sets the type member to Text
- * This is also the default constructor
- */
- Item(const QString& text = QString::null );
- /** Constructor for a Bookmark item
- * This constructor automatically sets the type member to Bookmark
- */
- Item(const QString& moduleName, const QString& key, const QString& description);
- virtual ~Item();
-
- private:
- Type m_type; //the member to save the type of the action
- QString m_bookmarkModuleName; //the modules which is used by this item, only valid for type() == Bookmark
- QString m_bookmarkKey; //the key of a bookmark, only valid if type() == Bookmark
- QString m_bookmarkDescription; //the description of a bookmark, only valid if type() == Bookmark
- QString m_text; //the text of this item, only valid if type() == Text
- }
- ; //end of class CDragDropMgr::Item
-
- //the item list we're using
- typedef Q3ValueList<Item> ItemList;
-
- /** Return whether the drop should be accepted
- * This functions tests whether the drop should be accepted or not. It returns true if the drop object
- * is supported by the CDragDropMgr and if it cotains valid data. Oterwise this function returns false.
- */
- static const bool canDecode( const QMimeSource* const mime );
- /**
- * This function returns the drag object with the data which represents the items given as parameter
- * If the list is invalid or empty we return NULL.
- */
- static Q3DragObject* const dragObject( CDragDropMgr::ItemList& items, QWidget* dragSource );
-
- /**
- * Decodes the XML stuff we passed to the dragObject at creation time.
- * Returns a list of CDragDropMgr::Item objects.
- * If it's a wrong dropEvent we return an empty ist
- */
- static CDragDropMgr::ItemList decode( const QMimeSource* const src );
- /**
- * Returns which type the given drop event has, if it's a mixed one (both bookmarks and plain text),
- * which shouldn't happen, it return Item::Unknown.
- * It also returns Unknown if the drop event is not supported.
- */
- static CDragDropMgr::Item::Type dndType( const QMimeSource* e );
-
- protected:
- //The class which represents our XML drag object stuff
- class BTDrag : public Q3TextDrag {
- public:
- BTDrag( const QString& xml, QWidget* dragSource = 0, const char* name = 0);
- //reimplemented static publoc function to provide functionality for BibleTime XML drags
- static bool canDecode( const QMimeSource * e );
- virtual bool provides( const char* type ) const;
- virtual const char* format( int i = 0 ) const;
-
- virtual QByteArray encodedData( const char* type ) const;
-
- protected:
- friend class CDragDropMgr;
- //made protected because the BibleTime classes may not manage the data of BTDrag
- // virtual void setText(const QString& text);
-
- //made protected because the BibleTime classes should not manage the DRag&Drop stuff themself
- static bool decode(const QMimeSource* e, QString& str);
- static bool decode(const QMimeSource* e, QString& str, Q3CString& subtype);
- };
-
- //protected constructor and destructor because we do not allow inheritance, functionality is provided by static functions
- CDragDropMgr();
- virtual ~CDragDropMgr();
-};
-
-#endif
diff --git a/src/frontend/cexportmanager.cpp b/src/frontend/cexportmanager.cpp
index f1ceed6..008963a 100644
--- a/src/frontend/cexportmanager.cpp
+++ b/src/frontend/cexportmanager.cpp
@@ -7,39 +7,31 @@
*
**********/
+#include "frontend/cexportmanager.h"
-
-#include "cexportmanager.h"
-
+#include <boost/scoped_ptr.hpp>
+#include <QApplication>
+#include <QClipboard>
+#include <QFileDialog>
+#include <QList>
+#include <QProgressDialog>
+#include <QTextStream>
+#include "backend/drivers/cswordmoduleinfo.h"
#include "backend/keys/cswordkey.h"
#include "backend/keys/cswordversekey.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/managers/creferencemanager.h"
+#include "backend/managers/referencemanager.h"
#include "backend/managers/cdisplaytemplatemgr.h"
#include "backend/rendering/centrydisplay.h"
#include "backend/rendering/chtmlexportrendering.h"
#include "backend/rendering/cplaintextexportrendering.h"
-
#include "frontend/cprinter.h"
+#include "util/tool.h"
-#include "util/ctoolclass.h"
-#include <boost/scoped_ptr.hpp>
-
-//Qt includes
-#include <QClipboard>
-#include <QList>
-#include <QProgressDialog>
-#include <QTextStream>
-#include <QApplication>
-#include <QFileDialog>
-
-//KDE includes
-
-
-//Sword includes
+// Sword includes:
#include <swkey.h>
#include <listkey.h>
+
using namespace Rendering;
using namespace Printing;
@@ -95,7 +87,7 @@ bool CExportManager::saveKey(CSwordKey* key, const Format format, const bool add
}
if (!progressWasCancelled()) {
- CToolClass::savePlainFile(filename, text, false, (format == HTML) ? QTextCodec::codecForName("UTF-8") : QTextCodec::codecForLocale() );
+ util::tool::savePlainFile(filename, text, false, (format == HTML) ? QTextCodec::codecForName("UTF-8") : QTextCodec::codecForLocale() );
closeProgressDialog();
return true;
}
@@ -143,7 +135,7 @@ bool CExportManager::saveKeyList(sword::ListKey* list, CSwordModuleInfo* module,
const QString text = render->renderKeyTree(tree);
if (!progressWasCancelled()) {
- CToolClass::savePlainFile(filename, text, false, (format == HTML) ? QTextCodec::codecForName("UTF-8") : QTextCodec::codecForLocale() );
+ util::tool::savePlainFile(filename, text, false, (format == HTML) ? QTextCodec::codecForName("UTF-8") : QTextCodec::codecForLocale() );
closeProgressDialog();
return true;
}
@@ -190,7 +182,7 @@ bool CExportManager::saveKeyList(QList<CSwordKey*>& list, const Format format, c
const QString text = render->renderKeyTree(tree);
if (!progressWasCancelled()) {
- CToolClass::savePlainFile(filename, text, false, (format == HTML) ? QTextCodec::codecForName("UTF-8") : QTextCodec::codecForLocale() );
+ util::tool::savePlainFile(filename, text, false, (format == HTML) ? QTextCodec::codecForName("UTF-8") : QTextCodec::codecForLocale() );
closeProgressDialog();
return true;
}
@@ -392,11 +384,11 @@ bool CExportManager::printKey( CSwordKey* key, CSwordBackend::DisplayOptions dis
bool CExportManager::printByHyperlink( const QString& hyperlink, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions ) {
QString moduleName;
QString keyName;
- CReferenceManager::Type type;
+ ReferenceManager::Type type;
- CReferenceManager::decodeHyperlink(hyperlink, moduleName, keyName, type);
+ ReferenceManager::decodeHyperlink(hyperlink, moduleName, keyName, type);
if (moduleName.isEmpty()) {
- moduleName = CReferenceManager::preferredModule(type);
+ moduleName = ReferenceManager::preferredModule(type);
}
CPrinter::KeyTree tree;
diff --git a/src/frontend/cexportmanager.h b/src/frontend/cexportmanager.h
index 013cd88..ee8c2c4 100644
--- a/src/frontend/cexportmanager.h
+++ b/src/frontend/cexportmanager.h
@@ -10,16 +10,17 @@
#ifndef CEXPORTMANAGER_H
#define CEXPORTMANAGER_H
-#include "backend/config/cbtconfig.h"
-#include "backend/managers/cswordbackend.h"
#include "util/cpointers.h"
-#include <QString>
#include <QList>
+#include <QString>
+#include "backend/config/cbtconfig.h"
+#include "backend/managers/cswordbackend.h"
+
-class ListKey;
class CSwordKey;
class CSwordModuleInfo;
+class ListKey;
class QProgressDialog;
/** Contains the functions to export text to disk, clipboard or printer.
@@ -65,7 +66,7 @@ class CExportManager : CPointers {
const QString lineBreak( const Format format );
private:
- QString m_caption;
+ QString m_caption; ///< \todo Useless field
QString m_progressLabel;
bool m_showProgress;
CSwordBackend::FilterOptions m_filterOptions;
diff --git a/src/frontend/cinfodisplay.cpp b/src/frontend/cinfodisplay.cpp
index e9c2811..59aa452 100644
--- a/src/frontend/cinfodisplay.cpp
+++ b/src/frontend/cinfodisplay.cpp
@@ -7,34 +7,31 @@
*
**********/
-// BibleTime includes
-#include "cinfodisplay.h"
+#include "frontend/cinfodisplay.h"
+#include <boost/scoped_ptr.hpp>
+#include <QAction>
+#include <QDebug>
+#include <QLabel>
+#include <QLayout>
+#include <QRegExp>
+#include <QSize>
+#include <QVBoxLayout>
+#include <QtAlgorithms>
+
+#include "backend/config/cbtconfig.h"
#include "backend/drivers/cswordmoduleinfo.h"
#include "backend/keys/cswordkey.h"
#include "backend/keys/cswordversekey.h"
-#include "backend/managers/creferencemanager.h"
+#include "backend/managers/referencemanager.h"
#include "backend/managers/cdisplaytemplatemgr.h"
-
-#include "backend/config/cbtconfig.h"
#include "frontend/crossrefrendering.h"
-
#include "frontend/display/cdisplay.h"
#include "frontend/display/creaddisplay.h"
-#include <boost/scoped_ptr.hpp>
-
-// Sword includes
+// Sword includes:
#include <listkey.h>
-// Qt includes
-#include <QLayout>
-#include <QLabel>
-#include <QRegExp>
-#include <QVBoxLayout>
-#include <QAction>
-#include <QDebug>
-#include <QSize>
using namespace Rendering;
using namespace sword;
@@ -85,7 +82,7 @@ CInfoDisplay::~CInfoDisplay() {
}
void CInfoDisplay::lookupInfo(const QString &mod_name, const QString &key_text) {
- qDebug("CInfoDisplay::lookup");
+ qDebug() << "CInfoDisplay::lookup";
qDebug() << mod_name << key_text;
CSwordModuleInfo* m = CPointers::backend()->findModuleByName(mod_name);
Q_ASSERT(m);
@@ -288,13 +285,18 @@ const QString CInfoDisplay::decodeCrossReference( const QString& data ) {
// qWarning("rendered the tree: %s", renderer.renderKeyTree(tree).latin1());
//spanns containing rtl text need dir=rtl on their parent tag to be aligned properly
QString lang = "en"; // default english
- if (module)
+ if (module) {
lang = module->language()->abbrev();
+ }
+
+ QString RenderedText = renderer.renderKeyTree(tree);
+ qDeleteAll(tree);
+
return QString("<div class=\"crossrefinfo\" lang=\"%1\"><h3>%2</h3><div class=\"para\" dir=\"%3\">%4</div></div>")
.arg(lang)
.arg(tr("Cross references"))
.arg(module ? ((module->textDirection() == CSwordModuleInfo::LeftToRight) ? "ltr" : "rtl") : "")
- .arg(renderer.renderKeyTree(tree));
+ .arg(RenderedText);
}
/*!
@@ -426,7 +428,7 @@ const QString CInfoDisplay::decodeMorph( const QString& data ) {
break;
default:
skipFirstChar = false;
- //TODO: we can't tell here if it's a greek or hebrew moprh code, that's a problem we have to solve
+ /// \todo we can't tell here if it's a greek or hebrew moprh code, that's a problem we have to solve
// module = CBTConfig::get(CBTConfig::standardGreekMorphLexicon);
break;
}
diff --git a/src/frontend/cinfodisplay.h b/src/frontend/cinfodisplay.h
index 18ffa96..61c9eaf 100644
--- a/src/frontend/cinfodisplay.h
+++ b/src/frontend/cinfodisplay.h
@@ -10,15 +10,13 @@
#ifndef CINFODISPLAY_H
#define CINFODISPLAY_H
-//Backend
-#include "backend/rendering/ctextrendering.h"
-
-//Qt includes
#include <QWidget>
-#include <QPair>
+
#include <QList>
+#include <QPair>
+#include "backend/rendering/ctextrendering.h"
+
-//class forward declarations
class CReadDisplay;
class QAction;
class QSize;
diff --git a/src/frontend/cinputdialog.cpp b/src/frontend/cinputdialog.cpp
index b44113a..5833965 100644
--- a/src/frontend/cinputdialog.cpp
+++ b/src/frontend/cinputdialog.cpp
@@ -7,23 +7,18 @@
*
**********/
+#include "frontend/cinputdialog.h"
-
-//own includes
-#include "cinputdialog.h"
-#include "util/dialogutil.h"
-
-//Qt includes
+#include <QDebug>
#include <QDialog>
-#include <QWidget>
+#include <QDialogButtonBox>
+#include <QHBoxLayout>
#include <QLabel>
-#include <QTextEdit>
#include <QPushButton>
-#include <QDialogButtonBox>
+#include <QTextEdit>
#include <QVBoxLayout>
-#include <QHBoxLayout>
-
-#include <QDebug>
+#include <QWidget>
+#include "util/dialogutil.h"
CInputDialog::CInputDialog
diff --git a/src/frontend/cinputdialog.h b/src/frontend/cinputdialog.h
index 209dc78..153c14e 100644
--- a/src/frontend/cinputdialog.h
+++ b/src/frontend/cinputdialog.h
@@ -7,14 +7,12 @@
*
**********/
-
-
#ifndef CINPUTDIALOG_H
#define CINPUTDIALOG_H
-
#include <QDialog>
+
class QTextEdit;
class QWidget;
diff --git a/src/frontend/cmdiarea.cpp b/src/frontend/cmdiarea.cpp
index 91f3eae..3745993 100644
--- a/src/frontend/cmdiarea.cpp
+++ b/src/frontend/cmdiarea.cpp
@@ -7,19 +7,25 @@
*
**********/
-#include "cmdiarea.h"
+#include "bibletime.h"
+#include "frontend/cmdiarea.h"
-//QT includes
-#include <QTimer>
#include <QEvent>
-#include <QWindowStateChangeEvent>
#include <QMdiSubWindow>
-#include <QDebug>
+#include <QTimer>
+#include <QWindowStateChangeEvent>
-CMDIArea::CMDIArea(QWidget *parent) : QMdiArea(parent),
- m_mdiArrangementMode(ArrangementModeManual) {
- setActivationOrder( CreationOrder ); //keep window order consistent
- connect(this, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(slotClientActivated(QMdiSubWindow*)));
+
+CMDIArea::CMDIArea(BibleTime *parent)
+ : QMdiArea(parent), m_mdiArrangementMode(ArrangementModeManual)
+{
+ Q_ASSERT(parent != 0);
+
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+
+ connect(this, SIGNAL(subWindowActivated(QMdiSubWindow*)),
+ this, SLOT(slotSubWindowActivated(QMdiSubWindow*)));
}
QMdiSubWindow* CMDIArea::addSubWindow(QWidget * widget, Qt::WindowFlags windowFlags) {
@@ -41,19 +47,11 @@ QMdiSubWindow* CMDIArea::addSubWindow(QWidget * widget, Qt::WindowFlags windowFl
return subWindow;
}
-void CMDIArea::deleteAll() {
- closeAllSubWindows();
-}
-
void CMDIArea::setMDIArrangementMode( const MDIArrangementMode newArrangementMode ) {
m_mdiArrangementMode = newArrangementMode;
triggerWindowUpdate();
}
-CMDIArea::MDIArrangementMode CMDIArea::getMDIArrangementMode(void) const {
- return m_mdiArrangementMode;
-}
-
void CMDIArea::myTileVertical() {
if (!updatesEnabled() || !usableWindowList().count() ) {
return;
@@ -71,7 +69,19 @@ void CMDIArea::myTileVertical() {
else {
setUpdatesEnabled(false);
QMdiSubWindow* active = activeSubWindow();
- QMdiArea::tileSubWindows();
+
+ const int widthForEach = width() / windows.count();
+ unsigned int x = 0;
+ foreach (QMdiSubWindow *window, windows) {
+ window->showNormal();
+
+ const int preferredWidth = window->minimumWidth() + window->baseSize().width();
+ const int actWidth = qMax(widthForEach, preferredWidth);
+
+ window->setGeometry(x, 0, actWidth, height());
+ x += actWidth;
+ }
+
if (active) active->setFocus();
setUpdatesEnabled(true);
}
@@ -95,7 +105,6 @@ void CMDIArea::myTileHorizontal() {
}
else {
setUpdatesEnabled(false);
-
QMdiSubWindow* active = activeSubWindow();
const int heightForEach = height() / windows.count();
@@ -109,7 +118,7 @@ void CMDIArea::myTileHorizontal() {
window->setGeometry( 0, y, width(), actHeight );
y += actHeight;
}
- active->setFocus();
+ if (active) active->setFocus();
setUpdatesEnabled(true);
}
emitWindowCaptionChanged();
@@ -161,11 +170,11 @@ void CMDIArea::myCascade() {
}
void CMDIArea::emitWindowCaptionChanged() {
- QString appCaption;
if (activeSubWindow()) {
- appCaption = activeSubWindow()->windowTitle();
+ emit sigSetToplevelCaption(activeSubWindow()->windowTitle());
+ } else {
+ emit sigSetToplevelCaption(QString());
}
- emit sigSetToplevelCaption(appCaption);
}
QList<QMdiSubWindow*> CMDIArea::usableWindowList() {
@@ -181,7 +190,7 @@ QList<QMdiSubWindow*> CMDIArea::usableWindowList() {
return ret;
}
-void CMDIArea::slotClientActivated(QMdiSubWindow* client) {
+void CMDIArea::slotSubWindowActivated(QMdiSubWindow* client) {
if (!client || !updatesEnabled()) {
return;
}
@@ -189,35 +198,56 @@ void CMDIArea::slotClientActivated(QMdiSubWindow* client) {
}
//resize event of the MDI area itself, update layout if necessary
-void CMDIArea::resizeEvent(QResizeEvent* /*e*/) {
- //do not call QMdiArea::resizeEvent(e), this would mess up our layout
+void CMDIArea::resizeEvent(QResizeEvent* e) {
+ // Do not call QMdiArea::resizeEvent(e), this would mess up our layout
+ // unless we are in manual mode
if (updatesEnabled()) triggerWindowUpdate();
+ if (m_mdiArrangementMode == ArrangementModeManual)
+ QMdiArea::resizeEvent(e);
}
//handle events of the client windows to update layout if necessary
bool CMDIArea::eventFilter(QObject *o, QEvent *e) {
- QMdiSubWindow* w = dynamic_cast<QMdiSubWindow*>(o);
- if (!w) return false; //let the event be handled by other filters too
-
- if (e->type() == QEvent::WindowStateChange) {
- Qt::WindowStates newState = w->windowState();
- Qt::WindowStates oldState = ((QWindowStateChangeEvent*)e)->oldState();
-
- //Do not handle window activation or deactivation here, it will produce wrong
- //results because this event is handled too early. Let slotClientActivated() handle this.
+ QMdiSubWindow *w(qobject_cast<QMdiSubWindow*>(o));
+
+ // Let the event be handled by other filters:
+ if (w == 0) return QMdiArea::eventFilter(o, e);
+
+ switch (e->type()) {
+ case QEvent::WindowStateChange:
+ {
+ Qt::WindowStates newState(w->windowState());
+ Qt::WindowStates oldState(((QWindowStateChangeEvent*)e)->oldState());
+
+ /*
+ Do not handle window activation or deactivation here, it will
+ produce wrong results because this event is handled too early. Let
+ slotSubWindowActivated() handle this.
+ */
+
+ // Check if subwindow was maximized or un-maximized:
+ if ((newState ^ oldState) & Qt::WindowMaximized) {
+ triggerWindowUpdate();
+ break;
+ }
- bool needsLayoutUpdate = false;
- //Window was maximized or un-maximized
- if ((newState ^ oldState) & Qt::WindowMaximized) needsLayoutUpdate = true;
- //Window was minimized or de-minimized
- if ((newState ^ oldState) & Qt::WindowMinimized) needsLayoutUpdate = true;
- //update Layout?
- if (needsLayoutUpdate) triggerWindowUpdate();
- }
- if (e->type() == QEvent::Close) {
- triggerWindowUpdate();
+ // Check if subwindow was minimized or de-minimized:
+ if ((newState ^ oldState) & Qt::WindowMinimized) {
+ triggerWindowUpdate();
+ }
+ break;
+ }
+ case QEvent::Close:
+ triggerWindowUpdate();
+ break;
+ case QEvent::WindowTitleChange:
+ emitWindowCaptionChanged();
+ break;
+ default:
+ break;
}
- return false; //let the event be handled by other filters too
+
+ return false; // Don't filter the event out
}
void CMDIArea::triggerWindowUpdate() {
diff --git a/src/frontend/cmdiarea.h b/src/frontend/cmdiarea.h
index 1420007..1fb1c7f 100644
--- a/src/frontend/cmdiarea.h
+++ b/src/frontend/cmdiarea.h
@@ -10,107 +10,111 @@
#ifndef CMDIAREA_H
#define CMDIAREA_H
-//Qt includes
#include <QMdiArea>
+
#include <QList>
+class BibleTime;
class CSwordModuleInfo;
-class QEvent;
-class QResizeEvent;
-class QMdiSubWindow;
-
-/** The MDI widget we use in BibleTime.
- * Enhances QMdiArea.
- */
-class CMDIArea : public QMdiArea {
+
+/**
+ A custom MDI area widget.
+*/
+class CMDIArea: public QMdiArea {
Q_OBJECT
Q_PROPERTY(MDIArrangementMode m_mdiArrangementMode READ getMDIArrangementMode WRITE setMDIArrangementMode)
public:
/**
- * The options you can set for this widget.
+ Possible MDI subwindow arrangement modes.
*/
enum MDIArrangementMode {
ArrangementModeTileVertical = 1,
ArrangementModeTileHorizontal = 2,
ArrangementModeCascade = 3,
- ArrangementModeManual = 4,
- MDIArrangementModeMIN = ArrangementModeTileVertical,
- MDIArrangementModeMAX = ArrangementModeManual
+ ArrangementModeManual = 4
};
- CMDIArea(QWidget *parent);
- /** Reimplementation
+
+ /**
+ \param[in] parent BibleTime main window used for parent widget.
*/
- virtual QMdiSubWindow* addSubWindow(QWidget* widget, Qt::WindowFlags windowFlags = 0);
+ CMDIArea(BibleTime *parent);
+
/**
+ Reimplementation of QMdiArea::addSubWindow().
+ */
+ QMdiSubWindow *addSubWindow(QWidget *widget, Qt::WindowFlags windowFlags = 0);
+
+ /**
+ Resets the MDI arrangement mode and arranges the windows.
+ \param[in] mode new MDI arrangement mode.
*/
- void setMDIArrangementMode( const MDIArrangementMode );
- /** */
- MDIArrangementMode getMDIArrangementMode(void) const;
+ void setMDIArrangementMode(const MDIArrangementMode mode);
+
/**
+ Returns the current MDI arrangement mode.
*/
- void emitWindowCaptionChanged();
+ inline MDIArrangementMode getMDIArrangementMode() const {
+ return m_mdiArrangementMode;
+ }
+
/**
* Forces an update of the currently chosen window arrangement.
*/
void triggerWindowUpdate();
- /** Lists all subWindows which are not minimized or hidden
- */
- QList<QMdiSubWindow*> usableWindowList();
- public slots:
/**
- * Called whan a client window was activated
+ Returns a lists of all subwindows which are not minimized or hidden.
*/
- void slotClientActivated(QMdiSubWindow* client);
+ QList<QMdiSubWindow*> usableWindowList();
+
+ public slots:
/**
- * Deletes all the presenters in the MDI area.
- */
- void deleteAll();
- /** Our own cascade version which, if only one window is left, shows this maximized.
- * Also necessary for autoCasacde feature
+ Our own cascade version which, if only one window is left, shows this
+ maximized. Also necessary for autoCascade feature.
*/
void myCascade();
- /** Our own cascade version which, if only one window is left, shows this maximized.
- * Also necessary for autoTile feature
+
+ /**
+ Our own cascade version which, if only one window is left, shows this
+ maximized. Also necessary for autoTile feature.
*/
void myTileVertical();
- /** Horizontal tile function
- * This function was taken from Qt's MDI example.
+
+ /**
+ Horizontal tile function. This function was taken from Qt's MDI
+ example.
*/
void myTileHorizontal();
- /**
- * Emits the signal to create a new display window in the MDI area.
- */
- inline void emitCreateDisplayWindow(QList<CSwordModuleInfo*> modules, const QString keyName);
- signals: // Signals
+ signals:
/**
* Emits a signal to set the acption of the toplevel widget.
*/
void sigSetToplevelCaption(const QString&);
- /**
- */
- void createReadDisplayWindow(QList<CSwordModuleInfo*> modules, const QString& keyName);
- private:
+ protected:
/**
- * Reimplementation
+ * Reimplementation of QWidget::resizeEvent().
*/
- virtual void resizeEvent(QResizeEvent* e);
+ void resizeEvent(QResizeEvent *e);
+
/**
- * Used to handle Events of MDI windows
- * */
- bool eventFilter( QObject *o, QEvent *e );
+ Reimplementation of QObject::eventFilter() used to handle some MDI
+ subwindow events.
+ */
+ bool eventFilter(QObject *o, QEvent *e);
+
+ void emitWindowCaptionChanged();
+
+ protected slots:
/**
- */
+ Called whan a subwindow was activated.
+ */
+ void slotSubWindowActivated(QMdiSubWindow *client);
+
+ protected:
MDIArrangementMode m_mdiArrangementMode;
};
-/** Emits the signal to create a new display window in the MDI area. */
-inline void CMDIArea::emitCreateDisplayWindow(QList<CSwordModuleInfo*> modules, const QString keyName) {
- emit createReadDisplayWindow(modules, keyName);
-}
-
-
#endif
diff --git a/src/frontend/cmodulechooserdialog.cpp b/src/frontend/cmodulechooserdialog.cpp
index 2107b2c..d2d7505 100644
--- a/src/frontend/cmodulechooserdialog.cpp
+++ b/src/frontend/cmodulechooserdialog.cpp
@@ -7,30 +7,28 @@
*
**********/
-#include "cmodulechooserdialog.h"
+#include "frontend/cmodulechooserdialog.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/managers/cswordbackend.h"
-#include "backend/btmoduletreeitem.h"
-
-#include "util/cpointers.h"
-#include "util/cresmgr.h"
-#include "util/ctoolclass.h"
-#include "util/dialogutil.h"
-#include "util/directoryutil.h"
-#include "backend/config/cbtconfig.h"
-
-#include <QDialog>
#include <QButtonGroup>
+#include <QDebug>
+#include <QDialog>
#include <QDialogButtonBox>
#include <QHBoxLayout>
+#include <QHeaderView>
+#include <QLabel>
#include <QSpacerItem>
+#include <QStringList>
#include <QTreeWidget>
#include <QVBoxLayout>
-#include <QStringList>
-#include <QDebug>
-#include <QHeaderView>
-#include <QLabel>
+#include "backend/btmoduletreeitem.h"
+#include "backend/config/cbtconfig.h"
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "backend/managers/cswordbackend.h"
+#include "util/cpointers.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
+#include "util/dialogutil.h"
+#include "util/directory.h"
CModuleChooserDialog::CModuleChooserDialog( QWidget* parent, QString title, QString label, QList<CSwordModuleInfo*>* allModules)
@@ -58,7 +56,7 @@ void CModuleChooserDialog::init() {
/** Initializes the view of this dialog */
void CModuleChooserDialog::initView() {
- //TODO: choose the button text?
+ /// \todo choose the button text?
QVBoxLayout *vboxLayout;
QHBoxLayout *hboxLayout;
@@ -66,7 +64,7 @@ void CModuleChooserDialog::initView() {
vboxLayout = new QVBoxLayout(this);
- QLabel* label = CToolClass::explanationLabel(this, QString::null, m_labelText);
+ QLabel* label = util::tool::explanationLabel(this, QString::null, m_labelText);
vboxLayout->addWidget(label);
m_moduleChooser = new QTreeWidget(this);
@@ -94,7 +92,7 @@ void CModuleChooserDialog::initView() {
void CModuleChooserDialog::initTree() {
- //qDebug("CModuleChooserDialog::initTree");
+ //qDebug() << "CModuleChooserDialog::initTree";
// See BTModuleTreeItem documentation.
BTModuleTreeItem root(m_filters, m_grouping, &m_moduleList);
@@ -127,10 +125,10 @@ void CModuleChooserDialog::slotOk() {
for ( ; *it; ++it ) {
//add the module to list if the box is checked
if ((*it)->checkState(0) == Qt::Checked) {
- qDebug("was checked");
+ qDebug() << "was checked";
for (QList<CSwordModuleInfo*>::iterator all_iter(m_moduleList.begin()); all_iter != m_moduleList.end(); ++all_iter) {
if ((*all_iter)->name() == (*it)->text(0)) {
- qDebug("append");
+ qDebug() << "append";
mods.append(*all_iter);
break;
}
diff --git a/src/frontend/cmodulechooserdialog.h b/src/frontend/cmodulechooserdialog.h
index 1e5a777..e74d743 100644
--- a/src/frontend/cmodulechooserdialog.h
+++ b/src/frontend/cmodulechooserdialog.h
@@ -10,17 +10,16 @@
#ifndef CMODULECHOOSERDIALOG_H
#define CMODULECHOOSERDIALOG_H
-class CSwordModuleInfo;
-#include "backend/btmoduletreeitem.h"
-
#include <QDialog>
+
+#include "backend/btmoduletreeitem.h"
#include <QList>
#include <QTreeWidget>
+class CSwordModuleInfo;
class QDialogButtonBox;
-
/**
* Abstract dialog which lets the user select modules with checkboxes.
* The dialog will be destroyed after closing. Connect the modulesChanged() signal
diff --git a/src/frontend/cmoduleindexdialog.cpp b/src/frontend/cmoduleindexdialog.cpp
index d85e6b7..a32d1ea 100644
--- a/src/frontend/cmoduleindexdialog.cpp
+++ b/src/frontend/cmoduleindexdialog.cpp
@@ -7,27 +7,24 @@
*
**********/
-#include "cmoduleindexdialog.h"
+#include "frontend/cmoduleindexdialog.h"
-#include "util/cpointers.h"
+#include <QApplication>
+#include <QDebug>
+#include <QProgressDialog>
+#include <QString>
#include "backend/managers/cswordbackend.h"
+#include "util/cpointers.h"
+#include "util/dialogutil.h"
-#include <boost/scoped_ptr.hpp>
-
-//Qt includes
-#include <QString>
-#include <QProgressDialog>
-#include <QDebug>
-#include <QApplication>
-#include <QMessageBox>
CModuleIndexDialog* CModuleIndexDialog::getInstance() {
- qDebug("CModuleIndexDialog::getInstance");
+ qDebug() << "CModuleIndexDialog::getInstance";
static CModuleIndexDialog* instance = 0;
if (instance == 0) {
instance = new CModuleIndexDialog();
}
- qDebug("CModuleIndexDialog::getInstance end");
+ qDebug() << "CModuleIndexDialog::getInstance end";
return instance;
}
@@ -45,7 +42,7 @@ void CModuleIndexDialog::indexAllModules( const QList<CSwordModuleInfo*>& module
m_progress->raise();
foreach (CSwordModuleInfo* info, modules) {
- //TODO: how to cancel
+ /// \todo how to cancel
//QObject::connect(CPointers::backend(), SIGNAL(sigSwordSetupChanged()), this, SLOT(swordSetupChanged()));
connect(this, SIGNAL(sigCancel()), info, SLOT(cancelIndexing()) );
connect(m_progress, SIGNAL(canceled()), info, SLOT(cancelIndexing()));
@@ -54,7 +51,7 @@ void CModuleIndexDialog::indexAllModules( const QList<CSwordModuleInfo*>& module
QString modname(info->name());
const QString labelText = tr("Creating index for work: %1").arg(modname);
m_progress->setLabelText(labelText);
- //todo: if we want to cancel indexing from
+ /// \todo if we want to cancel indexing from
info->buildIndex(); //waits until this module is finished
m_currentModuleIndex++;
@@ -96,7 +93,7 @@ void CModuleIndexDialog::slotFinished( ) {
// Modules may be removed
void CModuleIndexDialog::slotSwordSetupChanged() {
- qDebug("CModuleIndexDialog::slotSwordSetupChanged, TODO: cancel if modules are removed");
- QMessageBox::information(0, tr("Indexing Is Cancelled"), tr("Indexing is cancelled because modules are removed."));
+ qDebug() << "CModuleIndexDialog::slotSwordSetupChanged"; /// \todo cancel if modules are removed
+ util::showInformation(0, tr("Indexing Is Cancelled"), tr("Indexing is cancelled because modules are removed."));
emit sigCancel();
}
diff --git a/src/frontend/cmoduleindexdialog.h b/src/frontend/cmoduleindexdialog.h
index 3a19be2..b27b161 100644
--- a/src/frontend/cmoduleindexdialog.h
+++ b/src/frontend/cmoduleindexdialog.h
@@ -1,24 +1,19 @@
-//
-// C++ Interface: cmoduleindexdialog
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 2006-2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
#ifndef CMODULEINDEXDIALOG_H
#define CMODULEINDEXDIALOG_H
-class CSwordModuleInfo;
-
-//Qt includes
#include <QObject>
-//forward declaration
-//class KProgressDialog;
+
+class CSwordModuleInfo;
class QProgressDialog;
/**
diff --git a/src/frontend/cprinter.cpp b/src/frontend/cprinter.cpp
index 0a05a55..11988a9 100644
--- a/src/frontend/cprinter.cpp
+++ b/src/frontend/cprinter.cpp
@@ -7,16 +7,16 @@
*
**********/
-#include "cprinter.h"
+#include "frontend/cprinter.h"
-#include "backend/managers/cdisplaytemplatemgr.h"
+#include <QPrintDialog>
+#include <QPrinter>
+#include <QWebFrame>
+#include <QWebPage>
#include "backend/keys/cswordversekey.h"
+#include "backend/managers/cdisplaytemplatemgr.h"
#include "util/cpointers.h"
-#include <QWebPage>
-#include <QWebFrame>
-#include <QPrinter>
-#include <QPrintDialog>
namespace Printing {
diff --git a/src/frontend/cprinter.h b/src/frontend/cprinter.h
index d97563e..f119ec3 100644
--- a/src/frontend/cprinter.h
+++ b/src/frontend/cprinter.h
@@ -10,11 +10,12 @@
#ifndef CPRINTER_H
#define CPRINTER_H
-#include "backend/managers/cswordbackend.h"
+#include <QObject>
#include "backend/rendering/cdisplayrendering.h"
+
#include "backend/config/cbtconfig.h"
+#include "backend/managers/cswordbackend.h"
-#include <QObject>
class QWebPage;
diff --git a/src/frontend/crossrefrendering.cpp b/src/frontend/crossrefrendering.cpp
index 9785ee7..1d7ff63 100644
--- a/src/frontend/crossrefrendering.cpp
+++ b/src/frontend/crossrefrendering.cpp
@@ -1,31 +1,28 @@
-//
-// C++ Implementation: crossrefrendering
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 2004, 2007
-//
-// Copyright: See COPYING file that comes with this distribution
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
-
-#include "crossrefrendering.h"
+#include "frontend/crossrefrendering.h"
#include "backend/drivers/cswordmoduleinfo.h"
#include "backend/keys/cswordversekey.h"
-#include "backend/managers/creferencemanager.h"
+#include "backend/managers/referencemanager.h"
+
namespace InfoDisplay {
-/**
- */
CrossRefRendering::CrossRefRendering( CSwordBackend::DisplayOptions displayOptions,
CSwordBackend::FilterOptions filterOptions
)
: CHTMLExportRendering(Settings(), displayOptions, filterOptions) {}
const QString CrossRefRendering::finishText( const QString& text, KeyTree& ) {
- // qDebug("CrossRefRendering::finishText");
+ // qDebug() << "CrossRefRendering::finishText";
return text;
}
@@ -74,10 +71,10 @@ const QString CrossRefRendering::entryLink( const KeyTreeItem& item, CSwordModul
// qWarning("rendering");
return QString("<a href=\"%1\">%2</a>")
.arg(
- CReferenceManager::encodeHyperlink(
+ ReferenceManager::encodeHyperlink(
module->name(),
item.key(),
- CReferenceManager::typeFromModule(module->type())
+ ReferenceManager::typeFromModule(module->type())
)
)
.arg(linkText);
diff --git a/src/frontend/crossrefrendering.h b/src/frontend/crossrefrendering.h
index a1e5607..561fd3e 100644
--- a/src/frontend/crossrefrendering.h
+++ b/src/frontend/crossrefrendering.h
@@ -1,20 +1,18 @@
-//
-// C++ Interface: crossrefrendering
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 2004, 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef INFODISPLAYCROSSREFRENDERING_H
#define INFODISPLAYCROSSREFRENDERING_H
-//Backend includes
#include "backend/rendering/chtmlexportrendering.h"
+
namespace InfoDisplay {
class CrossRefRendering : public Rendering::CHTMLExportRendering {
diff --git a/src/frontend/display/btcolorwidget.cpp b/src/frontend/display/btcolorwidget.cpp
index 735f23f..37bea2d 100644
--- a/src/frontend/display/btcolorwidget.cpp
+++ b/src/frontend/display/btcolorwidget.cpp
@@ -7,11 +7,13 @@
*
**********/
-#include "btcolorwidget.h"
-#include <QPalette>
+#include "frontend/display/btcolorwidget.h"
+
#include <QColor>
-#include <QMouseEvent>
#include <QColorDialog>
+#include <QMouseEvent>
+#include <QPalette>
+
BtColorWidget::BtColorWidget(QWidget* parent)
: QFrame(parent) {
diff --git a/src/frontend/display/btcolorwidget.h b/src/frontend/display/btcolorwidget.h
index aac8615..0d8e8ad 100644
--- a/src/frontend/display/btcolorwidget.h
+++ b/src/frontend/display/btcolorwidget.h
@@ -1,19 +1,18 @@
-//
-// C++ Interface: BtColorWidget
-//
-// Description: A color choosing widget for the toolbar
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef BTCOLORWIDGET_H
#define BTCOLORWIDGET_H
#include <QFrame>
+
+
class QPaintEvent;
class BtColorWidget : public QFrame {
diff --git a/src/frontend/display/btfontsizewidget.cpp b/src/frontend/display/btfontsizewidget.cpp
index 9d45a6a..116d0d7 100644
--- a/src/frontend/display/btfontsizewidget.cpp
+++ b/src/frontend/display/btfontsizewidget.cpp
@@ -7,9 +7,11 @@
*
**********/
-#include "btfontsizewidget.h"
-#include <QFontDatabase>
+#include "frontend/display/btfontsizewidget.h"
+
#include <QCompleter>
+#include <QFontDatabase>
+
BtFontSizeWidget::BtFontSizeWidget(QWidget* parent)
: QComboBox(parent) {
diff --git a/src/frontend/display/btfontsizewidget.h b/src/frontend/display/btfontsizewidget.h
index 81cfa86..3db867d 100644
--- a/src/frontend/display/btfontsizewidget.h
+++ b/src/frontend/display/btfontsizewidget.h
@@ -1,14 +1,11 @@
-//
-// C++ Interface: BtFontSizeWidget
-//
-// Description: A font combobox widget for the toolbar
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef BTFONTSIZEWIDGET_H
#define BTFONTSIZEWIDGET_H
diff --git a/src/frontend/display/bthtmlfindtext.cpp b/src/frontend/display/bthtmlfindtext.cpp
index 9e0feff..70e8a5d 100644
--- a/src/frontend/display/bthtmlfindtext.cpp
+++ b/src/frontend/display/bthtmlfindtext.cpp
@@ -7,12 +7,14 @@
*
**********/
-#include "bthtmlfindtext.h"
-#include "bthtmlreaddisplay.h"
-#include "creaddisplay.h"
+#include "frontend/display/bthtmlfindtext.h"
+
+#include <QMdiSubWindow>
#include "frontend/cmdiarea.h"
+#include "frontend/display/bthtmlreaddisplay.h"
+#include "frontend/display/creaddisplay.h"
#include "frontend/displaywindow/cdisplaywindow.h"
-#include <QMdiSubWindow>
+
static BtHtmlFindText* dialog = 0;
diff --git a/src/frontend/display/bthtmlfindtext.h b/src/frontend/display/bthtmlfindtext.h
index 0500247..3c24489 100644
--- a/src/frontend/display/bthtmlfindtext.h
+++ b/src/frontend/display/bthtmlfindtext.h
@@ -10,7 +10,10 @@
#ifndef BTHTMLFINDTEXT_H
#define BTHTMLFINDTEXT_H
+/// \todo Qt Designer UI file!?
#include "ui_bthtmlfindtext.h"
+
+
class CMDIArea;
class QWebView;
diff --git a/src/frontend/display/bthtmljsobject.cpp b/src/frontend/display/bthtmljsobject.cpp
index b1b97a6..195564e 100644
--- a/src/frontend/display/bthtmljsobject.cpp
+++ b/src/frontend/display/bthtmljsobject.cpp
@@ -6,16 +6,19 @@
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-#include "bthtmljsobject.h"
-#include "bthtmlreaddisplay.h"
-#include "frontend/cinfodisplay.h"
-#include "frontend/cdragdrop.h"
-#include "backend/managers/creferencemanager.h"
-#include "backend/managers/cswordbackend.h"
-#include "backend/keys/cswordkey.h"
-#include "backend/config/cbtconfig.h"
+
+#include "frontend/display/bthtmljsobject.h"
+
#include <boost/scoped_ptr.hpp>
#include <QObject>
+#include "backend/config/cbtconfig.h"
+#include "backend/keys/cswordkey.h"
+#include "backend/managers/referencemanager.h"
+#include "backend/managers/cswordbackend.h"
+#include "frontend/cdragdrop.h"
+#include "frontend/cinfodisplay.h"
+#include "frontend/display/bthtmlreaddisplay.h"
+
using namespace InfoDisplay;
@@ -49,14 +52,14 @@ void BtHtmlJsObject::mouseDownLeft(const QString& url, const int& x, const int&
void BtHtmlJsObject::mouseClick(const QString& url) {
m_dndData.mousePressed = false;
- if (!url.isEmpty() && CReferenceManager::isHyperlink(url)) {
+ if (!url.isEmpty() && ReferenceManager::isHyperlink(url)) {
QString module;
QString key;
- CReferenceManager::Type type;
+ ReferenceManager::Type type;
- CReferenceManager::decodeHyperlink(url, module, key, type);
+ ReferenceManager::decodeHyperlink(url, module, key, type);
if (module.isEmpty()) {
- module = CReferenceManager::preferredModule( type );
+ module = ReferenceManager::preferredModule( type );
}
m_display->connectionsProxy()->emitReferenceClicked(module, key);
}
@@ -82,8 +85,8 @@ void BtHtmlJsObject::mouseMoveEvent(const QString& attributes, const int& x, con
// create a new bookmark drag!
QString moduleName = QString::null;
QString keyName = QString::null;
- CReferenceManager::Type type;
- if ( !CReferenceManager::decodeHyperlink(m_dndData.url, moduleName, keyName, type) )
+ ReferenceManager::Type type;
+ if ( !ReferenceManager::decodeHyperlink(m_dndData.url, moduleName, keyName, type) )
return;
drag = new QDrag(m_display->view());
BTMimeData* mimedata = new BTMimeData(moduleName, keyName, QString::null);
diff --git a/src/frontend/display/bthtmljsobject.h b/src/frontend/display/bthtmljsobject.h
index d418b71..c3536ff 100644
--- a/src/frontend/display/bthtmljsobject.h
+++ b/src/frontend/display/bthtmljsobject.h
@@ -6,12 +6,15 @@
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
+
#ifndef BTHTMLJSOBJECT_H
#define BTHTMLJSOBJECT_H
#include <QObject>
+
#include <QPoint>
+
class BtHtmlReadDisplay;
class BtHtmlJsObject: public QObject {
diff --git a/src/frontend/display/bthtmlreaddisplay.cpp b/src/frontend/display/bthtmlreaddisplay.cpp
index 7ce6f40..3d97fba 100644
--- a/src/frontend/display/bthtmlreaddisplay.cpp
+++ b/src/frontend/display/bthtmlreaddisplay.cpp
@@ -7,21 +7,22 @@
*
**********/
-#include "bthtmlreaddisplay.h"
-#include "bthtmljsobject.h"
-#include "frontend/displaywindow/cdisplaywindow.h"
-#include "frontend/displaywindow/creadwindow.h"
+#include "frontend/display/bthtmlreaddisplay.h"
+
+#include <boost/scoped_ptr.hpp>
+#include <QMenu>
+#include <QString>
+#include "backend/config/cbtconfig.h"
+#include "backend/keys/cswordkey.h"
+#include "backend/managers/referencemanager.h"
#include "frontend/cdragdrop.h"
#include "frontend/cinfodisplay.h"
-#include "backend/managers/creferencemanager.h"
-#include "backend/keys/cswordkey.h"
-#include "backend/config/cbtconfig.h"
-#include "util/ctoolclass.h"
+#include "frontend/display/bthtmljsobject.h"
+#include "frontend/displaywindow/cdisplaywindow.h"
+#include "frontend/displaywindow/creadwindow.h"
+#include "util/directory.h"
#include "util/cpointers.h"
-#include "util/directoryutil.h"
-#include <boost/scoped_ptr.hpp>
-#include <QString>
-#include <QMenu>
+
using namespace InfoDisplay;
@@ -55,9 +56,11 @@ BtHtmlReadDisplay::~BtHtmlReadDisplay() {
// Read javascript into memory once and create the c++ javascript object
void BtHtmlReadDisplay::initJavascript() {
+ namespace DU = util::directory;
+
// read bthtml.js javascript file once
if (javascript.size() == 0) {
- QString jsFile = util::filesystem::DirectoryUtil::getJavascriptDir().canonicalPath() + "/bthtml.js";
+ QString jsFile = DU::getJavascriptDir().canonicalPath() + "/bthtml.js";
QFile file(jsFile);
if (file.open(QFile::ReadOnly)) {
while (!file.atEnd()) {
@@ -98,7 +101,7 @@ const QString BtHtmlReadDisplay::text( const CDisplay::TextType format, const CD
if (module->type() == CSwordModuleInfo::Lexicon ||
module->type() == CSwordModuleInfo::Commentary ||
module->type() == CSwordModuleInfo::GenericBook) {
- //TODO: This is a BAD HACK, we have to fnd a better solution to manage the settings now
+ /// \todo This is a BAD HACK, we have to fnd a better solution to manage the settings now
CSwordBackend::FilterOptions filterOptions;
filterOptions.footnotes = false;
filterOptions.strongNumbers = false;
@@ -123,7 +126,7 @@ const QString BtHtmlReadDisplay::text( const CDisplay::TextType format, const CD
return QString::null;
}
else if (format == HTMLText) {
- // TODO: It does not appear this is ever called
+ // \todo It does not appear this is ever called
}
else { //plain text requested
return selectedText();
@@ -133,8 +136,8 @@ const QString BtHtmlReadDisplay::text( const CDisplay::TextType format, const CD
case AnchorOnly: {
QString moduleName;
QString keyName;
- CReferenceManager::Type type;
- CReferenceManager::decodeHyperlink(activeAnchor(), moduleName, keyName, type);
+ ReferenceManager::Type type;
+ ReferenceManager::decodeHyperlink(activeAnchor(), moduleName, keyName, type);
return keyName;
}
@@ -142,8 +145,8 @@ const QString BtHtmlReadDisplay::text( const CDisplay::TextType format, const CD
case AnchorTextOnly: {
QString moduleName;
QString keyName;
- CReferenceManager::Type type;
- CReferenceManager::decodeHyperlink(activeAnchor(), moduleName, keyName, type);
+ ReferenceManager::Type type;
+ ReferenceManager::decodeHyperlink(activeAnchor(), moduleName, keyName, type);
if (CSwordModuleInfo* module = backend()->findModuleByName(moduleName)) {
boost::scoped_ptr<CSwordKey> key( CSwordKey::createInstance(module) );
@@ -157,14 +160,14 @@ const QString BtHtmlReadDisplay::text( const CDisplay::TextType format, const CD
case AnchorWithText: {
QString moduleName;
QString keyName;
- CReferenceManager::Type type;
- CReferenceManager::decodeHyperlink(activeAnchor(), moduleName, keyName, type);
+ ReferenceManager::Type type;
+ ReferenceManager::decodeHyperlink(activeAnchor(), moduleName, keyName, type);
if (CSwordModuleInfo* module = backend()->findModuleByName(moduleName)) {
boost::scoped_ptr<CSwordKey> key( CSwordKey::createInstance(module) );
key->key( keyName );
- //TODO: This is a BAD HACK, we have to fnd a better solution to manage the settings now
+ /// \todo This is a BAD HACK, we have to fnd a better solution to manage the settings now
CSwordBackend::FilterOptions filterOptions;
filterOptions.footnotes = false;
filterOptions.strongNumbers = false;
diff --git a/src/frontend/display/bthtmlreaddisplay.h b/src/frontend/display/bthtmlreaddisplay.h
index 020a685..7c2d91f 100644
--- a/src/frontend/display/bthtmlreaddisplay.h
+++ b/src/frontend/display/bthtmlreaddisplay.h
@@ -10,18 +10,17 @@
#ifndef BTHTMLREADDISPLAY_H
#define BTHTMLREADDISPLAY_H
-//BibleTime includes
-#include "bthtmljsobject.h"
-#include "creaddisplay.h"
+#include "frontend/display/creaddisplay.h"
+#include <QWebPage>
-//Qt includes
#include <QDragEnterEvent>
#include <QDropEvent>
+#include <QPoint>
#include <QTimerEvent>
#include <QWebView>
-#include <QWebPage>
#include <QWebFrame>
-#include <QPoint>
+#include "frontend/display/bthtmljsobject.h"
+
class BtHtmlReadDisplayView;
class QScrollArea;
diff --git a/src/frontend/display/cdisplay.cpp b/src/frontend/display/cdisplay.cpp
index b66f8af..a63b55b 100644
--- a/src/frontend/display/cdisplay.cpp
+++ b/src/frontend/display/cdisplay.cpp
@@ -7,29 +7,22 @@
*
**********/
-#include "cdisplay.h"
+#include "frontend/display/cdisplay.h"
-#include "bthtmlreaddisplay.h"
-typedef BtHtmlReadDisplay HTMLREADDISPLAY;
-
-#include "cplainwritedisplay.h"
-#include "chtmlwritedisplay.h"
-
-#include "backend/managers/creferencemanager.h"
-
-#include "util/ctoolclass.h"
-
-
-//Qt includes
+#include <QApplication>
#include <QClipboard>
-#include <QMenu>
-#include <QTimer>
#include <QDebug>
-#include <QApplication>
#include <QFileDialog>
+#include <QMenu>
+#include <QTimer>
+#include "backend/managers/referencemanager.h"
+#include "frontend/display/bthtmlreaddisplay.h"
+#include "frontend/display/chtmlwritedisplay.h"
+#include "frontend/display/cplainwritedisplay.h"
+#include "util/tool.h"
-//KDE includes
+typedef BtHtmlReadDisplay HTMLREADDISPLAY;
CDisplayConnections::CDisplayConnections( CDisplay* display ) : m_display(display) {}
@@ -47,7 +40,7 @@ void CDisplayConnections::saveAsPlain() {
/** Emits the signal. */
void CDisplayConnections::emitReferenceClicked( const QString& module, const QString& key) {
- qDebug("CDisplayConnections::emitReferenceClicked");
+ qDebug() << "CDisplayConnections::emitReferenceClicked";
qDebug() << "Module: " << module << " key: " << key;
emit referenceClicked( module, key );
}
@@ -161,7 +154,7 @@ bool CDisplay::save( const CDisplay::TextType format, const CDisplay::TextPart p
const QString filename = QFileDialog::getSaveFileName(0, QObject::tr("Save document ..."), "", filter);
if (!filename.isEmpty()) {
- CToolClass::savePlainFile(filename, content);
+ util::tool::savePlainFile(filename, content);
}
return true;
}
@@ -169,10 +162,10 @@ bool CDisplay::save( const CDisplay::TextType format, const CDisplay::TextPart p
/** Emits the signal which used when a reference was clicked. */
void CDisplay::emitReferenceClicked( const QString& reference ) {
QString module, key;
- CReferenceManager::Type type;
- CReferenceManager::decodeHyperlink(reference, module, key, type);
+ ReferenceManager::Type type;
+ ReferenceManager::decodeHyperlink(reference, module, key, type);
if (module.isEmpty()) {
- module = CReferenceManager::preferredModule( type );
+ module = ReferenceManager::preferredModule( type );
}
m_connections->emitReferenceClicked(module, key);
}
@@ -181,8 +174,8 @@ void CDisplay::emitReferenceClicked( const QString& reference ) {
void CDisplay::emitReferenceDropped( const QString& reference ) {
QString module;
QString key;
- CReferenceManager::Type type;
- CReferenceManager::decodeHyperlink(reference, module, key, type);
+ ReferenceManager::Type type;
+ ReferenceManager::decodeHyperlink(reference, module, key, type);
m_connections->emitReferenceDropped(key);
}
diff --git a/src/frontend/display/cdisplay.h b/src/frontend/display/cdisplay.h
index 0fdaa0e..b84c26e 100644
--- a/src/frontend/display/cdisplay.h
+++ b/src/frontend/display/cdisplay.h
@@ -7,27 +7,21 @@
*
**********/
-
-
#ifndef CDISPLAY_H
#define CDISPLAY_H
-//BibleTime includes
#include "util/cpointers.h"
-#include "backend/managers/cswordbackend.h"
-//Qt includes
#include <QMap>
+#include "backend/managers/cswordbackend.h"
class CDisplayConnections;
-class CReadWindow;
-class CWriteWindow;
-
class CDisplayWindow;
class CReadDisplay;
+class CReadWindow;
class CWriteDisplay;
-
+class CWriteWindow;
class QMenu;
/** The base class for all display widgets.
diff --git a/src/frontend/display/chtmlwritedisplay.cpp b/src/frontend/display/chtmlwritedisplay.cpp
index d238b0d..4d08666 100644
--- a/src/frontend/display/chtmlwritedisplay.cpp
+++ b/src/frontend/display/chtmlwritedisplay.cpp
@@ -7,22 +7,20 @@
*
**********/
+#include "frontend/display/chtmlwritedisplay.h"
-
-#include "chtmlwritedisplay.h"
-#include "btfontsizewidget.h"
-#include "btcolorwidget.h"
-#include "frontend/displaywindow/cwritewindow.h"
-#include "frontend/displaywindow/btactioncollection.h"
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-
-#include <QMenu>
-#include <QToolTip>
-#include <QTextEdit>
#include <QFontComboBox>
#include <QMenu>
+#include <QTextEdit>
#include <QToolBar>
+#include <QToolTip>
+#include "frontend/display/btcolorwidget.h"
+#include "frontend/display/btfontsizewidget.h"
+#include "frontend/displaywindow/btactioncollection.h"
+#include "frontend/displaywindow/cwritewindow.h"
+#include "util/cresmgr.h"
+#include "util/directory.h"
+
class BtActionCollection;
@@ -137,6 +135,8 @@ void CHTMLWriteDisplay::slotFontFamilyChoosen(const QFont& font) {
}
void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * actions) {
+ namespace DU = util::directory;
+
//--------------------font chooser-------------------------
m_fontFamilyChooser = new QFontComboBox(this);
actions->addAction(CResMgr::displaywindows::writeWindow::fontFamily::actionName, m_fontFamilyChooser);
@@ -164,7 +164,7 @@ void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * action
//--------------------bold toggle-------------------------
m_actions.bold = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::boldText::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::boldText::icon),
tr("Bold"),
actions);
m_actions.bold->setCheckable(true);
@@ -177,7 +177,7 @@ void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * action
//--------------------italic toggle-------------------------
m_actions.italic = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::italicText::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::italicText::icon),
tr("Italic"),
actions );
m_actions.italic->setCheckable(true);
@@ -189,7 +189,7 @@ void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * action
//--------------------underline toggle-------------------------
m_actions.underline = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::underlinedText::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::underlinedText::icon),
tr("Underline"),
actions );
m_actions.underline->setCheckable(true);
@@ -204,7 +204,7 @@ void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * action
//--------------------align left toggle-------------------------
m_actions.alignLeft = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignLeft::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::alignLeft::icon),
tr("Left"), actions);
m_actions.alignLeft->setCheckable(true);
m_actions.alignLeft->setShortcut(CResMgr::displaywindows::writeWindow::alignLeft::accel);
@@ -215,7 +215,7 @@ void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * action
//--------------------align center toggle-------------------------
m_actions.alignCenter = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignCenter::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::alignCenter::icon),
tr("Center"), actions);
m_actions.alignCenter->setCheckable(true);
m_actions.alignCenter->setShortcut(CResMgr::displaywindows::writeWindow::alignCenter::accel);
@@ -226,7 +226,7 @@ void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * action
//--------------------align right toggle-------------------------
m_actions.alignRight = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignRight::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::alignRight::icon),
tr("Right"), actions);
m_actions.alignRight->setCheckable(true);
m_actions.alignRight->setShortcut(CResMgr::displaywindows::writeWindow::alignRight::accel);
diff --git a/src/frontend/display/chtmlwritedisplay.h b/src/frontend/display/chtmlwritedisplay.h
index 5ea7527..56f3f53 100644
--- a/src/frontend/display/chtmlwritedisplay.h
+++ b/src/frontend/display/chtmlwritedisplay.h
@@ -10,18 +10,18 @@
#ifndef CHTMLWRITEDISPLAY_H
#define CHTMLWRITEDISPLAY_H
-//BibleTime includes
-#include "cplainwritedisplay.h"
+#include "frontend/display/cplainwritedisplay.h"
+
+class BtActionCollection;
+class BtColorWidget;
+class BtFontSizeWidget;
class CWriteWindow;
-class QMenu;
-class QWidget;
-class QToolBar;
class QAction;
class QFontComboBox;
-class BtFontSizeWidget;
-class BtColorWidget;
-class BtActionCollection;
+class QMenu;
+class QToolBar;
+class QWidget;
/** The WYSIWYG implementation of the write display interface.
* @author The BibleTime team
diff --git a/src/frontend/display/cplainwritedisplay.cpp b/src/frontend/display/cplainwritedisplay.cpp
index ff70c0a..720aa72 100644
--- a/src/frontend/display/cplainwritedisplay.cpp
+++ b/src/frontend/display/cplainwritedisplay.cpp
@@ -7,21 +7,20 @@
*
**********/
-#include "cplainwritedisplay.h"
-#include "frontend/displaywindow/btactioncollection.h"
-#include "frontend/cdragdrop.h"
-#include "frontend/displaywindow/cdisplaywindow.h"
-#include "frontend/displaywindow/cwritewindow.h"
-
-#include "backend/keys/cswordkey.h"
+#include "frontend/display/cplainwritedisplay.h"
#include <boost/scoped_ptr.hpp>
-
-//Qt includes
#include <QDragEnterEvent>
-#include <QDropEvent>
#include <QDragMoveEvent>
+#include <QDropEvent>
#include <QMenu>
+#include <QDebug>
+
+#include "backend/keys/cswordkey.h"
+#include "frontend/cdragdrop.h"
+#include "frontend/displaywindow/btactioncollection.h"
+#include "frontend/displaywindow/cdisplaywindow.h"
+#include "frontend/displaywindow/cwritewindow.h"
CPlainWriteDisplay::CPlainWriteDisplay(CWriteWindow* parentWindow, QWidget* parent) : QTextEdit(parentWindow ? parentWindow : parent), CWriteDisplay(parentWindow) {
@@ -50,12 +49,12 @@ void CPlainWriteDisplay::setText( const QString& newText ) {
}
bool CPlainWriteDisplay::hasSelection() {
- //TODO: test this
+ /// \todo test this
return textCursor().hasSelection();
}
QWidget* CPlainWriteDisplay::view() {
- qDebug("CPlainWriteDisplay::view()");
+ qDebug() << "CPlainWriteDisplay::view()";
return this;
}
@@ -128,11 +127,11 @@ void CPlainWriteDisplay::dragMoveEvent( QDragMoveEvent* e ) {
/** Reimplementation to manage drops of our drag and drop objects. */
void CPlainWriteDisplay::dropEvent( QDropEvent* e ) {
- //qDebug("CPlainWriteDisplay::dropEvent");
+ //qDebug() << "CPlainWriteDisplay::dropEvent";
const BTMimeData* mimedata = qobject_cast<const BTMimeData*>(e->mimeData());
if ( mimedata && mimedata->hasFormat("BibleTime/Bookmark") ) {
- //qDebug("format was bookmark");
+ //qDebug() << "format was bookmark";
e->acceptProposedAction();
BTMimeData::ItemList items = mimedata->bookmarks();
@@ -151,7 +150,7 @@ void CPlainWriteDisplay::dropEvent( QDropEvent* e ) {
}
}
else if ( e->mimeData()->hasFormat("text/plain")) {
- //qDebug("format was plain text");
+ //qDebug() << "format was plain text";
e->acceptProposedAction();
setTextCursor(cursorForPosition(e->pos()));
textCursor().insertText( e->mimeData()->text() );
diff --git a/src/frontend/display/cplainwritedisplay.h b/src/frontend/display/cplainwritedisplay.h
index 3968f74..30efc72 100644
--- a/src/frontend/display/cplainwritedisplay.h
+++ b/src/frontend/display/cplainwritedisplay.h
@@ -7,26 +7,20 @@
*
**********/
-
-
#ifndef CPLAINWRITEDISPLAY_H
#define CPLAINWRITEDISPLAY_H
-//Bibletime include files
-#include "cwritedisplay.h"
-
-//Qt includes
#include <QTextEdit>
+#include "frontend/display/cwritedisplay.h"
+class BtActionCollection;
class CHTMLWriteDisplay;
-
-class QWidget;
-class QMenu;
+class QDragEnterEvent;
class QDragMoveEvent;
class QDropEvent;
-class QDragEnterEvent;
-class BtActionCollection;
+class QMenu;
+class QWidget;
/** The write display implementation for plain source code editing.
* @author The BibleTime team
diff --git a/src/frontend/display/creaddisplay.cpp b/src/frontend/display/creaddisplay.cpp
index afe00cd..de0680b 100644
--- a/src/frontend/display/creaddisplay.cpp
+++ b/src/frontend/display/creaddisplay.cpp
@@ -7,29 +7,20 @@
*
**********/
+#include "frontend/display/creaddisplay.h"
-
-//BibleTime includes
-#include "creaddisplay.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
#include "backend/drivers/cswordbiblemoduleinfo.h"
-#include "backend/drivers/cswordlexiconmoduleinfo.h"
#include "backend/drivers/cswordbookmoduleinfo.h"
+#include "backend/drivers/cswordlexiconmoduleinfo.h"
+#include "backend/drivers/cswordmoduleinfo.h"
#include "backend/keys/cswordkey.h"
-#include "backend/keys/cswordversekey.h"
-#include "backend/keys/cswordtreekey.h"
#include "backend/keys/cswordldkey.h"
-
+#include "backend/keys/cswordtreekey.h"
+#include "backend/keys/cswordversekey.h"
+#include "frontend/cexportmanager.h"
#include "frontend/displaywindow/cdisplaywindow.h"
#include "frontend/displaywindow/creadwindow.h"
-#include "frontend/cexportmanager.h"
-
-#include <boost/scoped_ptr.hpp>
-
-//KDE includes
-
CReadDisplay::CReadDisplay(CReadWindow* readWindow) :
CDisplay(readWindow),
diff --git a/src/frontend/display/creaddisplay.h b/src/frontend/display/creaddisplay.h
index c94bd41..57524b5 100644
--- a/src/frontend/display/creaddisplay.h
+++ b/src/frontend/display/creaddisplay.h
@@ -7,20 +7,18 @@
*
**********/
-
-
#ifndef CREADDISPLAY_H
#define CREADDISPLAY_H
-#include "cdisplay.h"
-#include "backend/managers/cswordbackend.h"
+#include "frontend/display/cdisplay.h"
#include <QString>
+#include "backend/managers/cswordbackend.h"
+
-/**The base class for all read-only widgets like KHTMLView.
+/** The base class for all read-only widgets like KHTMLView.
*@author The BibleTime team
*/
-
class CReadDisplay : public CDisplay {
public:
/**
diff --git a/src/frontend/display/cwritedisplay.cpp b/src/frontend/display/cwritedisplay.cpp
index ddd9d8f..f30d217 100644
--- a/src/frontend/display/cwritedisplay.cpp
+++ b/src/frontend/display/cwritedisplay.cpp
@@ -7,15 +7,15 @@
*
**********/
-
-
-//BibleTime includes
-#include "cwritedisplay.h"
+#include "frontend/display/cwritedisplay.h"
#include "frontend/displaywindow/cwritewindow.h"
-CWriteDisplay::CWriteDisplay( CWriteWindow* writeWindow ) : CDisplay(writeWindow) {}
-
-CWriteDisplay::~CWriteDisplay() {}
+CWriteDisplay::CWriteDisplay( CWriteWindow* writeWindow ) : CDisplay(writeWindow) {
+ // Intentionally empty
+}
+CWriteDisplay::~CWriteDisplay() {
+ // Intentionally empty
+}
diff --git a/src/frontend/display/cwritedisplay.h b/src/frontend/display/cwritedisplay.h
index 24dd29f..33ef5a5 100644
--- a/src/frontend/display/cwritedisplay.h
+++ b/src/frontend/display/cwritedisplay.h
@@ -7,21 +7,18 @@
*
**********/
-
-
#ifndef CWRITEDISPLAY_H
#define CWRITEDISPLAY_H
-#include "cdisplay.h"
+#include "frontend/display/cdisplay.h"
-class QToolBar;
-class BtActionCollection;
+class BtActionCollection;
+class QToolBar;
-/**The base class for all read/write-display classes.
+/** The base class for all read/write-display classes.
*@author The BibleTime team
*/
-
class CWriteDisplay : public CDisplay {
protected:
friend class CDisplay;
diff --git a/src/frontend/displaywindow/btactioncollection.cpp b/src/frontend/displaywindow/btactioncollection.cpp
index c9d5dd8..f1956d5 100644
--- a/src/frontend/displaywindow/btactioncollection.cpp
+++ b/src/frontend/displaywindow/btactioncollection.cpp
@@ -7,15 +7,17 @@
*
**********/
-#include "util/directoryutil.h"
-#include "backend/config/cbtconfig.h"
-#include "btactioncollection.h"
+#include "frontend/displaywindow/btactioncollection.h"
+
#include <QAction>
+#include <QDebug>
#include <QKeySequence>
#include <QSettings>
#include <QString>
#include <QStringList>
-#include <QDebug>
+#include "backend/config/cbtconfig.h"
+#include "util/directory.h"
+
class BtActionItem : public QObject {
public:
@@ -54,7 +56,7 @@ QAction* BtActionCollection::action(const QString& name) {
QAction* BtActionCollection::addAction(const QString& name, QAction* action) {
Q_ASSERT(action != 0);
- Q_ASSERT(m_actions[name] == 0); // TODO - replacing actions is ok???
+ Q_ASSERT(m_actions[name] == 0); /// \todo replacing actions is ok???
int count;
count = m_actions.count();
BtActionItem* item = new BtActionItem(this);
diff --git a/src/frontend/displaywindow/btactioncollection.h b/src/frontend/displaywindow/btactioncollection.h
index 4dde538..9a02958 100644
--- a/src/frontend/displaywindow/btactioncollection.h
+++ b/src/frontend/displaywindow/btactioncollection.h
@@ -6,18 +6,20 @@
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
+
#ifndef BT_ACTION_COLLECTION_H
#define BT_ACTION_COLLECTION_H
-#include <QMap>
-
#include <QObject>
+
#include <QList>
+#include <QMap>
-class QString;
+
+class BtActionItem;
class QAction;
class QKeySequence;
-class BtActionItem;
+class QString;
class BtActionCollection : public QObject {
Q_OBJECT
diff --git a/src/frontend/displaywindow/bttoolbarpopupaction.cpp b/src/frontend/displaywindow/bttoolbarpopupaction.cpp
index 5a7fd8c..49b145e 100644
--- a/src/frontend/displaywindow/bttoolbarpopupaction.cpp
+++ b/src/frontend/displaywindow/bttoolbarpopupaction.cpp
@@ -7,11 +7,13 @@
*
**********/
-#include "bttoolbarpopupaction.h"
-#include <QMenu>
-#include <QToolButton>
+#include "frontend/displaywindow/bttoolbarpopupaction.h"
+
#include <QAction>
#include <QEvent>
+#include <QMenu>
+#include <QToolButton>
+
class BtToolButton : public QToolButton {
public:
diff --git a/src/frontend/displaywindow/bttoolbarpopupaction.h b/src/frontend/displaywindow/bttoolbarpopupaction.h
index 06eb660..202a006 100644
--- a/src/frontend/displaywindow/bttoolbarpopupaction.h
+++ b/src/frontend/displaywindow/bttoolbarpopupaction.h
@@ -6,14 +6,16 @@
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
+
#ifndef BT_TOOLBAR_POPUP_ACTION_H
#define BT_TOOLBAR_POPUP_ACTION_H
#include <QWidgetAction>
+
+class QIcon;
class QMenu;
class QString;
-class QIcon;
class QToolButton;
// This class manages the toolbar display for going forward and backward in history.
diff --git a/src/frontend/displaywindow/cbiblereadwindow.cpp b/src/frontend/displaywindow/cbiblereadwindow.cpp
index 2da6360..7b346f7 100644
--- a/src/frontend/displaywindow/cbiblereadwindow.cpp
+++ b/src/frontend/displaywindow/cbiblereadwindow.cpp
@@ -7,41 +7,39 @@
*
**********/
+#include "frontend/displaywindow/cbiblereadwindow.h"
-#include "cbiblereadwindow.h"
-#include "btactioncollection.h"
-#include "ccommentaryreadwindow.h"
-#include "cbuttons.h"
-#include "backend/keys/cswordversekey.h"
+#include <cmath>
+#include <QAction>
+#include <QApplication>
+#include <QEvent>
+#include <QMdiSubWindow>
+#include <QMenu>
+#include <QTimer>
+#include <QWidget>
+#include <QDebug>
+
+#include "backend/config/cbtconfig.h"
#include "backend/drivers/cswordbiblemoduleinfo.h"
-#include "frontend/profile/cprofilewindow.h"
+#include "backend/keys/cswordversekey.h"
#include "frontend/cexportmanager.h"
-#include "backend/config/cbtconfig.h"
#include "frontend/cmdiarea.h"
#include "frontend/display/creaddisplay.h"
+#include "frontend/displaywindow/btactioncollection.h"
+#include "frontend/displaywindow/ccommentaryreadwindow.h"
+#include "frontend/displaywindow/cbuttons.h"
#include "frontend/keychooser/ckeychooser.h"
-#include "util/ctoolclass.h"
+#include "frontend/profile/cprofilewindow.h"
+#include "util/directory.h"
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-
-#include <math.h>
+#include "util/tool.h"
-//Qt includes
-#include <QWidget>
-#include <QTimer>
-#include <QEvent>
-#include <QApplication>
-#include <QMenu>
-#include <QMdiSubWindow>
-#include <QAction>
-#include <QMenu>
-#include <QMenu>
using namespace Profile;
CBibleReadWindow::CBibleReadWindow(QList<CSwordModuleInfo*> moduleList, CMDIArea* parent)
: CLexiconReadWindow(moduleList, parent) {
- qDebug("CBibleReadWindow::CBibleReadWindow");
+ qDebug() << "CBibleReadWindow::CBibleReadWindow";
}
CBibleReadWindow::~CBibleReadWindow() {
@@ -135,11 +133,14 @@ void CBibleReadWindow::insertKeyboardActions( BtActionCollection* const a ) {
a->addAction( "copyReferenceWithText", qaction);
qaction = new QAction(tr("Reference with text"), a);
+ a->addAction("printReferenceWithText", qaction);
+
+ qaction = new QAction(tr("Reference with text"), a);
a->addAction("saveReferenceWithText", qaction);
}
void CBibleReadWindow::initActions() {
- qDebug("CBibleReadWindow::initActions");
+ qDebug() << "CBibleReadWindow::initActions";
BtActionCollection* ac = actionCollection();
@@ -214,7 +215,7 @@ void CBibleReadWindow::initActions() {
QObject::connect(m_actions.save.chapterAsHTML, SIGNAL(triggered()), this, SLOT(saveChapterHTML()) );
addAction(m_actions.save.chapterAsHTML);
- m_actions.print.reference = m_actionCollection->action("saveReferenceWithText");
+ m_actions.print.reference = m_actionCollection->action("printReferenceWithText");
QObject::connect(m_actions.print.reference, SIGNAL(triggered()), this, SLOT(printAnchorWithText()) );
addAction(m_actions.print.reference);
@@ -242,7 +243,7 @@ void CBibleReadWindow::initView() {
/** Reimplementation. */
void CBibleReadWindow::setupPopupMenu() {
popup()->setTitle(tr("Bible window"));
- popup()->setIcon(CToolClass::getIconForModule(modules().first()) );
+ popup()->setIcon(util::tool::getIconForModule(modules().first()) );
popup()->addAction(m_actions.findText);
QKeySequence ks = m_actions.findText->shortcut();
QString keys = ks.toString();
diff --git a/src/frontend/displaywindow/cbiblereadwindow.h b/src/frontend/displaywindow/cbiblereadwindow.h
index 3b779e2..11f0275 100644
--- a/src/frontend/displaywindow/cbiblereadwindow.h
+++ b/src/frontend/displaywindow/cbiblereadwindow.h
@@ -7,33 +7,24 @@
*
**********/
-
-
#ifndef CBIBLEREADWINDOW_H
#define CBIBLEREADWINDOW_H
-//BibleTime includes
-#include "clexiconreadwindow.h"
+#include "frontend/displaywindow/clexiconreadwindow.h"
-
-class CTransliterationButton;
+class BtActionCollection;
class CSwordKey;
class CSwordVerseKey;
-
-class BtActionCollection;
+class CTransliterationButton;
class QAction;
+class QEvent;
class QMenu;
-
class QObject;
-class QEvent;
-
-
-/**The read display window for Bibles.
+/** The read display window for Bibles.
*@author The BibleTime team
*/
-
class CBibleReadWindow : public CLexiconReadWindow {
Q_OBJECT
public:
diff --git a/src/frontend/displaywindow/cbookreadwindow.cpp b/src/frontend/displaywindow/cbookreadwindow.cpp
index 1865a98..d852eb3 100644
--- a/src/frontend/displaywindow/cbookreadwindow.cpp
+++ b/src/frontend/displaywindow/cbookreadwindow.cpp
@@ -7,23 +7,24 @@
*
**********/
-#include "cbookreadwindow.h"
-#include "bttoolbarpopupaction.h"
-#include "btactioncollection.h"
-#include "cmodulechooserbar.h"
-#include "cbuttons.h"
+#include "frontend/displaywindow/cbookreadwindow.h"
+
+#include <QAction>
+#include <QMenu>
+#include <QSplitter>
+#include <QToolBar>
+#include "backend/config/cbtconfig.h"
#include "backend/keys/cswordtreekey.h"
#include "frontend/display/cdisplay.h"
+#include "frontend/displaywindow/bttoolbarpopupaction.h"
+#include "frontend/displaywindow/btactioncollection.h"
+#include "frontend/displaywindow/cmodulechooserbar.h"
+#include "frontend/displaywindow/cbuttons.h"
#include "frontend/keychooser/cbooktreechooser.h"
#include "frontend/profile/cprofilewindow.h"
-#include "backend/config/cbtconfig.h"
-#include "util/ctoolclass.h"
#include "util/cresmgr.h"
+#include "util/tool.h"
-#include <QSplitter>
-#include <QToolBar>
-#include <QMenu>
-#include <QAction>
using namespace Profile;
@@ -114,7 +115,7 @@ void CBookReadWindow::initView() {
m_treeChooser->hide();
setCentralWidget( splitter );
- setWindowIcon(CToolClass::getIconForModule(modules().first()));
+ setWindowIcon(util::tool::getIconForModule(modules().first()));
}
void CBookReadWindow::initToolbars() {
diff --git a/src/frontend/displaywindow/cbookreadwindow.h b/src/frontend/displaywindow/cbookreadwindow.h
index 62d788d..b059aff 100644
--- a/src/frontend/displaywindow/cbookreadwindow.h
+++ b/src/frontend/displaywindow/cbookreadwindow.h
@@ -7,19 +7,15 @@
*
**********/
-
-
#ifndef CBOOKREADWINDOW_H
#define CBOOKREADWINDOW_H
-//BibleTime includes
-#include "clexiconreadwindow.h"
+#include "frontend/displaywindow/clexiconreadwindow.h"
-class QAction;
-class CBookTreeChooser;
class BtActionCollection;
-
+class CBookTreeChooser;
+class QAction;
/**
* @author The BibleTime team
diff --git a/src/frontend/displaywindow/cbuttons.cpp b/src/frontend/displaywindow/cbuttons.cpp
index fbe2443..46c262a 100644
--- a/src/frontend/displaywindow/cbuttons.cpp
+++ b/src/frontend/displaywindow/cbuttons.cpp
@@ -7,29 +7,24 @@
*
**********/
-//BibleTime includes
-#include "cbuttons.h"
+#include "frontend/displaywindow/cbuttons.h"
-#include "util/cresmgr.h"
-#include "util/cpointers.h"
-#include "util/directoryutil.h"
-
-//Qt includes
+#include <QHash>
+#include <QMenu>
#include <QString>
#include <QToolTip>
#include <QToolButton>
-#include <QHash>
-#include <QMenu>
-
-//KDE includes
-
-
+#include "util/directory.h"
+#include "util/cpointers.h"
+#include "util/cresmgr.h"
CDisplaySettingsButton::CDisplaySettingsButton(CSwordBackend::DisplayOptions *displaySettings, CSwordBackend::FilterOptions *moduleSettings, const QList<CSwordModuleInfo*>& useModules, QWidget *parent )
: QToolButton(parent) {
+ namespace DU = util::directory;
+
// qWarning("CDisplaySettingsButton::CDisplaySettingsButton");
- QToolButton::setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::displaySettings::icon));
+ QToolButton::setIcon(DU::getIcon(CResMgr::displaywindows::displaySettings::icon));
m_displaySettings = displaySettings;
m_moduleSettings = moduleSettings;
@@ -60,7 +55,6 @@ void CDisplaySettingsButton::reset(const QList<CSwordModuleInfo*>& useModules) {
void CDisplaySettingsButton::optionToggled(QAction* /*action*/) {
- qDebug("display settings option toggled");
//Take each Action and set the corresponding setting.
//Using QAction (QObject) property and OptionType enum is a dirty way to do this.
//See populateMenu().
@@ -187,5 +181,5 @@ bool CDisplaySettingsButton::itemStatus( const int index ) {
/** Sets the status to changed. The signal changed will be emitted. */
void CDisplaySettingsButton::setChanged() {
- emit sigChanged();
+ optionToggled(0);
}
diff --git a/src/frontend/displaywindow/cbuttons.h b/src/frontend/displaywindow/cbuttons.h
index 5f1d599..39dbbf9 100644
--- a/src/frontend/displaywindow/cbuttons.h
+++ b/src/frontend/displaywindow/cbuttons.h
@@ -7,19 +7,16 @@
*
**********/
-
-
#ifndef CBUTTONS_H
#define CBUTTONS_H
-//BibleTime includes
-#include "backend/managers/cswordbackend.h"
-class CSwordModuleInfo;
+#include <QToolButton>
-//QT includes
#include <QHash>
-#include <QToolButton>
+#include "backend/managers/cswordbackend.h"
+
+class CSwordModuleInfo;
class QMenu;
/** This class manages the display options of the selected modules.
diff --git a/src/frontend/displaywindow/ccommentaryreadwindow.cpp b/src/frontend/displaywindow/ccommentaryreadwindow.cpp
index fdd345e..4b4d3c2 100644
--- a/src/frontend/displaywindow/ccommentaryreadwindow.cpp
+++ b/src/frontend/displaywindow/ccommentaryreadwindow.cpp
@@ -7,23 +7,21 @@
*
**********/
-//BibleTime includes
-#include "ccommentaryreadwindow.h"
-#include "btactioncollection.h"
-#include "frontend/profile/cprofilewindow.h"
-#include "backend/config/cbtconfig.h"
-#include "frontend/keychooser/ckeychooser.h"
-#include "frontend/display/cdisplay.h"
-#include "frontend/display/creaddisplay.h"
-#include "backend/keys/cswordversekey.h"
-#include "util/ctoolclass.h"
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
+#include "frontend/displaywindow/ccommentaryreadwindow.h"
-#include <QMenu>
#include <QAction>
#include <QIcon>
+#include <QMenu>
#include <QToolBar>
+#include "backend/config/cbtconfig.h"
+#include "backend/keys/cswordversekey.h"
+#include "frontend/display/cdisplay.h"
+#include "frontend/display/creaddisplay.h"
+#include "frontend/displaywindow/btactioncollection.h"
+#include "frontend/keychooser/ckeychooser.h"
+#include "frontend/profile/cprofilewindow.h"
+#include "util/directory.h"
+#include "util/cresmgr.h"
using namespace Profile;
@@ -109,10 +107,12 @@ void CCommentaryReadWindow::storeProfileSettings( CProfileWindow* profileWindow
}
void CCommentaryReadWindow::initToolbars() {
+ namespace DU = util::directory;
+
CLexiconReadWindow::initToolbars();
m_syncButton = new QAction(
- QIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::commentaryWindow::syncWindow::icon)),
+ QIcon(DU::getIcon(CResMgr::displaywindows::commentaryWindow::syncWindow::icon)),
tr("Synchronize"),
actionCollection()
);
diff --git a/src/frontend/displaywindow/ccommentaryreadwindow.h b/src/frontend/displaywindow/ccommentaryreadwindow.h
index 21f4630..d75da67 100644
--- a/src/frontend/displaywindow/ccommentaryreadwindow.h
+++ b/src/frontend/displaywindow/ccommentaryreadwindow.h
@@ -7,21 +7,19 @@
*
**********/
-
#ifndef CCOMMENTARYREADWINDOW_H
#define CCOMMENTARYREADWINDOW_H
-//BibleTime includes
-#include "cbiblereadwindow.h"
+#include "frontend/displaywindow/cbiblereadwindow.h"
+
-class QAction;
-class CSwordVerseKey;
class BtActionCollection;
+class CSwordVerseKey;
+class QAction;
/**
*@author The BibleTime team
*/
-
class CCommentaryReadWindow : public CLexiconReadWindow {
Q_OBJECT
public:
diff --git a/src/frontend/displaywindow/cdisplaywindow.cpp b/src/frontend/displaywindow/cdisplaywindow.cpp
index 394e96b..4ba567a 100644
--- a/src/frontend/displaywindow/cdisplaywindow.cpp
+++ b/src/frontend/displaywindow/cdisplaywindow.cpp
@@ -7,27 +7,29 @@
*
**********/
-#include "cdisplaywindow.h"
-#include "bttoolbarpopupaction.h"
-#include "btactioncollection.h"
-#include "cmodulechooserbar.h"
-#include "cbuttons.h"
+#include "frontend/displaywindow/cdisplaywindow.h"
+
+#include <QCloseEvent>
+#include <QDebug>
+#include <QMenu>
+#include <QStringList>
+#include <QWidget>
+#include "backend/config/cbtconfig.h"
#include "backend/keys/cswordkey.h"
+#include "bibletime.h"
+#include "frontend/cmdiarea.h"
+#include "frontend/display/cdisplay.h"
+#include "frontend/displaywindow/bttoolbarpopupaction.h"
+#include "frontend/displaywindow/btactioncollection.h"
+#include "frontend/displaywindow/cmodulechooserbar.h"
+#include "frontend/displaywindow/cbuttons.h"
#include "frontend/keychooser/ckeychooser.h"
#include "frontend/keychooser/bthistory.h"
-#include "frontend/display/cdisplay.h"
-#include "frontend/cmdiarea.h"
#include "frontend/profile/cprofilewindow.h"
-#include "backend/config/cbtconfig.h"
#include "frontend/searchdialog/csearchdialog.h"
+#include "util/directory.h"
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-#include <QWidget>
-#include <QCloseEvent>
-#include <QStringList>
-#include <QDebug>
-#include <QMenu>
using namespace Profile;
@@ -44,7 +46,7 @@ CDisplayWindow::CDisplayWindow(QList<CSwordModuleInfo*> modules, CMDIArea *paren
m_mainToolBar(0),
m_popupMenu(0),
m_displayWidget(0) {
- qDebug("CDisplayWindow::CDisplayWindow");
+ qDebug() << "CDisplayWindow::CDisplayWindow";
setAttribute(Qt::WA_DeleteOnClose); //we want to destroy this window when it is closed
parent->addSubWindow(this);
m_actionCollection = new BtActionCollection(this);
@@ -86,13 +88,9 @@ QList<CSwordModuleInfo*> CDisplayWindow::modules() {
return mods;
}
-/** Set the window caption. */
-void CDisplayWindow::setCaption( const QString& ) {
- QWidget::setWindowTitle( windowCaption() );
- m_mdi->emitWindowCaptionChanged();
-}
-
void CDisplayWindow::insertKeyboardActions( BtActionCollection* a ) {
+ namespace DU = util::directory;
+
qDebug() << "CDisplayWindow::insertKeyboardActions: ac: " << a;
QAction* actn = new QAction(QIcon(), tr("Zoom in"), a);
@@ -123,13 +121,13 @@ void CDisplayWindow::insertKeyboardActions( BtActionCollection* a ) {
actn->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
a->addAction("openLocation", actn);
- actn = new QAction(QIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::general::search::icon)),
+ actn = new QAction(QIcon(DU::getIcon(CResMgr::displaywindows::general::search::icon)),
tr("Search with works of this window"), a);
actn->setShortcut(CResMgr::displaywindows::general::search::accel);
a->addAction(CResMgr::displaywindows::general::search::actionName, actn);
BtToolBarPopupAction* action = new BtToolBarPopupAction(
- QIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::general::backInHistory::icon)),
+ QIcon(DU::getIcon(CResMgr::displaywindows::general::backInHistory::icon)),
tr("Back in history"),
a
);
@@ -137,7 +135,7 @@ void CDisplayWindow::insertKeyboardActions( BtActionCollection* a ) {
a->addAction(CResMgr::displaywindows::general::backInHistory::actionName, action);
action = new BtToolBarPopupAction(
- QIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::general::forwardInHistory::icon)),
+ QIcon(DU::getIcon(CResMgr::displaywindows::general::forwardInHistory::icon)),
tr("Forward in history"),
a
);
@@ -146,7 +144,7 @@ void CDisplayWindow::insertKeyboardActions( BtActionCollection* a ) {
}
void CDisplayWindow::initActions() {
- qDebug("CDisplayWindow::initActions");
+ qDebug() << "CDisplayWindow::initActions";
BtActionCollection* ac = actionCollection();
@@ -320,7 +318,7 @@ void CDisplayWindow::setModuleChooserBar( CModuleChooserBar* bar ) {
/** Sets the modules. */
void CDisplayWindow::setModules( const QList<CSwordModuleInfo*>& newModules ) {
- qDebug("CDisplayWindow::setModules");
+ qDebug() << "CDisplayWindow::setModules";
m_modules.clear();
foreach (CSwordModuleInfo* mod, newModules) {
@@ -330,11 +328,11 @@ void CDisplayWindow::setModules( const QList<CSwordModuleInfo*>& newModules ) {
/** Initialize the window. Call this method from the outside, because calling this in the constructor is not possible! */
bool CDisplayWindow::init() {
- qDebug("CDisplayWindow::init");
+ qDebug() << "CDisplayWindow::init";
initView();
setMinimumSize( 100, 100 );
- setCaption(windowCaption());
+ setWindowTitle(windowCaption());
//setup focus stuff.
setFocusPolicy(Qt::ClickFocus);
parentWidget()->setFocusPolicy(Qt::ClickFocus);
@@ -403,7 +401,7 @@ void CDisplayWindow::lookupModKey( const QString& moduleName, const QString& key
return;
}
- //ToDo: check for containsRef compat
+ /// \todo check for containsRef compat
if (m && modules().contains(m)) {
key()->key(keyName);
keyChooser()->setKey(key()); //the key chooser does send an update signal
@@ -413,7 +411,10 @@ void CDisplayWindow::lookupModKey( const QString& moduleName, const QString& key
//create a new window for the given module
QList<CSwordModuleInfo*> mList;
mList.append(m);
- mdi()->emitCreateDisplayWindow(mList, keyName);
+
+ Q_ASSERT(qobject_cast<BibleTime*>(mdi()->parent()) != 0);
+ BibleTime *mainWindow(static_cast<BibleTime*>(mdi()->parent()));
+ mainWindow->createReadDisplayWindow(mList, keyName);
}
}
diff --git a/src/frontend/displaywindow/cdisplaywindow.h b/src/frontend/displaywindow/cdisplaywindow.h
index 5a32f9f..6164e94 100644
--- a/src/frontend/displaywindow/cdisplaywindow.h
+++ b/src/frontend/displaywindow/cdisplaywindow.h
@@ -10,35 +10,30 @@
#ifndef CDISPLAYWINDOW_H
#define CDISPLAYWINDOW_H
-//BibleTime includes
+#include <QMainWindow>
#include "util/cpointers.h"
-class CSwordModuleInfo;
+
+#include <QStringList>
#include "backend/managers/cswordbackend.h"
#include "frontend/profile/cprofilewindow.h"
-//Qt includes
-#include <QStringList>
-#include <QMainWindow>
-//Forward declarations
-class CMDIArea;
-class CReadWindow;
-class CWriteWindow;
-class CDisplaySettingsButton;
+class BtActionCollection;
class CDisplay;
+class CDisplaySettingsButton;
class CKeyChooser;
+class CMDIArea;
class CModuleChooserBar;
-class QCloseEvent;
-
-class QToolBar;
+class CReadWindow;
+class CSwordModuleInfo;
+class CWriteWindow;
class QCloseEvent;
class QMenu;
-class BtActionCollection;
+class QToolBar;
/** The base class for all display windows of BibleTime.
* @author The BibleTime team
*/
-
class CDisplayWindow : public QMainWindow, public CPointers {
Q_OBJECT
public:
@@ -64,9 +59,6 @@ class CDisplayWindow : public QMainWindow, public CPointers {
// Store the settings of this window in the given profile window.
virtual void applyProfileSettings( Profile::CProfileWindow* profileWindow ) = 0;
- // Set the window caption.
- virtual void setCaption( const QString& );
-
// Sets the new filter options of this window.
void setFilterOptions( CSwordBackend::FilterOptions& filterOptions );
diff --git a/src/frontend/displaywindow/cdisplaywindowfactory.cpp b/src/frontend/displaywindow/cdisplaywindowfactory.cpp
index 6581ffd..05fa963 100644
--- a/src/frontend/displaywindow/cdisplaywindowfactory.cpp
+++ b/src/frontend/displaywindow/cdisplaywindowfactory.cpp
@@ -1,32 +1,30 @@
-//
-// C++ Implementation: cdisplaywindowfactory
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-#include "cdisplaywindowfactory.h"
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
-#include "creadwindow.h"
-#include "cbiblereadwindow.h"
-#include "ccommentaryreadwindow.h"
-#include "clexiconreadwindow.h"
-#include "cbookreadwindow.h"
-#include "cwritewindow.h"
-#include "cplainwritewindow.h"
-#include "chtmlwritewindow.h"
+#include "frontend/displaywindow/cdisplaywindowfactory.h"
+#include <QDebug>
#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/displaywindow/cbiblereadwindow.h"
+#include "frontend/displaywindow/cbookreadwindow.h"
+#include "frontend/displaywindow/ccommentaryreadwindow.h"
+#include "frontend/displaywindow/chtmlwritewindow.h"
+#include "frontend/displaywindow/clexiconreadwindow.h"
+#include "frontend/displaywindow/cplainwritewindow.h"
+#include "frontend/displaywindow/creadwindow.h"
+#include "frontend/displaywindow/cwritewindow.h"
#include "frontend/cmdiarea.h"
CReadWindow* CDisplayWindowFactory::createReadInstance(QList<CSwordModuleInfo*> modules, CMDIArea* parent) {
- qDebug("CDisplayWindowFactory::createReadInstance");
+ qDebug() << "CDisplayWindowFactory::createReadInstance";
switch (modules.first()->type()) {
case CSwordModuleInfo::Bible:
return new CBibleReadWindow(modules, parent);
@@ -43,7 +41,6 @@ CReadWindow* CDisplayWindowFactory::createReadInstance(QList<CSwordModuleInfo*>
return 0;
}
-
CWriteWindow* CDisplayWindowFactory::createWriteInstance(QList<CSwordModuleInfo*> modules, CMDIArea* parent, const CDisplayWindow::WriteWindowType type) {
if (type == CDisplayWindow::HTMLWindow) {
return new CHTMLWriteWindow(modules, parent);
diff --git a/src/frontend/displaywindow/cdisplaywindowfactory.h b/src/frontend/displaywindow/cdisplaywindowfactory.h
index d8bf2a9..b4d856a 100644
--- a/src/frontend/displaywindow/cdisplaywindowfactory.h
+++ b/src/frontend/displaywindow/cdisplaywindowfactory.h
@@ -1,26 +1,24 @@
-//
-// C++ Interface: cdisplaywindowfactory
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
#ifndef CDISPLAYWINDOWFACTORY_H
#define CDISPLAYWINDOWFACTORY_H
-#include "cdisplaywindow.h"
-
-class CSwordModuleInfo;
+#include "frontend/displaywindow/cdisplaywindow.h"
+class CMDIArea;
class CReadWindow;
+class CSwordModuleInfo;
class CWriteWindow;
-class CMDIArea;
+/// \todo Make CDisplayWindowFactory a namespace instead?
class CDisplayWindowFactory {
public:
static CReadWindow* createReadInstance(QList<CSwordModuleInfo*> modules, CMDIArea* parent);
diff --git a/src/frontend/displaywindow/chtmlwritewindow.cpp b/src/frontend/displaywindow/chtmlwritewindow.cpp
index df4018e..31cb92b 100644
--- a/src/frontend/displaywindow/chtmlwritewindow.cpp
+++ b/src/frontend/displaywindow/chtmlwritewindow.cpp
@@ -7,26 +7,20 @@
*
**********/
+#include "frontend/displaywindow/chtmlwritewindow.h"
-
-#include "chtmlwritewindow.h"
-#include "btactioncollection.h"
-
-//frontend includes
+#include <QAction>
+#include <QToolBar>
+#include "backend/keys/cswordkey.h"
+#include "frontend/display/chtmlwritedisplay.h"
+#include "frontend/display/cwritedisplay.h"
+#include "frontend/displaywindow/btactioncollection.h"
#include "frontend/keychooser/ckeychooser.h"
#include "frontend/profile/cprofilewindow.h"
-#include "frontend/display/cwritedisplay.h"
-#include "frontend/display/chtmlwritedisplay.h"
-
-#include "backend/keys/cswordkey.h"
-
+#include "util/directory.h"
+#include "util/dialogutil.h"
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-//Qt includes
-#include <QToolBar>
-#include <QMessageBox>
-#include <QAction>
using namespace Profile;
@@ -58,9 +52,11 @@ void CHTMLWriteWindow::initConnections() {
}
void CHTMLWriteWindow::initToolbars() {
+ namespace DU = util::directory;
+
//setup the main toolbar
m_actions.syncWindow = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::commentaryWindow::syncWindow::icon),
+ DU::getIcon(CResMgr::displaywindows::commentaryWindow::syncWindow::icon),
tr("Sync with active Bible"),
actionCollection()
);
@@ -71,7 +67,7 @@ void CHTMLWriteWindow::initToolbars() {
mainToolBar()->addAction(m_actions.syncWindow);
m_actions.saveText = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::saveText::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::saveText::icon),
tr("Save text"),
actionCollection()
);
@@ -83,7 +79,7 @@ void CHTMLWriteWindow::initToolbars() {
m_actions.deleteEntry = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::deleteEntry::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::deleteEntry::icon),
tr("Delete current entry"),
actionCollection()
);
@@ -94,7 +90,7 @@ void CHTMLWriteWindow::initToolbars() {
mainToolBar()->addAction(m_actions.deleteEntry);
m_actions.restoreText = new QAction(
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::restoreText::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::restoreText::icon),
tr("Restore original text"),
actionCollection()
);
@@ -159,9 +155,9 @@ void CHTMLWriteWindow::saveCurrentText( const QString& /*key*/ ) {
textChanged();
}
else {
- QMessageBox::critical( this, tr("Module not writable"),
- QString::fromLatin1("<qt><b>%1</b><br />%2</qt>")
- .arg( tr("Module is not writable.") )
- .arg( tr("Either the module may not be edited, or you do not have write permission.") ) );
+ util::showCritical( this, tr("Module not writable"),
+ QString::fromLatin1("<qt><b>%1</b><br />%2</qt>")
+ .arg( tr("Module is not writable.") )
+ .arg( tr("Either the module may not be edited, or you do not have write permission.") ) );
}
}
diff --git a/src/frontend/displaywindow/chtmlwritewindow.h b/src/frontend/displaywindow/chtmlwritewindow.h
index 452a362..4d140cf 100644
--- a/src/frontend/displaywindow/chtmlwritewindow.h
+++ b/src/frontend/displaywindow/chtmlwritewindow.h
@@ -7,16 +7,13 @@
*
**********/
-
-
#ifndef CHTMLWRITEWINDOW_H
#define CHTMLWRITEWINDOW_H
-//BibleTime includes
-#include "cplainwritewindow.h"
+#include "frontend/displaywindow/cplainwritewindow.h"
-class QAction;
+class QAction;
/** The WYSIWYG implementation of the editor.
* @author The BibleTime team
@@ -38,7 +35,7 @@ class CHTMLWriteWindow : public CPlainWriteWindow {
virtual bool syncAllowed() const;
- protected: // Protected methods
+ protected:
/**
* Initialize the state of this widget.
*/
@@ -47,7 +44,7 @@ class CHTMLWriteWindow : public CPlainWriteWindow {
virtual void initToolbars();
virtual CDisplayWindow::WriteWindowType writeWindowType() {
return CDisplayWindow::HTMLWindow;
- };
+ }
protected slots:
/**
diff --git a/src/frontend/displaywindow/clexiconreadwindow.cpp b/src/frontend/displaywindow/clexiconreadwindow.cpp
index d06578e..2a5fb40 100644
--- a/src/frontend/displaywindow/clexiconreadwindow.cpp
+++ b/src/frontend/displaywindow/clexiconreadwindow.cpp
@@ -7,34 +7,36 @@
*
**********/
-//BibleTime includes
-#include "clexiconreadwindow.h"
-#include "btactioncollection.h"
-#include "cmodulechooserbar.h"
-#include "cbuttons.h"
-#include "bttoolbarpopupaction.h"
-#include "backend/keys/cswordkey.h"
-#include "backend/keys/cswordldkey.h"
+#include "frontend/displaywindow/clexiconreadwindow.h"
+
+#include <QAction>
+#include <QApplication>
+#include <QFile>
+#include <QFileDialog>
+#include <QMenu>
+#include <QDebug>
+
#include "backend/config/cbtconfig.h"
+#include "backend/keys/cswordldkey.h"
+#include "backend/keys/cswordkey.h"
#include "frontend/cexportmanager.h"
+#include "frontend/display/bthtmlreaddisplay.h"
#include "frontend/display/cdisplay.h"
#include "frontend/display/creaddisplay.h"
-#include "frontend/display/bthtmlreaddisplay.h"
-#include "frontend/keychooser/ckeychooser.h"
+#include "frontend/displaywindow/btactioncollection.h"
+#include "frontend/displaywindow/bttoolbarpopupaction.h"
+#include "frontend/displaywindow/cbuttons.h"
+#include "frontend/displaywindow/cmodulechooserbar.h"
#include "frontend/keychooser/bthistory.h"
-#include "util/ctoolclass.h"
+#include "frontend/keychooser/ckeychooser.h"
+#include "util/directory.h"
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
+#include "util/tool.h"
-#include <QMenu>
-#include <QApplication>
-#include <QFile>
-#include <QFileDialog>
-#include <QAction>
CLexiconReadWindow::CLexiconReadWindow(QList<CSwordModuleInfo*> moduleList, CMDIArea* parent)
: CReadWindow(moduleList, parent) {
- qDebug("CLexiconReadWindow::CLexiconReadWindow");
+ qDebug() << "CLexiconReadWindow::CLexiconReadWindow";
moduleList.first();
setKey( CSwordKey::createInstance(moduleList.first()) );
}
@@ -43,7 +45,7 @@ CLexiconReadWindow::~CLexiconReadWindow() {
}
void CLexiconReadWindow::insertKeyboardActions( BtActionCollection* const a ) {
- qDebug("CLexiconReadWindow::insertKeyboardActions");
+ qDebug() << "CLexiconReadWindow::insertKeyboardActions";
QAction* qaction;
qaction = new QAction( tr("Next entry"), a);
qaction->setShortcut(CResMgr::displaywindows::lexiconWindow::nextEntry::accel);
@@ -77,7 +79,7 @@ void CLexiconReadWindow::insertKeyboardActions( BtActionCollection* const a ) {
}
void CLexiconReadWindow::initActions() {
- qDebug("CLexiconReadWindow::initActions");
+ qDebug() << "CLexiconReadWindow::initActions";
BtActionCollection* ac = actionCollection();
CReadWindow::initActions();
@@ -141,13 +143,13 @@ void CLexiconReadWindow::initActions() {
addAction(m_actions.print.entry);
// init with the user defined settings
- qDebug("call CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac); and end CLexiconReadWindow::initActions");
+ qDebug() << "call CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac); and end CLexiconReadWindow::initActions";
CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac);
}
/** No descriptions */
void CLexiconReadWindow::initConnections() {
- qDebug("CLexiconReadWindow::initConnections");
+ qDebug() << "CLexiconReadWindow::initConnections";
Q_ASSERT(keyChooser());
connect(keyChooser(), SIGNAL(keyChanged(CSwordKey*)), this, SLOT(lookupSwordKey(CSwordKey*)));
@@ -178,7 +180,7 @@ void CLexiconReadWindow::initConnections() {
}
void CLexiconReadWindow::initView() {
- qDebug("CLexiconReadWindow::initView");
+ qDebug() << "CLexiconReadWindow::initView";
setDisplayWidget( CDisplay::createReadInstance(this) );
setMainToolBar( new QToolBar(this) );
mainToolBar()->setAllowedAreas(Qt::TopToolBarArea);
@@ -193,7 +195,7 @@ void CLexiconReadWindow::initView() {
buttonsToolBar()->setAllowedAreas(Qt::TopToolBarArea);
buttonsToolBar()->setFloatable(false);
addToolBar(buttonsToolBar());
- setWindowIcon(CToolClass::getIconForModule(modules().first()));
+ setWindowIcon(util::tool::getIconForModule(modules().first()));
setCentralWidget( displayWidget()->view() );
}
@@ -212,13 +214,13 @@ void CLexiconReadWindow::initToolbars() {
}
setDisplaySettingsButton( new CDisplaySettingsButton( &displayOptions(), &filterOptions(), modules(), buttonsToolBar()) );
- //TODO: find the right place for the button
+ /// \todo find the right place for the button
buttonsToolBar()->addWidget(displaySettingsButton());
}
void CLexiconReadWindow::setupPopupMenu() {
popup()->setTitle(tr("Lexicon window"));
- popup()->setIcon(CToolClass::getIconForModule(modules().first()));
+ popup()->setIcon(util::tool::getIconForModule(modules().first()));
popup()->addAction(m_actions.findText);
popup()->addAction(m_actions.findStrongs);
popup()->addAction(m_actions.selectAll);
@@ -298,14 +300,14 @@ void CLexiconReadWindow::saveAsHTML() {
/** Saving the raw HTML for debugging purposes */
void CLexiconReadWindow::saveRawHTML() {
- //qDebug("CLexiconReadWindow::saveRawHTML");
+ //qDebug() << "CLexiconReadWindow::saveRawHTML";
QString savefilename = QFileDialog::getSaveFileName();
if (savefilename.isEmpty()) return;
QFile file(savefilename);
BtHtmlReadDisplay* disp = dynamic_cast<BtHtmlReadDisplay*>(displayWidget());
if (disp) {
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- qDebug("could not open file");
+ qDebug() << "could not open file";
return;
}
QString source = disp->text();
@@ -315,7 +317,7 @@ void CLexiconReadWindow::saveRawHTML() {
file.flush();
}
else {
- qDebug("No htmlreaddisplay widget!");
+ qDebug() << "No htmlreaddisplay widget!";
}
}
@@ -327,12 +329,12 @@ void CLexiconReadWindow::saveAsPlain() {
}
void CLexiconReadWindow::slotFillBackHistory() {
- qDebug("CLexiconReadWindow::slotFillBackHistory");
+ qDebug() << "CLexiconReadWindow::slotFillBackHistory";
QMenu* menu = m_actions.backInHistory->popupMenu();
menu->clear();
- //TODO: take the history list and fill the menu
+ /// \todo take the history list and fill the menu
QListIterator<QAction*> it(keyChooser()->history()->getBackList());
while (it.hasNext()) {
menu->addAction(it.next());
@@ -340,11 +342,11 @@ void CLexiconReadWindow::slotFillBackHistory() {
}
void CLexiconReadWindow::slotFillForwardHistory() {
- qDebug("CLexiconReadWindow::slotFillForwardHistory");
+ qDebug() << "CLexiconReadWindow::slotFillForwardHistory";
QMenu* menu = m_actions.forwardInHistory->popupMenu();
menu->clear();
- //TODO: take the history list and fill the menu using addAction
+ /// \todo take the history list and fill the menu using addAction
QListIterator<QAction*> it(keyChooser()->history()->getFwList());
while (it.hasNext()) {
menu->addAction(it.next());
@@ -353,7 +355,7 @@ void CLexiconReadWindow::slotFillForwardHistory() {
void CLexiconReadWindow::slotUpdateHistoryButtons(bool backEnabled, bool fwEnabled) {
- qDebug("CLexiconReadWindow::slotUpdateHistoryButtons");
+ qDebug() << "CLexiconReadWindow::slotUpdateHistoryButtons";
Q_ASSERT(m_actions.backInHistory);
Q_ASSERT(keyChooser());
diff --git a/src/frontend/displaywindow/clexiconreadwindow.h b/src/frontend/displaywindow/clexiconreadwindow.h
index ee28c25..2a32cec 100644
--- a/src/frontend/displaywindow/clexiconreadwindow.h
+++ b/src/frontend/displaywindow/clexiconreadwindow.h
@@ -7,24 +7,24 @@
*
**********/
-
#ifndef CLEXICONREADWINDOW_H
#define CLEXICONREADWINDOW_H
-//BibleTime includes
-#include "creadwindow.h"
+#include "frontend/displaywindow/creadwindow.h"
+
#include "frontend/keychooser/ckeychooser.h"
+
+
+class BtActionCollection;
class BtToolBarPopupAction;
-class CSwordKey;
class CSwordLDKey;
-class BtActionCollection;
+class CSwordKey;
class QAction;
class QMenu;
/**
*@author The BibleTime team
*/
-
class CLexiconReadWindow : public CReadWindow {
Q_OBJECT
public:
diff --git a/src/frontend/displaywindow/cmodulechooserbar.cpp b/src/frontend/displaywindow/cmodulechooserbar.cpp
index 2e47851..0e6131a 100644
--- a/src/frontend/displaywindow/cmodulechooserbar.cpp
+++ b/src/frontend/displaywindow/cmodulechooserbar.cpp
@@ -7,14 +7,14 @@
*
**********/
-#include "cmodulechooserbar.h"
+#include "frontend/displaywindow/cmodulechooserbar.h"
-#include "cmodulechooserbutton.h"
-
-#include <QList>
-#include <QDebug>
#include <QAction>
+#include <QDebug>
+#include <QList>
#include <QToolBar>
+#include "frontend/displaywindow/cmodulechooserbutton.h"
+
CModuleChooserBar::CModuleChooserBar(QList<CSwordModuleInfo*> useModules, CSwordModuleInfo::ModuleType type, QWidget *parent)
: QToolBar(parent),
diff --git a/src/frontend/displaywindow/cmodulechooserbar.h b/src/frontend/displaywindow/cmodulechooserbar.h
index 1a9ce95..fbdd737 100644
--- a/src/frontend/displaywindow/cmodulechooserbar.h
+++ b/src/frontend/displaywindow/cmodulechooserbar.h
@@ -10,14 +10,12 @@
#ifndef CMODULECHOOSERBAR_H
#define CMODULECHOOSERBAR_H
-//BibleTime includes
-#include "backend/drivers/cswordmoduleinfo.h"
+#include <QToolBar>
+#include <QList>
+#include "backend/drivers/cswordmoduleinfo.h"
#include "util/cpointers.h"
-//Qt includes
-#include <QList>
-#include <QToolBar>
class CModuleChooserButton;
class QWidget;
diff --git a/src/frontend/displaywindow/cmodulechooserbutton.cpp b/src/frontend/displaywindow/cmodulechooserbutton.cpp
index 14760e0..0444cf6 100644
--- a/src/frontend/displaywindow/cmodulechooserbutton.cpp
+++ b/src/frontend/displaywindow/cmodulechooserbutton.cpp
@@ -7,33 +7,31 @@
*
**********/
-#include "cmodulechooserbutton.h"
-
-#include "cmodulechooserbar.h"
-
-#include "backend/managers/cswordbackend.h"
+#include "frontend/displaywindow/cmodulechooserbutton.h"
+#include <QDebug>
+#include <QHash>
+#include <QMenu>
+#include <QString>
+#include <QToolButton>
+#include <QToolTip>
#include "backend/config/cbtconfig.h"
-
+#include "backend/managers/cswordbackend.h"
+#include "frontend/displaywindow/cmodulechooserbar.h"
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
+#include "util/directory.h"
-//Qt includes
-#include <QString>
-#include <QToolTip>
-#include <QHash>
-#include <QToolButton>
-#include <QMenu>
-#include <QtDebug>
CModuleChooserButton::CModuleChooserButton(CSwordModuleInfo* useModule, CSwordModuleInfo::ModuleType type, const int id, CModuleChooserBar *parent)
: QToolButton(parent),
m_id(id), m_popup(0), m_moduleChooserBar(parent) {
+ namespace DU = util::directory;
+
m_moduleType = type;
m_module = useModule;
m_hasModule = (m_module) ? true : false;
- setIcon( util::filesystem::DirectoryUtil::getIcon(iconName()) );
+ setIcon(DU::getIcon(iconName()));
setPopupMode(QToolButton::InstantPopup);
populateMenu();
@@ -81,6 +79,7 @@ int CModuleChooserButton::getId() const {
/** Is called after a module was selected in the popup */
void CModuleChooserButton::moduleChosen( QAction* action ) {
+ namespace DU = util::directory;
QListIterator<QMenu*> it(m_submenus);
while (it.hasNext()) {
@@ -106,7 +105,7 @@ void CModuleChooserButton::moduleChosen( QAction* action ) {
m_hasModule = true;
m_module = module();
- setIcon( util::filesystem::DirectoryUtil::getIcon(iconName()) );
+ setIcon(DU::getIcon(iconName()));
emit sigChanged();
if (m_module) {
diff --git a/src/frontend/displaywindow/cmodulechooserbutton.h b/src/frontend/displaywindow/cmodulechooserbutton.h
index 23646c9..4d62b67 100644
--- a/src/frontend/displaywindow/cmodulechooserbutton.h
+++ b/src/frontend/displaywindow/cmodulechooserbutton.h
@@ -10,17 +10,16 @@
#ifndef CMODULECHOOSERBUTTON_H
#define CMODULECHOOSERBUTTON_H
-//BibleTime includes
-class CSwordModuleInfo;
-#include "backend/btmoduletreeitem.h"
+#include <QToolButton>
#include "util/cpointers.h"
-//Qt includes
-#include <QToolButton>
#include <QList>
+#include "backend/btmoduletreeitem.h"
+
class QMenu;
class CModuleChooserBar;
+class CSwordModuleInfo;
/** The CModuleChooserButton displays a list of submenus sorted by language which contain the possible modules
* which can be displayed together with the first one.
diff --git a/src/frontend/displaywindow/cplainwritewindow.cpp b/src/frontend/displaywindow/cplainwritewindow.cpp
index dc97aec..6394998 100644
--- a/src/frontend/displaywindow/cplainwritewindow.cpp
+++ b/src/frontend/displaywindow/cplainwritewindow.cpp
@@ -7,25 +7,22 @@
*
**********/
-#include "cplainwritewindow.h"
-#include "btactioncollection.h"
+#include "frontend/displaywindow/cplainwritewindow.h"
+#include <QAction>
+#include <QDebug>
+#include <QRegExp>
+#include <QToolBar>
+#include "backend/config/cbtconfig.h"
+#include "backend/keys/cswordkey.h"
#include "frontend/display/cwritedisplay.h"
-
+#include "frontend/displaywindow/btactioncollection.h"
#include "frontend/keychooser/ckeychooser.h"
#include "frontend/profile/cprofilewindow.h"
-#include "backend/config/cbtconfig.h"
-
-#include "backend/keys/cswordkey.h"
-
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
+#include "util/directory.h"
+#include "util/dialogutil.h"
-#include <QRegExp>
-#include <QToolBar>
-#include <QMessageBox>
-#include <QDebug>
-#include <QAction>
using namespace Profile;
@@ -54,9 +51,11 @@ void CPlainWriteWindow::initView() {
}
void CPlainWriteWindow::initToolbars() {
+ namespace DU = util::directory;
+
m_actions.syncWindow = new QAction(
//KIcon(CResMgr::displaywindows::commentaryWindow::syncWindow::icon),
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::commentaryWindow::syncWindow::icon),
+ DU::getIcon(CResMgr::displaywindows::commentaryWindow::syncWindow::icon),
tr("Sync with active Bible"),
actionCollection()
);
@@ -69,7 +68,7 @@ void CPlainWriteWindow::initToolbars() {
m_actions.saveText = new QAction(
//KIcon(CResMgr::displaywindows::writeWindow::saveText::icon),
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::saveText::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::saveText::icon),
tr("Save text"),
actionCollection()
);
@@ -82,7 +81,7 @@ void CPlainWriteWindow::initToolbars() {
m_actions.deleteEntry = new QAction(
//KIcon(CResMgr::displaywindows::writeWindow::deleteEntry::icon),
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::deleteEntry::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::deleteEntry::icon),
tr("Delete current entry"),
actionCollection()
);
@@ -95,7 +94,7 @@ void CPlainWriteWindow::initToolbars() {
m_actions.restoreText = new QAction(
//KIcon(CResMgr::displaywindows::writeWindow::restoreText::icon),
- util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::restoreText::icon),
+ DU::getIcon(CResMgr::displaywindows::writeWindow::restoreText::icon),
tr("Restore original text"),
actionCollection()
);
@@ -142,11 +141,11 @@ void CPlainWriteWindow::saveCurrentText( const QString& /*key*/ ) {
textChanged();
}
else {
- QMessageBox::critical( this, tr("Module not writable"),
- QString::fromLatin1("<qt><B>%1</B><BR>%2</qt>")
- .arg( tr("Module is not writable.") )
- .arg( tr("Either the module may not be edited, or "
- "you do not have write permission.") ) );
+ util::showCritical( this, tr("Module not writable"),
+ QString::fromLatin1("<qt><b>%1</b><br/>%2</qt>")
+ .arg( tr("Module is not writable.") )
+ .arg( tr("Either the module may not be edited, or "
+ "you do not have write permission.") ) );
}
}
diff --git a/src/frontend/displaywindow/cplainwritewindow.h b/src/frontend/displaywindow/cplainwritewindow.h
index a190f47..ec9fe5e 100644
--- a/src/frontend/displaywindow/cplainwritewindow.h
+++ b/src/frontend/displaywindow/cplainwritewindow.h
@@ -7,18 +7,14 @@
*
**********/
-
-
#ifndef CPLAINWRITEWINDOW_H
#define CPLAINWRITEWINDOW_H
-//BibleTime includes
-#include "cwritewindow.h"
+#include "frontend/displaywindow/cwritewindow.h"
-class QAction;
class BtActionCollection;
-
+class QAction;
class QString;
/** The write window class which offers a plain editor for source code editing.
diff --git a/src/frontend/displaywindow/creadwindow.cpp b/src/frontend/displaywindow/creadwindow.cpp
index 860fa72..b65cf8c 100644
--- a/src/frontend/displaywindow/creadwindow.cpp
+++ b/src/frontend/displaywindow/creadwindow.cpp
@@ -7,33 +7,31 @@
*
**********/
-//BibleTime includes
-#include "creadwindow.h"
-#include "btactioncollection.h"
+#include "frontend/displaywindow/creadwindow.h"
-#include "frontend/display/bthtmlreaddisplay.h"
-typedef BtHtmlReadDisplay HTMLREADDISPLAY;
-
-#include "backend/rendering/centrydisplay.h"
-#include "backend/rendering/cdisplayrendering.h"
+#include <QDebug>
+#include <QMdiSubWindow>
+#include <QResizeEvent>
#include "backend/keys/cswordkey.h"
#include "backend/keys/cswordversekey.h"
-
+#include "backend/rendering/cdisplayrendering.h"
+#include "backend/rendering/centrydisplay.h"
#include "frontend/cexportmanager.h"
#include "frontend/cmdiarea.h"
+#include "frontend/display/bthtmlreaddisplay.h"
+#include "frontend/displaywindow/btactioncollection.h"
#include "frontend/profile/cprofilewindow.h"
#include "frontend/searchdialog/csearchdialog.h"
-#include <QResizeEvent>
-#include <QMdiSubWindow>
-#include <QDebug>
using namespace Profile;
+typedef BtHtmlReadDisplay HTMLREADDISPLAY;
+
CReadWindow::CReadWindow(QList<CSwordModuleInfo*> modules, CMDIArea* parent)
: CDisplayWindow(modules, parent),
m_displayWidget(0) {
- qDebug("CReadWindow::CReadWindow");
+ qDebug() << "CReadWindow::CReadWindow";
// installEventFilter(this);
}
@@ -92,7 +90,7 @@ void CReadWindow::lookupSwordKey( CSwordKey* newKey ) {
key()->key(newKey->key());
}
- //next-TODO: how about options?
+ /// \todo next-TODO how about options?
Q_ASSERT(modules().first()->getDisplay());
CEntryDisplay* display = modules().first()->getDisplay();
if (display) { //do we have a display object?
@@ -106,7 +104,7 @@ void CReadWindow::lookupSwordKey( CSwordKey* newKey ) {
);
}
- setCaption( windowCaption() );
+ setWindowTitle(windowCaption());
// moving to anchor happens in slotMoveToAnchor which catches the completed() signal from KHTMLPart
@@ -114,7 +112,7 @@ void CReadWindow::lookupSwordKey( CSwordKey* newKey ) {
}
void CReadWindow::slotMoveToAnchor() {
- qDebug("CReadWindow::slotMoveToAnchor");
+ qDebug() << "CReadWindow::slotMoveToAnchor";
((CReadDisplay*)displayWidget())->moveToAnchor( Rendering::CDisplayRendering::keyToHTMLAnchor(key()->key()) );
}
@@ -195,7 +193,9 @@ void CReadWindow::openSearchStrongsDialog() {
QString searchText = QString::null;
if (displayWidget()->getCurrentNodeInfo()[CDisplay::Lemma] != QString::null) {
- searchText.append("strong:").append(displayWidget()->getCurrentNodeInfo() [CDisplay::Lemma]);
+ Q_FOREACH(QString strongNumber, displayWidget()->getCurrentNodeInfo()[CDisplay::Lemma].split("|")) {
+ searchText.append("strong:").append( strongNumber ).append(" ");
+ }
}
Search::CSearchDialog::openDialog( modules(), searchText, 0 );
diff --git a/src/frontend/displaywindow/creadwindow.h b/src/frontend/displaywindow/creadwindow.h
index 6144b2d..1debe9f 100644
--- a/src/frontend/displaywindow/creadwindow.h
+++ b/src/frontend/displaywindow/creadwindow.h
@@ -7,13 +7,10 @@
*
**********/
-
-
#ifndef CREADWINDOW_H
#define CREADWINDOW_H
-//BibleTime includes
-#include "cdisplaywindow.h"
+#include "frontend/displaywindow/cdisplaywindow.h"
#include "frontend/display/cdisplay.h"
#include "frontend/display/creaddisplay.h"
@@ -22,11 +19,9 @@
class BtActionCollection;
class QResizeEvent;
-
/** The base class for all read-only display windows.
* @author The BibleTime team
*/
-
class CReadWindow : public CDisplayWindow {
Q_OBJECT
public:
diff --git a/src/frontend/displaywindow/cwritewindow.cpp b/src/frontend/displaywindow/cwritewindow.cpp
index c60d9cd..7496dd7 100644
--- a/src/frontend/displaywindow/cwritewindow.cpp
+++ b/src/frontend/displaywindow/cwritewindow.cpp
@@ -8,17 +8,14 @@
**********/
-#include "cwritewindow.h"
+#include "frontend/displaywindow/cwritewindow.h"
#include "backend/drivers/cswordmoduleinfo.h"
#include "backend/keys/cswordversekey.h"
-
+#include "frontend/display/cwritedisplay.h"
#include "frontend/keychooser/ckeychooser.h"
#include "frontend/profile/cprofilewindow.h"
-#include "frontend/display/cwritedisplay.h"
-
-
-#include <QMessageBox>
+#include "util/dialogutil.h"
using namespace Profile;
@@ -112,13 +109,13 @@ void CWriteWindow::lookupSwordKey( CSwordKey* newKey ) {
if ( modules().count() ) {
displayWidget()->setText( key()->rawText() );
}
- setCaption( windowCaption() );
+ setWindowTitle(windowCaption());
}
bool CWriteWindow::queryClose() {
//save the text if it has changed
if (m_writeDisplay->isModified()) {
- switch (QMessageBox::question( this, tr("Save Text?"), tr("Save text before closing?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Yes) ) {
+ switch (util::showQuestion( this, tr("Save Text?"), tr("Save text before closing?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Yes) ) {
case QMessageBox::Yes: //save and close
saveCurrentText();
m_writeDisplay->setModified( false );
@@ -140,7 +137,7 @@ void CWriteWindow::beforeKeyChange(const QString& key) {
//If the text changed and we'd do a lookup ask the user if the text should be saved
if (modules().first() && ((CWriteDisplay*)displayWidget())->isModified()) {
- switch (QMessageBox::question( this, tr("Save Text?"), tr("Save changed text?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) ) {
+ switch (util::showQuestion( this, tr("Save Text?"), tr("Save changed text?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) ) {
case QMessageBox::Yes: { //save the changes
saveCurrentText( key );
break;
diff --git a/src/frontend/displaywindow/cwritewindow.h b/src/frontend/displaywindow/cwritewindow.h
index e2ffc54..5d6a316 100644
--- a/src/frontend/displaywindow/cwritewindow.h
+++ b/src/frontend/displaywindow/cwritewindow.h
@@ -10,18 +10,16 @@
#ifndef CWRITEWINDOW_H
#define CWRITEWINDOW_H
-//BibleTime includes
-#include "cdisplaywindow.h"
+#include "frontend/displaywindow/cdisplaywindow.h"
+class BtActionCollection;
class CWriteDisplay;
class QString;
-class BtActionCollection;
-/**The base class for all write-only display windows.
+/** The base class for all write-only display windows.
*@author The BibleTime team
*/
-
class CWriteWindow : public CDisplayWindow {
Q_OBJECT
public:
diff --git a/src/frontend/htmldialogs/btaboutdialog.cpp b/src/frontend/htmldialogs/btaboutdialog.cpp
index 2c6f553..f8e6666 100644
--- a/src/frontend/htmldialogs/btaboutdialog.cpp
+++ b/src/frontend/htmldialogs/btaboutdialog.cpp
@@ -7,11 +7,13 @@
*
**********/
-#include "btaboutdialog.h"
+#include "frontend/htmldialogs/btaboutdialog.h"
-#include "util/directoryutil.h"
+#include "util/directory.h"
+
+// Sword includes:
+#include <swversion.h>
-#include "swversion.h"
// Forwards
static QString make_body(const QString& content);
@@ -99,8 +101,10 @@ void BtAboutDialog::init_contributors_tab() {
// sorted alphabetically (last name)
content += "<ul>";
content += "<li>Horatiu Alexe</li>";
- content += "<li>Jan B&ecarron;lohoubek</li>";
+ content += "<li>Jan B&#x11B;lohoubek</li>";
content += "<li>Chun-shek Chan</li>";
+ content += "<li>Nouhoun Y. Diarra</li>";
+ content += "<li>Rafael Fagundes</li>";
content += "<li>Ilpo Kantonen</li>";
content += "<li>Pavel Laukko</li>";
content += "<li>Piotr Markiewicz</li>";
@@ -111,8 +115,11 @@ void BtAboutDialog::init_contributors_tab() {
content += "<li>Jaak Ristioja</li>";
content += "<li>Igor Rykhlin</li>";
content += "<li>Vlad Savitsky</li>";
+ content += "<li>Henrik Sonesson</li>";
content += "<li>Johan van der Lingen</li>";
content += "<li>Jean Van Schaftingen</li>";
+ content += "<li>Roland Teschner</li>";
+ content += "<li>Giovanni Tedaldi</li>";
content += "<li>Dmitry Yurevich</li>";
content += "<li>Esteban Zeller</li>";
content += "</ul>";
@@ -149,21 +156,21 @@ void BtAboutDialog::init_qt_tab() {
content += make_br() + make_br();
content += make_center(make_bold("Qt"));
content += make_br();
- content += tr("This program uses Qt Open Source Edition version %1.").arg(qVersion());
- //content += qVersion();
+ content += tr("This program uses Qt version %1.").arg(qVersion());
content += make_br() + make_br();
- content += tr("Qt Open Source Edition is intended for the development of Open Source applications.");
- content += " ";
- content += tr("Qt is a C++ toolkit for cross-platform application development.");
+ content += tr("Qt is a cross-platform application and UI framework, created with C++ language. It has been released under the LGPL license.");
content += make_br() + make_br();
- content += tr("Please see ");
- content += make_link("http://qtsoftware.com/company/model/", "qtsoftware.com/company/model");
- content += tr(" for an overview of Qt licensing.");
+ content += make_link("http://qt.nokia.com/", "http://qt.nokia.com/");
+ //content += tr("Please see ");
+ //content += make_link("http://qtsoftware.com/company/model/", "qtsoftware.com/company/model");
+ //content += tr(" for an overview of Qt licensing.");
QString qt = make_html(make_head("") + make_body(content));
setHtml(qt);
}
void BtAboutDialog::init_lic_tab() {
+ namespace DU = util::directory;
+
selectTab(4);
setTabText(tr("License"));
@@ -173,12 +180,12 @@ void BtAboutDialog::init_lic_tab() {
text += tr("You can download and use (but not distribute) the program for personal, private, public or commercial purposes without restrictions.");
text += " ";
text += tr("You can give away or distribute the program if you also distribute the corresponding source code.");
- text += "<br><br>";
+ text += "<br/><br/>";
//text += tr("It is allowed to distribute software under GPL for a small fee, but it must be accompanied with the complete source code, and the fact that it is freely available with no cost must not be hidden.");
- //text += "<br><br>";
+ //text += "<br/><br/>";
text += tr("The complete legally binding license is below.");
- QFile licFile(util::filesystem::DirectoryUtil::getLicenseDir().path() + "/license.html");
+ QFile licFile(DU::getLicenseDir().path() + "/license.html");
if (licFile.open(QFile::ReadOnly)) {
QByteArray html;
while (!licFile.atEnd()) {
@@ -200,7 +207,7 @@ static QString make_center(const QString& content) {
}
static QString make_br() {
- return "<br>";
+ return "<br/>";
}
static QString make_bold(const QString& content) {
@@ -229,7 +236,9 @@ static QString make_version() {
}
static QString make_file_icon(const QString& icon) {
- QString dir = "<img src=file://" + util::filesystem::DirectoryUtil::getIconDir().path();
+ namespace DU = util::directory;
+
+ QString dir("<img src=file://" + DU::getIconDir().path());
return dir + "/" + icon + ".png >";
}
diff --git a/src/frontend/htmldialogs/btaboutdialog.h b/src/frontend/htmldialogs/btaboutdialog.h
index 6521f7f..2fed22a 100644
--- a/src/frontend/htmldialogs/btaboutdialog.h
+++ b/src/frontend/htmldialogs/btaboutdialog.h
@@ -10,14 +10,15 @@
#ifndef BTABOUTDIALOG_H
#define BTABOUTDIALOG_H
-#include "bttabhtmldialog.h"
+#include "frontend/htmldialogs/bttabhtmldialog.h"
+
class BtAboutDialog : public BtTabHtmlDialog {
Q_OBJECT
-
public:
BtAboutDialog(QWidget *parent = 0, Qt::WindowFlags wflags = Qt::Dialog);
~BtAboutDialog();
+
void init_bt_tab();
void init_contributors_tab();
void init_sword_tab();
diff --git a/src/frontend/htmldialogs/bttabhtmldialog.cpp b/src/frontend/htmldialogs/bttabhtmldialog.cpp
index 4d2b57c..74a2b20 100644
--- a/src/frontend/htmldialogs/bttabhtmldialog.cpp
+++ b/src/frontend/htmldialogs/bttabhtmldialog.cpp
@@ -7,18 +7,19 @@
*
**********/
-#include "bttabhtmldialog.h" // See this file for more documentation of BtTabHtmlDialog
-#include "util/dialogutil.h"
-#include "util/directoryutil.h"
+#include "frontend/htmldialogs/bttabhtmldialog.h"
+#include <QContextMenuEvent>
+#include <QDesktopServices>
#include <QDialog>
#include <QDialogButtonBox>
-#include <QVBoxLayout>
-#include <QWebView>
#include <QMenu>
#include <QTabWidget>
-#include <QDesktopServices>
-#include <QContextMenuEvent>
+#include <QVBoxLayout>
+#include <QWebView>
+#include "util/dialogutil.h"
+#include "util/directory.h"
+
BtTabHtmlDialog::BtTabHtmlDialog
(const QString& title, int tabs, QWidget *parent, Qt::WindowFlags wflags )
@@ -91,9 +92,11 @@ QWebView* BtTabHtmlDialog::webView() {
}
void BtTabHtmlDialog::setHtml(const QString& html, const QUrl& baseUrl) {
+ namespace DU = util::directory;
+
QUrl url = baseUrl;
if (url == QUrl()) {
- QString dir = "file://" + util::filesystem::DirectoryUtil::getIconDir().path();
+ QString dir("file://" + DU::getIconDir().path());
url.setUrl(dir);
}
webView()->setHtml(html, url);
diff --git a/src/frontend/htmldialogs/bttabhtmldialog.h b/src/frontend/htmldialogs/bttabhtmldialog.h
index 3ccdc0f..6e5ed20 100644
--- a/src/frontend/htmldialogs/bttabhtmldialog.h
+++ b/src/frontend/htmldialogs/bttabhtmldialog.h
@@ -11,10 +11,12 @@
#define BTTABDIALOG_H
#include <QDialog>
+
#include <QString>
#include <QUrl>
#include <QWebView>
+
class QTabWidget;
class QMenu;
diff --git a/src/frontend/keychooser/bthistory.cpp b/src/frontend/keychooser/bthistory.cpp
index 8b14ded..60d2a7b 100644
--- a/src/frontend/keychooser/bthistory.cpp
+++ b/src/frontend/keychooser/bthistory.cpp
@@ -1,24 +1,18 @@
-//
-// C++ Implementation: BTHistory
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#include "bthistory.h"
-
-#include "backend/keys/cswordkey.h"
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+#include "frontend/keychooser/bthistory.h"
#include <QAction>
-#include <QList>
-
#include <QDebug>
+#include <QList>
+#include "backend/keys/cswordkey.h"
BTHistory::BTHistory(QWidget* parent)
@@ -30,7 +24,7 @@ BTHistory::BTHistory(QWidget* parent)
}
void BTHistory::add(CSwordKey* newKey) {
- qDebug("BTHistory::add");
+ qDebug() << "BTHistory::add";
Q_ASSERT(newKey);
// Add new key Action after current index if we were not using the history functions,
// if it's not a duplicate and if it's not empty.
@@ -38,14 +32,14 @@ void BTHistory::add(CSwordKey* newKey) {
if (!newKey->key().isEmpty()) {
m_historyList.insert(++m_index, new QAction(newKey->key(), this));
}
- // TODO: history limit?
+ // \todo history limit?
sendChangedSignal();
}
Q_ASSERT(class_invariant());
}
void BTHistory::move(QAction* historyItem) {
- qDebug("BTHistory::move");
+ qDebug() << "BTHistory::move";
//Q_ASSERT(historyItem);
Q_ASSERT(m_historyList.count());
@@ -62,7 +56,7 @@ void BTHistory::move(QAction* historyItem) {
}
void BTHistory::back() {
- qDebug("BTHistory::back");
+ qDebug() << "BTHistory::back";
if ( m_index >= 1) {
move(m_historyList.at(m_index - 1));
}
@@ -70,7 +64,7 @@ void BTHistory::back() {
}
void BTHistory::fw() {
- qDebug("BTHistory::fw");
+ qDebug() << "BTHistory::fw";
if (m_index < (m_historyList.size() - 1)) {
move(m_historyList.at(m_index + 1));
}
@@ -78,7 +72,7 @@ void BTHistory::fw() {
}
QList<QAction*> BTHistory::getBackList() {
- qDebug("BTHistory::getBackList");
+ qDebug() << "BTHistory::getBackList";
QList<QAction*> list;
for (int i = m_index - 1; i >= 0; --i) {
@@ -91,7 +85,7 @@ QList<QAction*> BTHistory::getBackList() {
}
QList<QAction*> BTHistory::getFwList() {
- qDebug("BTHistory::getFwList");
+ qDebug() << "BTHistory::getFwList";
QList<QAction*> list;
//qDebug() << "historyList.size:" << m_historyList.size();
diff --git a/src/frontend/keychooser/bthistory.h b/src/frontend/keychooser/bthistory.h
index 9c09e10..df674d0 100644
--- a/src/frontend/keychooser/bthistory.h
+++ b/src/frontend/keychooser/bthistory.h
@@ -1,21 +1,19 @@
-//
-// C++ Interface: BTHistory
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef BTHISTORY_H
#define BTHISTORY_H
-#include <QList>
#include <QObject>
+#include <QList>
+
class CSwordKey;
class QAction;
@@ -23,10 +21,9 @@ class QWidget;
class BTHistory: public QObject {
Q_OBJECT
-
public:
BTHistory(QWidget* parent);
- ~BTHistory() {};
+ ~BTHistory() {}
/**
* Return a list of Actions behind the current point, the first of the history list will be the
diff --git a/src/frontend/keychooser/cbookkeychooser.cpp b/src/frontend/keychooser/cbookkeychooser.cpp
index ca13baa..21216e4 100644
--- a/src/frontend/keychooser/cbookkeychooser.cpp
+++ b/src/frontend/keychooser/cbookkeychooser.cpp
@@ -6,19 +6,18 @@
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-#include "cbookkeychooser.h"
-#include "bthistory.h"
+#include "frontend/keychooser/cbookkeychooser.h"
-#include "backend/keys/cswordtreekey.h"
-#include "backend/drivers/cswordbookmoduleinfo.h"
-#include "backend/config/cbtconfig.h"
-
-//Qt includes
-#include <QWidget>
+#include <QDebug>
#include <QHBoxLayout>
#include <QList>
-#include <QDebug>
+#include <QWidget>
+#include "backend/config/cbtconfig.h"
+#include "backend/drivers/cswordbookmoduleinfo.h"
+#include "backend/keys/cswordtreekey.h"
+#include "frontend/keychooser/bthistory.h"
+
QMap<QObject*, int> boxes;
diff --git a/src/frontend/keychooser/cbookkeychooser.h b/src/frontend/keychooser/cbookkeychooser.h
index d32d6e9..f1ac69f 100644
--- a/src/frontend/keychooser/cbookkeychooser.h
+++ b/src/frontend/keychooser/cbookkeychooser.h
@@ -10,14 +10,14 @@
#ifndef CBOOKKEYCHOOSER_H
#define CBOOKKEYCHOOSER_H
-//BibleTime includes
-#include "ckeychooser.h"
-#include "ckeychooserwidget.h"
+#include "frontend/keychooser/ckeychooser.h"
#include <QList>
+#include "frontend/keychooser/ckeychooserwidget.h"
+
-class CSwordKey;
class CSwordBookModuleInfo;
+class CSwordKey;
class CSwordTreeKey;
namespace sword {
@@ -27,7 +27,7 @@ class TreeKeyIdx;
/** The keychooser implementation for books.
* @author The BibleTime team
*/
-class CBookKeyChooser : public CKeyChooser {
+class CBookKeyChooser : public CKeyChooser {
Q_OBJECT
public:
CBookKeyChooser(QList<CSwordModuleInfo*> modules, CSwordKey *key = 0, QWidget *parent = 0);
diff --git a/src/frontend/keychooser/cbooktreechooser.cpp b/src/frontend/keychooser/cbooktreechooser.cpp
index e348005..db55dca 100644
--- a/src/frontend/keychooser/cbooktreechooser.cpp
+++ b/src/frontend/keychooser/cbooktreechooser.cpp
@@ -6,21 +6,20 @@
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-#include "cbooktreechooser.h"
-#include "bthistory.h"
-
-#include "backend/keys/cswordtreekey.h"
-#include "backend/drivers/cswordbookmoduleinfo.h"
-#include "backend/config/cbtconfig.h"
+#include "frontend/keychooser/cbooktreechooser.h"
+#include <QApplication>
+#include <QDebug>
#include <QHBoxLayout>
+#include <QHeaderView>
#include <QTreeWidget>
#include <QTreeWidgetItem>
-#include <QHeaderView>
-#include <QApplication>
+#include "backend/config/cbtconfig.h"
+#include "backend/drivers/cswordbookmoduleinfo.h"
+#include "backend/keys/cswordtreekey.h"
+#include "frontend/keychooser/bthistory.h"
-#include <QDebug>
CBookTreeChooser::CBookTreeChooser(QList<CSwordModuleInfo*> modules, CSwordKey *key, QWidget *parent)
: CKeyChooser(modules, key, parent),
@@ -60,7 +59,7 @@ void CBookTreeChooser::setKey(CSwordKey* key) {
/** Sets a new key to this keychooser. Inherited from ckeychooser. */
void CBookTreeChooser::setKey(CSwordKey* newKey, const bool emitSignal) {
- qDebug("CBookTreeChooser::setKey");
+ qDebug() << "CBookTreeChooser::setKey";
if (m_key != newKey ) {
m_key = dynamic_cast<CSwordTreeKey*>(newKey);
@@ -131,13 +130,13 @@ void CBookTreeChooser::refreshContent() {
}
-//TODO: itemActivated is called too many times. As tested in GDB, the function
+/// \todo itemActivated is called too many times. As tested in GDB, the function
//is called twice with the pointer to the correct book and twice with a null
//pointer.
/** Slot for signal when item is selected by user. */
void CBookTreeChooser::itemActivated( QTreeWidgetItem* item ) {
- qDebug("CBookTreeChooser::itemActivated");
+ qDebug() << "CBookTreeChooser::itemActivated";
//Sometimes Qt calls this function with a null pointer.
if (item) {
m_key->key(item->text(1));
diff --git a/src/frontend/keychooser/cbooktreechooser.h b/src/frontend/keychooser/cbooktreechooser.h
index 943127b..01fd369 100644
--- a/src/frontend/keychooser/cbooktreechooser.h
+++ b/src/frontend/keychooser/cbooktreechooser.h
@@ -7,35 +7,27 @@
*
**********/
-
-
#ifndef CBOOKTREECHOOSER_H
#define CBOOKTREECHOOSER_H
+#include "frontend/keychooser/ckeychooser.h"
-/** The treechooser implementation for books.
- * @author The BibleTime team
- */
-//BibleTime includes
-#include "ckeychooser.h"
-#include "ckeychooserwidget.h"
-
+#include "frontend/keychooser/ckeychooserwidget.h"
-class CSwordKey;
-class CSwordBookModuleInfo;
-class CSwordTreeKey;
namespace sword {
class TreeKeyIdx;
}
-
+class CSwordBookModuleInfo;
+class CSwordKey;
+class CSwordTreeKey;
class QTreeWidget;
class QTreeWidgetItem;
/** The keychooser implementation for books.
* @author The BibleTime team
*/
-class CBookTreeChooser : public CKeyChooser {
+class CBookTreeChooser : public CKeyChooser {
Q_OBJECT
public:
CBookTreeChooser(QList<CSwordModuleInfo*> modules, CSwordKey *key = 0, QWidget *parent = 0);
diff --git a/src/frontend/keychooser/ckeychooser.cpp b/src/frontend/keychooser/ckeychooser.cpp
index 11b4db3..905e125 100644
--- a/src/frontend/keychooser/ckeychooser.cpp
+++ b/src/frontend/keychooser/ckeychooser.cpp
@@ -7,29 +7,25 @@
*
**********/
+#include "frontend/keychooser/ckeychooser.h"
-
-#include "ckeychooser.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
+#include <QAction>
+#include <QDebug>
#include "backend/drivers/cswordbiblemoduleinfo.h"
#include "backend/drivers/cswordcommentarymoduleinfo.h"
#include "backend/drivers/cswordlexiconmoduleinfo.h"
-
+#include "backend/drivers/cswordmoduleinfo.h"
#include "backend/keys/cswordkey.h"
+#include "frontend/keychooser/bthistory.h"
+#include "frontend/keychooser/cbookkeychooser.h"
+#include "frontend/keychooser/clexiconkeychooser.h"
+#include "frontend/keychooser/versekeychooser/cbiblekeychooser.h"
-#include "bthistory.h"
-#include "clexiconkeychooser.h"
-#include "versekeychooser/cbiblekeychooser.h"
-#include "cbookkeychooser.h"
-
-#include <QAction>
-#include <QDebug>
CKeyChooser::CKeyChooser(QList<CSwordModuleInfo*>, CSwordKey *, QWidget *parent)
: QWidget(parent),
m_history(0) {
- //qDebug("CKeyChooser::CKeyChooser");
+ //qDebug() << "CKeyChooser::CKeyChooser";
m_history = new BTHistory(this);
QObject::connect(history(), SIGNAL(historyMoved(QString&)), this, SLOT(setKey(QString&)));
}
diff --git a/src/frontend/keychooser/ckeychooser.h b/src/frontend/keychooser/ckeychooser.h
index 455da20..4441df0 100644
--- a/src/frontend/keychooser/ckeychooser.h
+++ b/src/frontend/keychooser/ckeychooser.h
@@ -7,23 +7,17 @@
*
**********/
-
-
#ifndef CKEYCHOOSER_H
#define CKEYCHOOSER_H
-
-class CSwordModuleInfo;
-
#include <QWidget>
+class BTHistory;
class CSwordKey;
+class CSwordModuleInfo;
class QAction;
-class BTHistory;
-
-
/**
* The base class for the KeyChooser.
* Do not use directly, create a KeyChooser with
@@ -32,10 +26,8 @@ class BTHistory;
*
* @author The BibleTime team
*/
-
class CKeyChooser : public QWidget {
Q_OBJECT
-
public:
/**
diff --git a/src/frontend/keychooser/ckeychooserwidget.cpp b/src/frontend/keychooser/ckeychooserwidget.cpp
index 88b7ed7..a11bd6f 100644
--- a/src/frontend/keychooser/ckeychooserwidget.cpp
+++ b/src/frontend/keychooser/ckeychooserwidget.cpp
@@ -7,20 +7,17 @@
*
**********/
+#include "frontend/keychooser/ckeychooserwidget.h"
-//BibleTime includes
-#include "ckeychooserwidget.h"
-
-#include "cscrollerwidgetset.h"
-
-//Qt includes
-#include <QString>
-#include <QWheelEvent>
+#include <QComboBox>
+#include <QDebug>
#include <QFocusEvent>
#include <QHBoxLayout>
-#include <QComboBox>
#include <QLineEdit>
-#include <QDebug>
+#include <QString>
+#include <QWheelEvent>
+#include "frontend/keychooser/cscrollerwidgetset.h"
+
class BtKeyLineEdit : public QLineEdit {
public:
@@ -133,7 +130,7 @@ void CKeyChooserWidget::reset(const int count, int index, bool do_emit) {
// return;
m_list.clear();
- for (int i = 1; i <= count; i++) { //TODO: CHECK
+ for (int i = 1; i <= count; i++) { /// \todo CHECK
m_list.append( QString::number(i) );
}
@@ -196,7 +193,7 @@ void CKeyChooserWidget::reset(QStringList *list, int index, bool do_emit) {
/** Initializes this widget. We need this function because we have more than one constructor. */
void CKeyChooserWidget::init() {
- qDebug("CKeyChooserWidget::init");
+ qDebug() << "CKeyChooserWidget::init";
oldKey = QString::null;
setFocusPolicy(Qt::WheelFocus);
@@ -237,7 +234,7 @@ void CKeyChooserWidget::init() {
/** Is called when the return key was presed in the combobox. */
void CKeyChooserWidget::slotReturnPressed( /*const QString& text*/) {
Q_ASSERT(comboBox()->lineEdit());
- qDebug("return pressed");
+ qDebug() << "return pressed";
QString text = comboBox()->lineEdit()->text();
for (int index = 0; index < comboBox()->count(); ++index) {
@@ -251,7 +248,7 @@ void CKeyChooserWidget::slotReturnPressed( /*const QString& text*/) {
/** Is called when the current item of the combo box was changed. */
void CKeyChooserWidget::slotComboChanged(int index) {
- qDebug("CKeyChooserWidget::slotComboChanged(int index)");
+ qDebug() << "CKeyChooserWidget::slotComboChanged(int index)";
if (!updatesEnabled()) {
return;
}
diff --git a/src/frontend/keychooser/ckeychooserwidget.h b/src/frontend/keychooser/ckeychooserwidget.h
index 4a141c1..1dab8b3 100644
--- a/src/frontend/keychooser/ckeychooserwidget.h
+++ b/src/frontend/keychooser/ckeychooserwidget.h
@@ -10,26 +10,26 @@
#ifndef CKEYCHOOSERWIDGET_H
#define CKEYCHOOSERWIDGET_H
+#include <QComboBox>
#include <QString>
#include <QStringList>
-#include <QComboBox>
+
+class CLexiconKeyChooser;
+class CScrollerWidgetSet;
class QWheelEvent;
class QHBoxLayout;
class QWidget;
class QObject;
class QEvent;
-class CLexiconKeyChooser;
-class CScrollerWidgetSet;
-/*
-* We use this class to conrtol the focus move in the combobox
+/**
+* We use this class to control the focus move in the combobox
* This class is used in the key chooser widgets
*/
class CKCComboBox : public QComboBox {
Q_OBJECT
-
public:
CKCComboBox();
/**
diff --git a/src/frontend/keychooser/clexiconkeychooser.cpp b/src/frontend/keychooser/clexiconkeychooser.cpp
index c1f3cb1..45fa0e2 100644
--- a/src/frontend/keychooser/clexiconkeychooser.cpp
+++ b/src/frontend/keychooser/clexiconkeychooser.cpp
@@ -7,25 +7,20 @@
*
**********/
+#include "frontend/keychooser/clexiconkeychooser.h"
-
-#include "clexiconkeychooser.h"
-
-#include "bthistory.h"
-#include "ckeychooserwidget.h"
-#include "cscrollbutton.h"
-
-#include "backend/drivers/cswordlexiconmoduleinfo.h"
-#include "backend/keys/cswordldkey.h"
-#include "backend/config/cbtconfig.h"
-#include "util/cresmgr.h"
-
-//STL headers
#include <algorithm>
#include <iterator>
#include <map>
-
#include <QHBoxLayout>
+#include <QDebug>
+#include "backend/config/cbtconfig.h"
+#include "backend/drivers/cswordlexiconmoduleinfo.h"
+#include "backend/keys/cswordldkey.h"
+#include "frontend/keychooser/bthistory.h"
+#include "frontend/keychooser/ckeychooserwidget.h"
+#include "frontend/keychooser/cscrollbutton.h"
+#include "util/cresmgr.h"
CLexiconKeyChooser::CLexiconKeyChooser(QList<CSwordModuleInfo*> modules, CSwordKey *key, QWidget *parent)
@@ -70,7 +65,7 @@ CSwordKey* CLexiconKeyChooser::key() {
}
void CLexiconKeyChooser::setKey(CSwordKey* key) {
- qDebug("CLexiconKeyChooser::setKey");
+ qDebug() << "CLexiconKeyChooser::setKey";
if (!(m_key = dynamic_cast<CSwordLDKey*>(key))) {
return;
diff --git a/src/frontend/keychooser/clexiconkeychooser.h b/src/frontend/keychooser/clexiconkeychooser.h
index ea1137b..f93a148 100644
--- a/src/frontend/keychooser/clexiconkeychooser.h
+++ b/src/frontend/keychooser/clexiconkeychooser.h
@@ -7,22 +7,18 @@
*
**********/
-
-
#ifndef CLEXICONKEYCHOOSER_H
#define CLEXICONKEYCHOOSER_H
-
-#include "ckeychooser.h"
-class CSwordModuleInfo;
+#include "frontend/keychooser/ckeychooser.h"
class CKeyChooserWidget;
-class CSwordLexiconModuleInfo;
class CSwordLDKey;
-
-class QWidget;
+class CSwordLexiconModuleInfo;
+class CSwordModuleInfo;
class QHBoxLayout;
+class QWidget;
/**
* This class implements the KeyChooser for lexicons
@@ -32,7 +28,7 @@ class QHBoxLayout;
*
* @author The BibleTime team
*/
-class CLexiconKeyChooser : public CKeyChooser {
+class CLexiconKeyChooser : public CKeyChooser {
Q_OBJECT
public:
/**
diff --git a/src/frontend/keychooser/cscrollbutton.cpp b/src/frontend/keychooser/cscrollbutton.cpp
index 4303fb1..5154241 100644
--- a/src/frontend/keychooser/cscrollbutton.cpp
+++ b/src/frontend/keychooser/cscrollbutton.cpp
@@ -7,16 +7,17 @@
*
**********/
-#include "cscrollbutton.h"
+#include "frontend/keychooser/cscrollbutton.h"
#include <cmath>
-#include <QEvent>
#include <QApplication>
#include <QCursor>
-#include <QPoint>
+#include <QEvent>
#include <QMouseEvent>
+#include <QPoint>
#include <QWheelEvent>
+
CScrollButton::CScrollButton(QWidget *parent)
: QToolButton(parent), m_isLocked(false) {
setFocusPolicy(Qt::WheelFocus);
diff --git a/src/frontend/keychooser/cscrollbutton.h b/src/frontend/keychooser/cscrollbutton.h
index 54b82e6..f795b24 100644
--- a/src/frontend/keychooser/cscrollbutton.h
+++ b/src/frontend/keychooser/cscrollbutton.h
@@ -7,15 +7,15 @@
*
**********/
-#ifndef CSRCOLLBUTTON_H
-#define CSRCOLLBUTTON_H
+#ifndef CSCROLLBUTTON_H
+#define CSCROLLBUTTON_H
#include <QToolButton>
-class QMouseEvent;
-class QWidget;
+
class QMouseEvent;
class QWheelEvent;
+class QWidget;
/**
* This Class implements the direct chooser button used in the KeyChooser Widget.
diff --git a/src/frontend/keychooser/cscrollerwidgetset.cpp b/src/frontend/keychooser/cscrollerwidgetset.cpp
index 5f417a1..7c987cc 100644
--- a/src/frontend/keychooser/cscrollerwidgetset.cpp
+++ b/src/frontend/keychooser/cscrollerwidgetset.cpp
@@ -7,16 +7,14 @@
*
**********/
+#include "frontend/keychooser/cscrollerwidgetset.h"
-//BibleTime includes
-#include "cscrollbutton.h"
-#include "cscrollerwidgetset.h"
-
-//Qt includes
#include <QString>
#include <QToolButton>
#include <QVBoxLayout>
#include <QWheelEvent>
+#include "frontend/keychooser/cscrollbutton.h"
+
const unsigned int WIDTH = 16;
const unsigned int ARROW_HEIGHT = 12;
diff --git a/src/frontend/keychooser/cscrollerwidgetset.h b/src/frontend/keychooser/cscrollerwidgetset.h
index 90d87b6..ae81636 100644
--- a/src/frontend/keychooser/cscrollerwidgetset.h
+++ b/src/frontend/keychooser/cscrollerwidgetset.h
@@ -7,20 +7,16 @@
*
**********/
-
-
#ifndef CSCROLLERWIDGETSET_H
#define CSCROLLERWIDGETSET_H
-
#include <QWidget>
-class QVBoxLayout;
-class QToolButton;
-class QString;
-
class CScrollButton;
+class QString;
+class QToolButton;
+class QVBoxLayout;
/**
* This class implements the Scroller Widget-set, which
diff --git a/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp b/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp
index 2d59bed..1e8c292 100644
--- a/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp
+++ b/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp
@@ -7,12 +7,13 @@
*
**********/
-#include "btdropdownchooserbutton.h"
-#include "ckeyreferencewidget.h"
-#include "btversekeymenu.h"
+#include "frontend/keychooser/versekeychooser/btdropdownchooserbutton.h"
-#include <QWheelEvent>
#include <QDebug>
+#include <QWheelEvent>
+#include "frontend/keychooser/versekeychooser/btversekeymenu.h"
+#include "frontend/keychooser/versekeychooser/ckeyreferencewidget.h"
+
const unsigned int ARROW_HEIGHT = 15;
@@ -36,7 +37,7 @@ BtDropdownChooserButton::BtDropdownChooserButton(CKeyReferenceWidget* ref)
void BtDropdownChooserButton::mousePressEvent(QMouseEvent* e) {
- //qDebug("BtDropdownChooserButton::mousePressEvent");
+ //qDebug() << "BtDropdownChooserButton::mousePressEvent";
//recreate the menu
menu()->clear();
this->newList();
diff --git a/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h b/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h
index 12f2f65..e9dbdc2 100644
--- a/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h
+++ b/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.h
@@ -10,9 +10,9 @@
#ifndef BTDROPDOWNCHOOSERBUTTON_H
#define BTDROPDOWNCHOOSERBUTTON_H
-
#include <QToolButton>
+
class CKeyReferenceWidget;
/**
diff --git a/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp b/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp
index 82a07b7..c06a18d 100644
--- a/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp
+++ b/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp
@@ -7,19 +7,19 @@
*
**********/
-#include "btversekeymenu.h"
+#include "frontend/keychooser/versekeychooser/btversekeymenu.h"
+#include <QDebug>
#include <QMenu>
-#include <QTimerEvent>
#include <QMouseEvent>
+#include <QTimerEvent>
-#include <QDebug>
BtVerseKeyMenu::BtVerseKeyMenu(QWidget* parent)
: QMenu(parent),
m_timerId(0),
m_firstClickLock(true) {
- qDebug("BtVerseKeyMenu::BtVerseKeyMenu");
+ qDebug() << "BtVerseKeyMenu::BtVerseKeyMenu";
QObject::connect(this, SIGNAL(aboutToShow()), this, SLOT(startFirstClickDelayTimer()));
}
diff --git a/src/frontend/keychooser/versekeychooser/btversekeymenu.h b/src/frontend/keychooser/versekeychooser/btversekeymenu.h
index 29c0736..f47d0f5 100644
--- a/src/frontend/keychooser/versekeychooser/btversekeymenu.h
+++ b/src/frontend/keychooser/versekeychooser/btversekeymenu.h
@@ -12,6 +12,7 @@
#include <QMenu>
+
class QMouseEvent;
class QTimerEvent;
diff --git a/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp b/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp
index 493d9c4..7bcfbe1 100644
--- a/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp
+++ b/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp
@@ -7,21 +7,18 @@
*
**********/
-#include "cbiblekeychooser.h"
+#include "frontend/keychooser/versekeychooser/cbiblekeychooser.h"
-#include "../bthistory.h"
-#include "ckeyreferencewidget.h"
-#include "../cscrollbutton.h"
-
-#include "backend/keys/cswordversekey.h"
+#include <QDebug>
+#include <QHBoxLayout>
#include "backend/drivers/cswordbiblemoduleinfo.h"
#include "backend/drivers/cswordmoduleinfo.h"
-
+#include "backend/keys/cswordversekey.h"
+#include "frontend/keychooser/bthistory.h"
+#include "frontend/keychooser/cscrollbutton.h"
+#include "frontend/keychooser/versekeychooser/ckeyreferencewidget.h"
#include "util/cresmgr.h"
-#include <QHBoxLayout>
-#include <QDebug>
-
CBibleKeyChooser::CBibleKeyChooser(QList<CSwordModuleInfo*> modules, CSwordKey *key, QWidget *parent) :
CKeyChooser(modules, key, parent),
@@ -42,6 +39,7 @@ CBibleKeyChooser::CBibleKeyChooser(QList<CSwordModuleInfo*> modules, CSwordKey *
setFocusProxy(w_ref);
layout->addWidget(w_ref);
+ connect(w_ref, SIGNAL(beforeChange(CSwordVerseKey *)), SLOT(beforeRefChange(CSwordVerseKey *)));
connect(w_ref, SIGNAL(changed(CSwordVerseKey *)), SLOT(refChanged(CSwordVerseKey *)));
setKey(m_key); //set the key without changing it, setKey(key()) would change it
@@ -63,14 +61,25 @@ void CBibleKeyChooser::setKey(CSwordKey* key) {
emit keyChanged(m_key);
}
+void CBibleKeyChooser::beforeRefChange(CSwordVerseKey* key) {
+ Q_ASSERT(m_key);
+
+ if (!updatesEnabled())
+ return;
+
+ if (m_key)
+ emit beforeKeyChange(m_key->key());
+
+}
+
void CBibleKeyChooser::refChanged(CSwordVerseKey* key) {
Q_ASSERT(m_key);
Q_ASSERT(key);
- if (!updatesEnabled()) return;
+ if (!updatesEnabled())
+ return;
setUpdatesEnabled(false);
- if (m_key) emit beforeKeyChange(m_key->key());
m_key = key;
emit keyChanged(m_key);
diff --git a/src/frontend/keychooser/versekeychooser/cbiblekeychooser.h b/src/frontend/keychooser/versekeychooser/cbiblekeychooser.h
index e412e60..9501099 100644
--- a/src/frontend/keychooser/versekeychooser/cbiblekeychooser.h
+++ b/src/frontend/keychooser/versekeychooser/cbiblekeychooser.h
@@ -7,16 +7,14 @@
*
**********/
-
-
#ifndef CBIBLEKEYCHOOSER_H
#define CBIBLEKEYCHOOSER_H
+#include "frontend/keychooser/ckeychooser.h"
-#include "../ckeychooser.h"
+#include <QList>
#include "backend/drivers/cswordbiblemoduleinfo.h"
-#include <QList>
class QWidget;
@@ -57,8 +55,11 @@ class CBibleKeyChooser : public CKeyChooser {
*/
virtual void setModules(const QList<CSwordModuleInfo*>& modules, const bool refresh = true);
/**
- * used to react to changes
- * @param index not used
+ * used to do actions before key changes
+ */
+ void beforeRefChange(CSwordVerseKey *key);
+ /**
+ * used to do actions after key changes
*/
void refChanged(CSwordVerseKey *key);
diff --git a/src/frontend/keychooser/versekeychooser/ckeyreferencewidget.cpp b/src/frontend/keychooser/versekeychooser/ckeyreferencewidget.cpp
index 7cedfc0..067b4db 100644
--- a/src/frontend/keychooser/versekeychooser/ckeyreferencewidget.cpp
+++ b/src/frontend/keychooser/versekeychooser/ckeyreferencewidget.cpp
@@ -7,31 +7,26 @@
*
**********/
-//BibleTime includes
-#include "ckeyreferencewidget.h"
+#include "frontend/keychooser/versekeychooser/ckeyreferencewidget.h"
-#include "../cscrollerwidgetset.h"
-#include "btdropdownchooserbutton.h"
-
-#include "backend/config/cbtconfig.h"
-
-#include "backend/keys/cswordversekey.h"
-
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-
-//Qt includes
#include <QApplication>
#include <QDebug>
+#include <QEvent>
+#include <QFocusEvent>
#include <QHBoxLayout>
#include <QLineEdit>
-#include <QEvent>
#include <QMouseEvent>
#include <QPixmap>
#include <QString>
#include <QStringList>
#include <QToolButton>
-#include <QFocusEvent>
+#include "backend/config/cbtconfig.h"
+#include "backend/keys/cswordversekey.h"
+#include "frontend/keychooser/cscrollerwidgetset.h"
+#include "frontend/keychooser/versekeychooser/btdropdownchooserbutton.h"
+#include "util/cresmgr.h"
+#include "util/directory.h"
+
class BtLineEdit : public QLineEdit {
public:
@@ -54,6 +49,7 @@ CKeyReferenceWidget::CKeyReferenceWidget( CSwordBibleModuleInfo *mod, CSwordVers
QWidget(parent),
m_key(key),
m_dropDownHoverTimer(this) {
+ namespace DU = util::directory;
updatelock = false;
m_module = mod;
@@ -61,7 +57,7 @@ CKeyReferenceWidget::CKeyReferenceWidget( CSwordBibleModuleInfo *mod, CSwordVers
setFocusPolicy(Qt::WheelFocus);
QToolButton* clearRef = new QToolButton(this);
- clearRef->setIcon(util::filesystem::DirectoryUtil::getIcon("edit_clear_locationbar"));
+ clearRef->setIcon(DU::getIcon("edit_clear_locationbar"));
clearRef->setAutoRaise(true);
clearRef->setStyleSheet("QToolButton{margin:0px;}");
connect(clearRef, SIGNAL(clicked()), SLOT(slotClearRef()) );
@@ -243,32 +239,33 @@ void CKeyReferenceWidget::slotUpdateUnlock() {
}
void CKeyReferenceWidget::slotStepBook(int n) {
- CSwordVerseKey key = *m_key;
- n > 0 ? key.next( CSwordVerseKey::UseBook ) : key.previous( CSwordVerseKey::UseBook );
+ emit beforeChange(m_key);
+ n > 0 ? m_key->next( CSwordVerseKey::UseBook ) : m_key->previous( CSwordVerseKey::UseBook );
if (!updatelock)
- emit changed(&key); // does *m_key = key
+ emit changed(m_key);
updateText();
}
void CKeyReferenceWidget::slotStepChapter(int n) {
- CSwordVerseKey key = *m_key;
- n > 0 ? key.next( CSwordVerseKey::UseChapter ) : key.previous( CSwordVerseKey::UseChapter );
+ emit beforeChange(m_key);
+ n > 0 ? m_key->next( CSwordVerseKey::UseChapter ) : m_key->previous( CSwordVerseKey::UseChapter );
if (!updatelock)
- emit changed(&key); // does *m_key = key
+ emit changed(m_key);
updateText();
}
void CKeyReferenceWidget::slotStepVerse(int n) {
- CSwordVerseKey key = *m_key;
- n > 0 ? key.next( CSwordVerseKey::UseVerse ) : key.previous( CSwordVerseKey::UseVerse );
+ emit beforeChange(m_key);
+ n > 0 ? m_key->next( CSwordVerseKey::UseVerse ) : m_key->previous( CSwordVerseKey::UseVerse );
if (!updatelock)
- emit changed(&key); // does *m_key = key
+ emit changed(m_key);
updateText();
}
void CKeyReferenceWidget::slotChangeVerse(int n) {
if (m_key->Verse() != n) {
+ emit beforeChange(m_key);
m_key->Verse( n );
setKey( m_key );
}
@@ -278,6 +275,7 @@ void CKeyReferenceWidget::slotChangeVerse(int n) {
void CKeyReferenceWidget::slotChangeChapter(int n) {
if (m_key->Chapter() != n) {
+ emit beforeChange(m_key);
m_key->Chapter( n );
setKey( m_key );
}
@@ -288,6 +286,7 @@ void CKeyReferenceWidget::slotChangeChapter(int n) {
void CKeyReferenceWidget::slotChangeBook(QString bookname) {
if (m_key->book() != bookname) {
+ emit beforeChange(m_key);
m_key->book( bookname );
setKey( m_key );
}
diff --git a/src/frontend/keychooser/versekeychooser/ckeyreferencewidget.h b/src/frontend/keychooser/versekeychooser/ckeyreferencewidget.h
index 95a188e..637530a 100644
--- a/src/frontend/keychooser/versekeychooser/ckeyreferencewidget.h
+++ b/src/frontend/keychooser/versekeychooser/ckeyreferencewidget.h
@@ -10,20 +10,18 @@
#ifndef CKEYREFERENCEWIDGET_H
#define CKEYREFERENCEWIDGET_H
-#include "../cscrollerwidgetset.h"
-#include "backend/drivers/cswordbiblemoduleinfo.h"
-
#include <QWidget>
+
#include <QTimer>
+#include "backend/drivers/cswordbiblemoduleinfo.h"
+#include "frontend/keychooser/cscrollerwidgetset.h"
+class BtDropdownChooserButton;
class CLexiconKeyChooser;
class CSwordVerseKey;
-class BtDropdownChooserButton;
-
class QLineEdit;
-
class CKeyReferenceWidget : public QWidget {
Q_OBJECT
public:
@@ -37,7 +35,8 @@ class CKeyReferenceWidget : public QWidget {
void setModule(CSwordBibleModuleInfo *m = 0);
bool eventFilter(QObject *o, QEvent *e);
- signals:
+signals:
+ void beforeChange(CSwordVerseKey* key);
void changed(CSwordVerseKey* key);
protected:
diff --git a/src/frontend/mainindex/bookmarks/btbookmarkfolder.cpp b/src/frontend/mainindex/bookmarks/btbookmarkfolder.cpp
index cdfa870..2091a54 100644
--- a/src/frontend/mainindex/bookmarks/btbookmarkfolder.cpp
+++ b/src/frontend/mainindex/bookmarks/btbookmarkfolder.cpp
@@ -7,18 +7,16 @@
*
**********/
+#include "frontend/mainindex/bookmarks/btbookmarkfolder.h"
-#include "btbookmarkfolder.h"
-#include "btbookmarkitembase.h"
-#include "btbookmarkitem.h"
-#include "btbookmarkloader.h"
-
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-
+#include <QDebug>
#include <QFileDialog>
+#include "frontend/mainindex/bookmarks/btbookmarkitembase.h"
+#include "frontend/mainindex/bookmarks/btbookmarkitem.h"
+#include "frontend/mainindex/bookmarks/btbookmarkloader.h"
+#include "util/cresmgr.h"
+#include "util/directory.h"
-#include <QDebug>
BtBookmarkFolder::BtBookmarkFolder(QTreeWidgetItem* parent, QString name)
: BtBookmarkItemBase(parent) {
@@ -86,12 +84,14 @@ void BtBookmarkFolder::rename() {
}
void BtBookmarkFolder::update() {
+ namespace DU = util::directory;
+
qDebug() << "BtBookmarkFolder::update()";
BtBookmarkItemBase::update();
if (isExpanded() && childCount())
- setIcon(0, util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::openedFolder::icon));
+ setIcon(0, DU::getIcon(CResMgr::mainIndex::openedFolder::icon));
else
- setIcon(0, util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::closedFolder::icon));
+ setIcon(0, DU::getIcon(CResMgr::mainIndex::closedFolder::icon));
}
bool BtBookmarkFolder::hasDescendant(QTreeWidgetItem* item) const {
diff --git a/src/frontend/mainindex/bookmarks/btbookmarkfolder.h b/src/frontend/mainindex/bookmarks/btbookmarkfolder.h
index d00222b..9f065f4 100644
--- a/src/frontend/mainindex/bookmarks/btbookmarkfolder.h
+++ b/src/frontend/mainindex/bookmarks/btbookmarkfolder.h
@@ -10,10 +10,10 @@
#ifndef BTBOOKMARKFOLDER_H
#define BTBOOKMARKFOLDER_H
-#include "btbookmarkitembase.h"
+#include "frontend/mainindex/bookmarks/btbookmarkitembase.h"
-#define CURRENT_SYNTAX_VERSION 1
+#define CURRENT_SYNTAX_VERSION 1
class BtBookmarkFolder : public BtBookmarkItemBase {
public:
diff --git a/src/frontend/mainindex/bookmarks/btbookmarkitem.cpp b/src/frontend/mainindex/bookmarks/btbookmarkitem.cpp
index ba9632e..40dc79e 100644
--- a/src/frontend/mainindex/bookmarks/btbookmarkitem.cpp
+++ b/src/frontend/mainindex/bookmarks/btbookmarkitem.cpp
@@ -7,21 +7,18 @@
*
**********/
+#include "frontend/mainindex/bookmarks/btbookmarkitem.h"
-#include "btbookmarkitem.h"
-#include "btbookmarkfolder.h"
-
+#include <boost/scoped_ptr.hpp>
+#include <QDebug>
+#include "backend/config/cbtconfig.h"
#include "backend/drivers/cswordmoduleinfo.h"
#include "backend/keys/cswordversekey.h"
#include "frontend/cinputdialog.h"
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-#include "backend/config/cbtconfig.h"
+#include "frontend/mainindex/bookmarks/btbookmarkfolder.h"
#include "util/cpointers.h"
-
-#include <QDebug>
-
-#include <boost/scoped_ptr.hpp>
+#include "util/cresmgr.h"
+#include "util/directory.h"
BtBookmarkItem::BtBookmarkItem(CSwordModuleInfo* module, QString key, QString& description)
@@ -141,8 +138,10 @@ QString BtBookmarkItem::englishKey() const {
}
void BtBookmarkItem::update() {
+ namespace DU = util::directory;
+
qDebug() << "BtBookmarkItem::update";
- setIcon(0, util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::bookmark::icon));
+ setIcon(0, DU::getIcon(CResMgr::mainIndex::bookmark::icon));
const QString title = QString::fromLatin1("%1 (%2)").arg(key()).arg(module() ? module()->name() : QObject::tr("unknown"));
setText(0, title);
diff --git a/src/frontend/mainindex/bookmarks/btbookmarkitem.h b/src/frontend/mainindex/bookmarks/btbookmarkitem.h
index 1708627..6677f61 100644
--- a/src/frontend/mainindex/bookmarks/btbookmarkitem.h
+++ b/src/frontend/mainindex/bookmarks/btbookmarkitem.h
@@ -10,11 +10,11 @@
#ifndef BTBOOKMARKITEM_H
#define BTBOOKMARKITEM_H
-
-#include "btbookmarkitembase.h"
+#include "frontend/mainindex/bookmarks/btbookmarkitembase.h"
#include <QString>
+
class BtBookmarkFolder;
class CSwordModuleInfo;
diff --git a/src/frontend/mainindex/bookmarks/btbookmarkitembase.cpp b/src/frontend/mainindex/bookmarks/btbookmarkitembase.cpp
index a4270a8..82241ce 100644
--- a/src/frontend/mainindex/bookmarks/btbookmarkitembase.cpp
+++ b/src/frontend/mainindex/bookmarks/btbookmarkitembase.cpp
@@ -7,11 +7,12 @@
*
**********/
-#include "btbookmarkitembase.h"
-#include "cbookmarkindex.h"
+#include "frontend/mainindex/bookmarks/btbookmarkitembase.h"
-#include <QTreeWidgetItem>
#include <QDropEvent>
+#include <QTreeWidgetItem>
+#include "frontend/mainindex/bookmarks/cbookmarkindex.h"
+
BtBookmarkItemBase::BtBookmarkItemBase() {}
diff --git a/src/frontend/mainindex/bookmarks/btbookmarkitembase.h b/src/frontend/mainindex/bookmarks/btbookmarkitembase.h
index 326f760..78754f7 100644
--- a/src/frontend/mainindex/bookmarks/btbookmarkitembase.h
+++ b/src/frontend/mainindex/bookmarks/btbookmarkitembase.h
@@ -10,18 +10,17 @@
#ifndef BTBOOKMARKITEMBASE_H
#define BTBOOKMARKITEMBASE_H
-
#include <QTreeWidgetItem>
-#include <QString>
-#include <QMimeData>
+
#include <QDropEvent>
+#include <QMimeData>
+#include <QString>
-class CBookmarkIndex;
+class CBookmarkIndex;
class BtBookmarkItemBase : public QTreeWidgetItem {
public:
-
enum MenuAction {
NewFolder = 0,
ChangeFolder,
diff --git a/src/frontend/mainindex/bookmarks/btbookmarkloader.cpp b/src/frontend/mainindex/bookmarks/btbookmarkloader.cpp
index f6f3913..ddf656e 100644
--- a/src/frontend/mainindex/bookmarks/btbookmarkloader.cpp
+++ b/src/frontend/mainindex/bookmarks/btbookmarkloader.cpp
@@ -7,24 +7,22 @@
*
**********/
-#include "btbookmarkloader.h"
+#include "frontend/mainindex/bookmarks/btbookmarkloader.h"
-#include "btbookmarkitem.h"
-#include "btbookmarkfolder.h"
-
-#include "util/ctoolclass.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-
-#include <QTreeWidgetItem>
+#include <QDebug>
#include <QDomElement>
#include <QDomNode>
#include <QDomDocument>
-#include <QTextStream>
#include <QFile>
#include <QIODevice>
#include <QTextCodec>
+#include <QTextStream>
+#include <QTreeWidgetItem>
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/mainindex/bookmarks/btbookmarkitem.h"
+#include "frontend/mainindex/bookmarks/btbookmarkfolder.h"
+#include "util/tool.h"
-#include <QDebug>
#define CURRENT_SYNTAX_VERSION 1
@@ -102,8 +100,10 @@ QTreeWidgetItem* BtBookmarkLoader::handleXmlElement(QDomElement& element, QTreeW
QString BtBookmarkLoader::loadXmlFromFile(QString fileName) {
+ namespace DU = util::directory;
+
if (fileName.isNull()) {
- fileName = util::filesystem::DirectoryUtil::getUserBaseDir().absolutePath() + "/bookmarks.xml";
+ fileName = DU::getUserBaseDir().absolutePath() + "/bookmarks.xml";
}
QFile file(fileName);
if (!file.exists())
@@ -122,9 +122,11 @@ QString BtBookmarkLoader::loadXmlFromFile(QString fileName) {
}
void BtBookmarkLoader::saveTreeFromRootItem(QTreeWidgetItem* rootItem, QString fileName, bool forceOverwrite) {
+ namespace DU = util::directory;
+
Q_ASSERT(rootItem);
if (fileName.isNull()) {
- fileName = util::filesystem::DirectoryUtil::getUserBaseDir().absolutePath() + "/bookmarks.xml";
+ fileName = DU::getUserBaseDir().absolutePath() + "/bookmarks.xml";
}
QDomDocument doc("DOC");
@@ -139,7 +141,7 @@ void BtBookmarkLoader::saveTreeFromRootItem(QTreeWidgetItem* rootItem, QString f
for (int i = 0; i < rootItem->childCount(); i++) {
saveItem(rootItem->child(i), content);
}
- CToolClass::savePlainFile(fileName, doc.toString(), forceOverwrite, QTextCodec::codecForName("UTF-8"));
+ util::tool::savePlainFile(fileName, doc.toString(), forceOverwrite, QTextCodec::codecForName("UTF-8"));
}
diff --git a/src/frontend/mainindex/bookmarks/btbookmarkloader.h b/src/frontend/mainindex/bookmarks/btbookmarkloader.h
index 7a981d9..3102ca2 100644
--- a/src/frontend/mainindex/bookmarks/btbookmarkloader.h
+++ b/src/frontend/mainindex/bookmarks/btbookmarkloader.h
@@ -10,11 +10,11 @@
#ifndef BTBOOKMARKLOADER_H
#define BTBOOKMARKLOADER_H
-#include "util/directoryutil.h"
+#include "util/directory.h"
-#include <QString>
-#include <QList>
#include <QDomElement>
+#include <QList>
+#include <QString>
class QTreeWidgetItem;
diff --git a/src/frontend/mainindex/bookmarks/cbookmarkindex.cpp b/src/frontend/mainindex/bookmarks/cbookmarkindex.cpp
index 6d35793..dda763b 100644
--- a/src/frontend/mainindex/bookmarks/cbookmarkindex.cpp
+++ b/src/frontend/mainindex/bookmarks/cbookmarkindex.cpp
@@ -7,52 +7,44 @@
*
**********/
-//BibleTime includes
-#include "cbookmarkindex.h"
-
-#include "btbookmarkitembase.h"
-#include "btbookmarkitem.h"
-#include "btbookmarkfolder.h"
-#include "btbookmarkloader.h"
-
-#include "backend/managers/creferencemanager.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-
-#include "frontend/searchdialog/csearchdialog.h"
-#include "backend/config/cbtconfig.h"
-#include "frontend/cinfodisplay.h"
-
-#include "frontend/cprinter.h"
-#include "frontend/cdragdrop.h"
-
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-#include "util/ctoolclass.h"
+#include "frontend/mainindex/bookmarks/cbookmarkindex.h"
#include <boost/scoped_ptr.hpp>
-
-//Qt includes
-#include <QInputDialog>
+#include <QAction>
+#include <QApplication>
+#include <QCursor>
+#include <QDebug>
+#include <QDrag>
#include <QDragLeaveEvent>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QHeaderView>
-#include <QTimer>
-#include <QToolTip>
+#include <QInputDialog>
#include <QList>
-#include <QTreeWidget>
-#include <QTreeWidgetItem>
-#include <QCursor>
-#include <QMouseEvent>
-#include <QMessageBox>
#include <QMenu>
-#include <QAction>
-#include <QPaintEvent>
+#include <QMouseEvent>
#include <QPainter>
-#include <QApplication>
-#include <QDrag>
+#include <QPaintEvent>
+#include <QTimer>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QToolTip>
+#include "backend/config/cbtconfig.h"
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "backend/managers/referencemanager.h"
+#include "frontend/cdragdrop.h"
+#include "frontend/cinfodisplay.h"
+#include "frontend/cprinter.h"
+#include "frontend/mainindex/bookmarks/btbookmarkitembase.h"
+#include "frontend/mainindex/bookmarks/btbookmarkitem.h"
+#include "frontend/mainindex/bookmarks/btbookmarkfolder.h"
+#include "frontend/mainindex/bookmarks/btbookmarkloader.h"
+#include "frontend/searchdialog/csearchdialog.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
+#include "util/directory.h"
+#include "util/dialogutil.h"
-#include <QDebug>
CBookmarkIndex::CBookmarkIndex(QWidget *parent)
: QTreeWidget(parent),
@@ -74,7 +66,7 @@ CBookmarkIndex::~CBookmarkIndex() {
/** Initializes the view. */
void CBookmarkIndex::initView() {
- //qDebug("CBookmarkIndex::initView");
+ //qDebug() << "CBookmarkIndex::initView";
header()->hide();
@@ -123,7 +115,7 @@ void CBookmarkIndex::initView() {
m_popup->addAction(separator);
m_popup->addAction(m_actions.deleteEntries);
- //qDebug("CBookmarkIndex::initView end");
+ //qDebug() << "CBookmarkIndex::initView end";
}
/** Convenience function for creating a new QAction.
@@ -131,14 +123,15 @@ void CBookmarkIndex::initView() {
* than to modify all QAction constructors.
*/
QAction* CBookmarkIndex::newQAction(const QString& text, const QString& pix, const int /*shortcut*/, const QObject* receiver, const char* slot, QObject* parent) {
- QAction* action = new QAction(util::filesystem::DirectoryUtil::getIcon(pix), text, parent);
+ namespace DU = util::directory;
+ QAction* action = new QAction(DU::getIcon(pix), text, parent);
QObject::connect(action, SIGNAL(triggered()), receiver, slot);
return action;
}
/** Initialize the SIGNAL<->SLOT connections */
void CBookmarkIndex::initConnections() {
- //qDebug("CBookmarkIndex::initConnections");
+ //qDebug() << "CBookmarkIndex::initConnections";
bool ok;
ok = connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(slotExecuted(QTreeWidgetItem*)));
Q_ASSERT(ok);
@@ -156,14 +149,14 @@ void CBookmarkIndex::initConnections() {
* Hack to get single click and selection working. See slotExecuted.
*/
void CBookmarkIndex::mouseReleaseEvent(QMouseEvent* event) {
- //qDebug("CBookmarkIndex::mouseReleaseEvent");
+ //qDebug() << "CBookmarkIndex::mouseReleaseEvent";
m_mouseReleaseEventModifiers = event->modifiers();
QTreeWidget::mouseReleaseEvent(event);
}
/** Called when an item is clicked with mouse or activated with keyboard. */
void CBookmarkIndex::slotExecuted( QTreeWidgetItem* i ) {
- qDebug("CBookmarkIndex::slotExecuted");
+ qDebug() << "CBookmarkIndex::slotExecuted";
//HACK: checking the modifier keys from the last mouseReleaseEvent
//depends on executing order: mouseReleaseEvent first, then itemClicked signal
@@ -212,7 +205,7 @@ QMimeData* CBookmarkIndex::dragObject() {
}
void CBookmarkIndex::dragEnterEvent( QDragEnterEvent* event ) {
- //qDebug("CBookmarkIndex::dragEnterEvent");
+ //qDebug() << "CBookmarkIndex::dragEnterEvent";
setState(QAbstractItemView::DraggingState);
QTreeWidget::dragEnterEvent(event);
if (event->source() == this || event->mimeData()->hasFormat("BibleTime/Bookmark")) {
@@ -222,7 +215,7 @@ void CBookmarkIndex::dragEnterEvent( QDragEnterEvent* event ) {
void CBookmarkIndex::dragMoveEvent( QDragMoveEvent* event ) {
- //qDebug("CBookmarkIndex::dragMoveEvent");
+ //qDebug() << "CBookmarkIndex::dragMoveEvent";
// do this first, otherwise the event may be ignored
QTreeWidget::dragMoveEvent(event);
@@ -237,13 +230,15 @@ void CBookmarkIndex::dragMoveEvent( QDragMoveEvent* event ) {
}
void CBookmarkIndex::dragLeaveEvent( QDragLeaveEvent* ) {
- qDebug("CBookmarkIndex::dragLeaveEvent");
+ qDebug() << "CBookmarkIndex::dragLeaveEvent";
setState(QAbstractItemView::NoState); // not dragging anymore
viewport()->update(); // clear the arrow
}
void CBookmarkIndex::paintEvent(QPaintEvent* event) {
+ namespace DU = util::directory;
+
static QPixmap pix;
static int halfPixHeight;
static bool arrowInitialized = false;
@@ -251,14 +246,14 @@ void CBookmarkIndex::paintEvent(QPaintEvent* event) {
// Initialize the static variables, including the arrow pixmap
if (!arrowInitialized) {
arrowInitialized = true;
- int arrowSize = CToolClass::mWidth(this, 1);
+ int arrowSize = util::tool::mWidth(this, 1);
QString fileName;
- if (util::filesystem::DirectoryUtil::getIconDir().exists("pointing_arrow.svg")) {
- fileName = util::filesystem::DirectoryUtil::getIconDir().filePath("pointing_arrow.svg");
+ if (DU::getIconDir().exists("pointing_arrow.svg")) {
+ fileName = DU::getIconDir().filePath("pointing_arrow.svg");
}
else {
- if (util::filesystem::DirectoryUtil::getIconDir().exists("pointing_arrow.png")) {
- fileName = util::filesystem::DirectoryUtil::getIconDir().filePath("pointing_arrow.png");
+ if (DU::getIconDir().exists("pointing_arrow.png")) {
+ fileName = DU::getIconDir().filePath("pointing_arrow.png");
}
else {
qWarning() << "Picture file pointing_arrow.svg or .png not found!";
@@ -323,7 +318,7 @@ void CBookmarkIndex::paintEvent(QPaintEvent* event) {
void CBookmarkIndex::dropEvent( QDropEvent* event ) {
- qDebug("CBookmarkIndex::dropEvent");
+ qDebug() << "CBookmarkIndex::dropEvent";
//setState(QAbstractItemView::NoState);
// Try to prevent annoying timed autocollapsing. Remember to disconnect before return.
@@ -384,7 +379,7 @@ void CBookmarkIndex::dropEvent( QDropEvent* event ) {
if ( event->source() == this ) {
- qDebug("dropping internal drag");
+ qDebug() << "dropping internal drag";
event->accept();
bool bookmarksOnly = true;
@@ -436,7 +431,7 @@ void CBookmarkIndex::dropEvent( QDropEvent* event ) {
void CBookmarkIndex::createBookmarkFromDrop(QDropEvent* event, QTreeWidgetItem* parentItem, int indexInParent) {
- //qDebug("CBookmarkIndex::createBookmarkFromDrop");
+ //qDebug() << "CBookmarkIndex::createBookmarkFromDrop";
//take the bookmark data from the mime source
const BTMimeData* mdata = dynamic_cast<const BTMimeData*>(event->mimeData());
if (mdata) {
@@ -454,7 +449,7 @@ void CBookmarkIndex::createBookmarkFromDrop(QDropEvent* event, QTreeWidgetItem*
/** Load the tree from file */
void CBookmarkIndex::initTree() {
- qDebug("CBookmarkIndex::initTree");
+ qDebug() << "CBookmarkIndex::initTree";
BtBookmarkLoader loader;
addTopLevelItems(loader.loadTree());
@@ -502,7 +497,7 @@ QAction* CBookmarkIndex::action( BtBookmarkItemBase::MenuAction type ) const {
/** Shows the context menu at the given position. */
void CBookmarkIndex::contextMenu(const QPoint& p) {
- //qDebug("CBookmarkIndex::contextMenu");
+ //qDebug() << "CBookmarkIndex::contextMenu";
//setup menu entries depending on current selection
QTreeWidgetItem* i = itemAt(p);
QList<QTreeWidgetItem *> items = selectedItems();
@@ -566,12 +561,12 @@ void CBookmarkIndex::contextMenu(const QPoint& p) {
}
//finally, open the popup
m_popup->exec(mapToGlobal(p));
- //qDebug("CBookmarkIndex::contextMenu end");
+ //qDebug() << "CBookmarkIndex::contextMenu end";
}
/** Adds a new subfolder to the current item. */
void CBookmarkIndex::createNewFolder() {
- //qDebug("CBookmarkIndex::createNewFolder");
+ //qDebug() << "CBookmarkIndex::createNewFolder";
QList<QTreeWidgetItem*> selected = selectedItems();
if (selected.count() > 0) {
BtBookmarkFolder* i = dynamic_cast<BtBookmarkFolder*>(currentItem());
@@ -677,7 +672,7 @@ void CBookmarkIndex::deleteEntries(bool confirm) {
}
}
- if (QMessageBox::question(this, tr("Delete Items"), tr("Do you really want to delete the selected items and child-items?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes) {
+ if (util::showQuestion(this, tr("Delete Items"), tr("Do you really want to delete the selected items and child-items?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes) {
return;
}
}
@@ -697,7 +692,7 @@ a BibleTime mimedata object. It can be dragged and dropped to a text view or som
The internal drag is handled differently, it doesn't use the mimedata (see dropEvent()).
*/
void CBookmarkIndex::startDrag(Qt::DropActions) {
- qDebug("CBookmarkIndex::startDrag");
+ qDebug() << "CBookmarkIndex::startDrag";
QMimeData* mData = dragObject(); // create the data which can be used in other widgets
QDrag* drag = new QDrag(this);
@@ -739,10 +734,10 @@ bool CBookmarkIndex::isMultiAction( const BtBookmarkItemBase::MenuAction type )
/* Saves the bookmarks to the default bookmarks file. */
void CBookmarkIndex::saveBookmarks() {
- qDebug("CBookmarkIndex::saveBookmarks()");
+ qDebug() << "CBookmarkIndex::saveBookmarks()";
BtBookmarkLoader loader;
loader.saveTreeFromRootItem(invisibleRootItem());
- //qDebug("CBookmarkIndex::saveBookmarks end");
+ //qDebug() << "CBookmarkIndex::saveBookmarks end";
}
void CBookmarkIndex::mouseMoveEvent(QMouseEvent* event) {
@@ -751,7 +746,7 @@ void CBookmarkIndex::mouseMoveEvent(QMouseEvent* event) {
// Restart the mag timer if we have moved to another item and shift was not pressed.
QTreeWidgetItem* itemUnderPointer = itemAt(event->pos());
if (itemUnderPointer && (itemUnderPointer != m_previousEventItem) ) {
- //qDebug("CBookmarkIndex::mouseMoveEvent, moved onto another item");
+ //qDebug() << "CBookmarkIndex::mouseMoveEvent, moved onto another item";
if ( !(event->modifiers() & Qt::ShiftModifier)) {
m_magTimer.start(); // see the ctor for the timer properties
}
@@ -767,7 +762,7 @@ void CBookmarkIndex::mouseMoveEvent(QMouseEvent* event) {
}
void CBookmarkIndex::magTimeout() {
- //qDebug("CBookmarkIndex::magTimeout");
+ //qDebug() << "CBookmarkIndex::magTimeout";
QTreeWidgetItem* itemUnderPointer = 0;
if (underMouse()) {
@@ -777,7 +772,7 @@ void CBookmarkIndex::magTimeout() {
if (itemUnderPointer && (m_previousEventItem == itemUnderPointer)) {
BtBookmarkItem* bitem = dynamic_cast<BtBookmarkItem*>(itemUnderPointer);
if (bitem) {
- //qDebug("CBookmarkIndex::timerEvent: update the infodisplay");
+ //qDebug() << "CBookmarkIndex::timerEvent: update the infodisplay";
// Update the mag
if (bitem->module()) {
(CPointers::infoDisplay())->setInfo(
diff --git a/src/frontend/mainindex/bookmarks/cbookmarkindex.h b/src/frontend/mainindex/bookmarks/cbookmarkindex.h
index 748e75d..9da12a6 100644
--- a/src/frontend/mainindex/bookmarks/cbookmarkindex.h
+++ b/src/frontend/mainindex/bookmarks/cbookmarkindex.h
@@ -10,32 +10,28 @@
#ifndef CBOOKMARKINDEX_H
#define CBOOKMARKINDEX_H
-//BibleTime includes
-#include "btbookmarkitembase.h"
+#include "frontend/mainindex/bookmarks/btbookmarkitembase.h"
-class CSwordModuleInfo;
-#include "frontend/displaywindow/cdisplaywindow.h"
-
-#include "util/cpointers.h"
-
-//Qt includes
-#include <QTimer>
-#include <QToolTip>
#include <QList>
+#include <QTimer>
#include <QTreeWidget>
#include <QTreeWidgetItem>
+#include <QToolTip>
+#include "frontend/displaywindow/cdisplaywindow.h"
+#include "util/cpointers.h"
+
+class BTMimeData;
class CSearchDialog;
-class QWidget;
-class QDropEvent;
-class QDragMoveEvent;
+class CSwordModuleInfo;
+class QAction;
class QDragLeaveEvent;
-class BTMimeData;
+class QDragMoveEvent;
+class QDropEvent;
class QMenu;
-class QAction;
-class QPaintEvent;
-
class QMouseEvent;
+class QPaintEvent;
+class QWidget;
/**
* The widget which manages all bookmarks.
@@ -43,7 +39,6 @@ class QMouseEvent;
*/
class CBookmarkIndex : public QTreeWidget {
Q_OBJECT
-
public:
CBookmarkIndex(QWidget *parent);
virtual ~CBookmarkIndex();
diff --git a/src/frontend/mainindex/bookshelf/actionenum.h b/src/frontend/mainindex/bookshelf/actionenum.h
deleted file mode 100644
index e95f3d7..0000000
--- a/src/frontend/mainindex/bookshelf/actionenum.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#ifndef ACTIONENUM_H
-#define ACTIONENUM_H
-
-enum IndexAction {
- EditModule,
- UnlockModule,
- HideModules,
- ShowAllModules,
- SearchModules,
- UpdateModules,
- Grouping,
- AboutModule
-};
-
-#endif
diff --git a/src/frontend/mainindex/bookshelf/btindexfolder.cpp b/src/frontend/mainindex/bookshelf/btindexfolder.cpp
deleted file mode 100644
index 56cc5fc..0000000
--- a/src/frontend/mainindex/bookshelf/btindexfolder.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#include "btindexfolder.h"
-#include "backend/btmoduletreeitem.h"
-#include "util/directoryutil.h"
-
-BTIndexFolder::BTIndexFolder(BTModuleTreeItem* treeItem, QTreeWidgetItem* parent)
- : BTIndexItem(parent) {
- setText(0, treeItem->text());
- setIcon(0, util::filesystem::DirectoryUtil::getIcon(treeItem->iconName()));
-}
diff --git a/src/frontend/mainindex/bookshelf/btindexfolder.h b/src/frontend/mainindex/bookshelf/btindexfolder.h
deleted file mode 100644
index c85e31d..0000000
--- a/src/frontend/mainindex/bookshelf/btindexfolder.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#ifndef BTINDEXFOLDER_H
-#define BTINDEXFOLDER_H
-
-#include "btindexitem.h"
-
-#include <QString>
-
-class BTModuleTreeItem;
-
-/**
- @author The BibleTime team <info@bibletime.info>
-*/
-class BTIndexFolder : public BTIndexItem {
- public:
- BTIndexFolder(BTModuleTreeItem* treeItem, QTreeWidgetItem* p);
-
- ~BTIndexFolder() {}
-};
-
-#endif
diff --git a/src/frontend/mainindex/bookshelf/btindexitem.cpp b/src/frontend/mainindex/bookshelf/btindexitem.cpp
deleted file mode 100644
index 859c150..0000000
--- a/src/frontend/mainindex/bookshelf/btindexitem.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#include "btindexitem.h"
-#include "cbookshelfindex.h"
-
-#include <QTreeWidgetItem>
-#include <QTreeWidget>
-
-
-BTIndexItem::BTIndexItem(QTreeWidgetItem* parent)
- : QTreeWidgetItem(parent) {}
diff --git a/src/frontend/mainindex/bookshelf/btindexitem.h b/src/frontend/mainindex/bookshelf/btindexitem.h
deleted file mode 100644
index 88609a3..0000000
--- a/src/frontend/mainindex/bookshelf/btindexitem.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#ifndef BTINDEXITEM_H
-#define BTINDEXITEM_H
-
-#include "actionenum.h"
-
-#include <QTreeWidgetItem>
-#include <QString>
-
-class QMimeData;
-class QAction;
-
-
-/**
-@author The BibleTime team <info@bibletime.info>
-*/
-class BTIndexItem : public QTreeWidgetItem {
- public:
- /** Those menu actions which are item specific. */
-
- BTIndexItem(QTreeWidgetItem* parent);
- virtual ~BTIndexItem() {};
- /**
- * Enables the given action if it has the "indexActionType" property which this item supports.
- * Handles only those actions which may or may not be supported, not those which
- * are always supported by all items. If the action is not supported in the current state of the
- * item this function does nothing.
- */
- virtual bool enableAction(QAction*) const {
- return false;
- }
-
- //TODO: d'n'd functions so that view can delegate d'n'd to items?
- virtual bool acceptDrop(const QMimeData*) {
- return false;
- }
-};
-
-#endif
diff --git a/src/frontend/mainindex/bookshelf/btindexmodule.cpp b/src/frontend/mainindex/bookshelf/btindexmodule.cpp
deleted file mode 100644
index d8c2301..0000000
--- a/src/frontend/mainindex/bookshelf/btindexmodule.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#include "btindexmodule.h"
-
-#include "backend/btmoduletreeitem.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "util/directoryutil.h"
-#include "frontend/cdragdrop.h"
-
-#include <QIcon>
-#include <QString>
-#include <QDebug>
-#include <QAction>
-
-
-
-BTIndexModule::BTIndexModule(BTModuleTreeItem* treeItem, QTreeWidgetItem* previous)
- : BTIndexItem(previous) {
- //qDebug("BTIndexModule::BTIndexModule");
- setText(0, treeItem->text()); //set text
- setIcon(0, util::filesystem::DirectoryUtil::getIcon(treeItem->iconName()) );
- m_moduleInfo = treeItem->moduleInfo();
- setToolTip(0, CToolClass::moduleToolTip(moduleInfo()) );
-
- setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsSelectable);
- if (!m_moduleInfo->isHidden()) {
- setFlags(flags() | Qt::ItemIsEnabled);
- }
-}
-
-
-BTIndexModule::~BTIndexModule() {
-}
-
-
-bool BTIndexModule::enableAction(QAction* action) const {
- if (!action->isEnabled()) {
- IndexAction actionType = (IndexAction)action->property("indexActionType").toInt();
-
- switch (actionType) {
- case EditModule:
- if (moduleInfo()->isWritable()) action->setEnabled(true);
- break;
- case UnlockModule:
- if (moduleInfo()->isEncrypted()) action->setEnabled(true);
- break;
- case HideModules:
- if (!m_moduleInfo->isHidden()) action->setEnabled(true);
- case UpdateModules:
- break;
- case AboutModule:
- case Grouping:
- case SearchModules:
- case ShowAllModules:
- break;
- }
- }
- return true; //TODO: check, is this correct?
-}
-
-
-bool BTIndexModule::acceptDrop(const QMimeData* data) {
- //TODO: check the module type of the reference, accept only proper type.
- // Bible accepts biblical references and plain text (for search),
- // but it could accept a lexicon entry too for search, especially a Strong's entry.
- // Lexicon could accept lexicon references but also biblical references to find all places where
- // the verse is referred to. Same with genbooks.
-
- const BTMimeData* btData = dynamic_cast<const BTMimeData*>(data);
- if (btData) {
- return true;
- }
- if (data->hasText()) {
- return true;
- }
- return false;
-}
-
-
-CSwordModuleInfo* BTIndexModule::moduleInfo() const {
- return m_moduleInfo;
-}
diff --git a/src/frontend/mainindex/bookshelf/btindexmodule.h b/src/frontend/mainindex/bookshelf/btindexmodule.h
deleted file mode 100644
index d8991ca..0000000
--- a/src/frontend/mainindex/bookshelf/btindexmodule.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#ifndef BTINDEXMODULE_H
-#define BTINDEXMODULE_H
-
-#include "btindexitem.h"
-
-#include "util/ctoolclass.h"
-
-class BTModuleTreeItem;
-class CSwordModuleInfo;
-
-class QAction;
-class QMimeData;
-
-
-class BTIndexModule : public BTIndexItem {
- public:
- BTIndexModule(BTModuleTreeItem* treeItem, QTreeWidgetItem* previous);
-
- ~BTIndexModule();
-
- virtual bool enableAction(QAction* action) const;
- virtual bool acceptDrop(const QMimeData* data);
- CSwordModuleInfo* moduleInfo() const;
-
- private:
- CSwordModuleInfo* m_moduleInfo;
-};
-
-#endif
diff --git a/src/frontend/mainindex/bookshelf/cbookshelfindex.cpp b/src/frontend/mainindex/bookshelf/cbookshelfindex.cpp
deleted file mode 100644
index ebd0ee0..0000000
--- a/src/frontend/mainindex/bookshelf/cbookshelfindex.cpp
+++ /dev/null
@@ -1,714 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#include "cbookshelfindex.h"
-
-#include "btindexitem.h"
-#include "btindexmodule.h"
-#include "btindexfolder.h"
-#include "chidemodulechooserdialog.h"
-
-#include "backend/btmoduletreeitem.h"
-#include "backend/managers/creferencemanager.h"
-
-#include "frontend/searchdialog/csearchdialog.h"
-#include "backend/config/cbtconfig.h"
-#include "frontend/cinfodisplay.h"
-#include "frontend/btaboutmoduledialog.h"
-#include "frontend/cprinter.h"
-#include "frontend/cdragdrop.h"
-
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-
-//Qt includes
-#include <QDragLeaveEvent>
-#include <QDragMoveEvent>
-#include <QDropEvent>
-#include <QHeaderView> //for hiding the header
-#include <QTimer> // for delayed auto-opening of folders
-#include <QList>
-#include <QTreeWidget>
-#include <QTreeWidgetItem>
-#include <QInputDialog> // for unlocking key
-#include <QDebug>
-#include <QMenu>
-
-#include <boost/scoped_ptr.hpp>
-
-
-
-CBookshelfIndex::CBookshelfIndex(QWidget *parent)
- : QTreeWidget(parent),
- m_searchDialog(0),
- m_autoOpenFolder(0),
- m_autoOpenTimer(this) {
- m_grouping = (BTModuleTreeItem::Grouping)CBTConfig::get(CBTConfig::bookshelfGrouping);
- m_showHidden = CBTConfig::get(CBTConfig::bookshelfShowHidden);
- setContextMenuPolicy(Qt::CustomContextMenu);
- initView();
- initConnections();
- initTree();
-}
-
-CBookshelfIndex::~CBookshelfIndex() {}
-
-
-
-/** Initializes the view. */
-void CBookshelfIndex::initView() {
-// qDebug("CBookshelfIndex::initView");
-
- header()->hide();
-
- setFocusPolicy(Qt::WheelFocus);
- setAcceptDrops( false ); // TODO: accept drops
- setDragEnabled( true );
- setDropIndicatorShown( true );
-
- setItemsExpandable(true);
- viewport()->setAcceptDrops(false); //TODO: accept drops
- setRootIsDecorated(false);
- setAllColumnsShowFocus(true);
- setSelectionMode(QAbstractItemView::ExtendedSelection);
-
- //setup the popup menu
- m_popup = new QMenu(viewport());
- m_popup->setTitle(tr("Bookshelf"));
-
- initActions();
-
-// qDebug("CBookshelfIndex::initView end");
-}
-
-void CBookshelfIndex::initActions() {
-
- // Each action has a type attached to it as a dynamic property, see actionenum.h.
- // Menuitem and its subitems can have the same type.
- // Actions can have also "singleItemAction" property if
- // it supports only one item.
- // See contextMenu() and BTIndexItem for how these properties are used later.
-
- // Actions are added to the popup menu and also to a list for easy foreach access.
-
- QMenu* actionMenu = 0;
- QAction* action = 0;
-
- // -------------------------Grouping --------------------------------------
- actionMenu = new QMenu(tr("Grouping"), this);
- actionMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::grouping::icon));
- actionMenu->setProperty("indexActionType", QVariant(Grouping));
-
- m_groupingGroup = new QActionGroup(this);
- QObject::connect(m_groupingGroup, SIGNAL(triggered(QAction*)), this, SLOT(actionChangeGrouping(QAction*)) );
-
- //TODO: set the inital checked state
- action = newQAction(tr("Category/Language"), CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
- action->setCheckable(true);
- action->setProperty("indexActionType", QVariant(Grouping));
- action->setProperty("grouping", BTModuleTreeItem::CatLangMod);
- actionMenu->addAction(action);
- m_groupingGroup->addAction(action);
- if (m_grouping == BTModuleTreeItem::CatLangMod) action->setChecked(true);
- m_actionList.append(action);
-
- action = newQAction(tr("Category"), CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
- action->setCheckable(true);
- m_groupingGroup->addAction(action);
- if (m_grouping == BTModuleTreeItem::CatMod) action->setChecked(true);
- action->setProperty("indexActionType", QVariant(Grouping));
- action->setProperty("grouping", BTModuleTreeItem::CatMod);
- actionMenu->addAction(action);
- m_actionList.append(action);
-
- action = newQAction(tr("Language/Category"), CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
- action->setCheckable(true);
- m_groupingGroup->addAction(action);
- if (m_grouping == BTModuleTreeItem::LangCatMod) action->setChecked(true);
- actionMenu->addAction(action);
- action->setProperty("indexActionType", QVariant(Grouping));
- action->setProperty("grouping", BTModuleTreeItem::LangCatMod);
- m_actionList.append(action);
-
- action = newQAction(tr("Language"), CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
- action->setCheckable(true);
- m_groupingGroup->addAction(action);
- if (m_grouping == BTModuleTreeItem::LangMod) action->setChecked(true);
- actionMenu->addAction(action);
- action->setProperty("indexActionType", QVariant(Grouping));
- action->setProperty("grouping", BTModuleTreeItem::LangMod);
- m_actionList.append(action);
-
- action = newQAction(tr("Works only"), CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
- action->setCheckable(true);
- m_groupingGroup->addAction(action);
- if (m_grouping == BTModuleTreeItem::Mod) action->setChecked(true);
- actionMenu->addAction(action);
- action->setProperty("indexActionType", QVariant(Grouping));
- action->setProperty("grouping", BTModuleTreeItem::Mod);
- m_actionList.append(action);
-
- action = m_popup->addMenu(actionMenu);
- action->setProperty("indexActionType", QVariant(Grouping));
- m_actionList.append(action);
-
-
- // ------------Hide---------------------
- action = newQAction(tr("Hide/unhide works..."), CResMgr::mainIndex::search::icon, 0, this, SLOT(actionHideModules()), this);
- action->setProperty("indexActionType", QVariant(HideModules));
- //action->setProperty("multiItemAction", QVariant(true));
- m_popup->addAction(action);
- m_actionList.append(action);
-
-// -------------------Show hidden---------------------------
- action = newQAction(tr("Show hidden"), CResMgr::mainIndex::search::icon, 0, 0, 0, this);
- action->setProperty("indexActionType", QVariant(ShowAllModules));
- action->setCheckable(true);
- QObject::connect(action, SIGNAL(toggled(bool)), this, SLOT(actionShowModules(bool)));
- if (m_showHidden) action->setChecked(true);
- else action->setChecked(false);
- m_popup->addAction(action);
- m_actionList.append(action);
-
-
- m_popup->addSeparator();
-
- //------------------------------------------------------------
- //----------------- Actions for items ------------------------
-
- // -------------------------Edit module --------------------------------
- actionMenu = new QMenu(tr("Edit"), this);
- actionMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::editModuleMenu::icon) );
-// actionMenu->setDelayed(false);
- actionMenu->setProperty("indexActionType", QVariant(EditModule));
- actionMenu->setProperty("singleItemAction", QVariant(true));
- //m_actionList.append(actionMenu);
-
- action = newQAction(tr("Plain text..."), CResMgr::mainIndex::editModulePlain::icon, 0, this, SLOT(actionEditModulePlain()), this);
- actionMenu->addAction(action);
- m_actionList.append(action);
- action->setProperty("indexActionType", QVariant(EditModule));
- action->setProperty("singleItemAction", QVariant(true));
-
- action = newQAction(tr("HTML..."), CResMgr::mainIndex::editModuleHTML::icon, 0, this, SLOT(actionEditModuleHTML()), this);
- actionMenu->addAction(action);
- m_actionList.append(action);
- action->setProperty("indexActionType", QVariant(EditModule));
- action->setProperty("singleItemAction", QVariant(true));
-
- m_actionList.append(m_popup->addMenu(actionMenu));
-
-
- // ------------------------ Misc actions -------------------------------------
- action = newQAction(tr("Search..."), CResMgr::mainIndex::search::icon, 0, this, SLOT(actionSearchInModules()), this);
- action->setProperty("indexActionType", QVariant(SearchModules));
- action->setProperty("multiItemAction", QVariant(true));
- m_popup->addAction(action);
- m_actionList.append(action);
-
- action = newQAction(tr("Unlock..."), CResMgr::mainIndex::unlockModule::icon, 0, this, SLOT(actionUnlockModule()), this);
- m_popup->addAction(action);
- action->setProperty("indexActionType", QVariant(UnlockModule));
- action->setProperty("singleItemAction", QVariant(true));
- m_actionList.append(action);
-
- action = newQAction(tr("About..."), CResMgr::mainIndex::aboutModule::icon, 0, this, SLOT(actionAboutModule()), this);
- m_popup->addAction(action);
- action->setProperty("singleItemAction", QVariant(true));
- action->setProperty("indexActionType", QVariant(AboutModule));
- m_actionList.append(action);
-
-
-}
-
-/** Convenience function for creating a new QAction.
-* Should be replaced with something better; it was easier to make a new function
-* than to modify all QAction constructors.
-*/
-QAction* CBookshelfIndex::newQAction(const QString& text, const QString& pix, const int /*shortcut*/, const QObject* receiver, const char* slot, QObject* parent) {
- QAction* action = new QAction(util::filesystem::DirectoryUtil::getIcon(pix), text, parent);
- if (receiver && !QString(slot).isEmpty()) {
- QObject::connect(action, SIGNAL(triggered()), receiver, slot);
- }
- return action;
-}
-
-/** Initialize the SIGNAL<->SLOT connections */
-void CBookshelfIndex::initConnections() {
- //Connect this to the backend module list changes.
- bool ok;
- ok = connect(CPointers::backend(), SIGNAL(sigSwordSetupChanged(CSwordBackend::SetupChangedReason)), SLOT(reloadSword(CSwordBackend::SetupChangedReason)));
- Q_ASSERT(ok);
-
- ok = connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(slotExecuted(QTreeWidgetItem*)));
- Q_ASSERT(ok);
-
- // Single/double click item activation is style dependend
- if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) == 0) {
- ok = connect(this, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotExecuted(QTreeWidgetItem*)));
- Q_ASSERT(ok);
- }
-
- ok = connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&)));
- Q_ASSERT(ok);
-
- ok = connect(&m_autoOpenTimer, SIGNAL(timeout()), this, SLOT(autoOpenTimeout()));
- Q_ASSERT(ok);
-
- ok = connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(slotModifySelection()));
- Q_ASSERT(ok);
-}
-
-void CBookshelfIndex::slotModifySelection() {
- // This creates recursion if a folder is selected, but not infinite.
- //qDebug("CBookshelfIndex::slotModifySelection");
- QList<QTreeWidgetItem*> selection = selectedItems();
- foreach (QTreeWidgetItem* item, selection) {
- BTIndexFolder* folder = dynamic_cast<BTIndexFolder*>(item);
- if (folder) {
- item->setSelected(false);
- break;
- }
- }
-}
-
-/**
-* Hack to get single click and selection working. See slotExecuted.
-*/
-void CBookshelfIndex::mouseReleaseEvent(QMouseEvent* event) {
- //qDebug("CBookshelfIndex::mouseReleaseEvent");
- //qDebug() << event->type() << event->modifiers();
- if (itemAt(event->pos())) {
- if (m_frozenModules.contains( itemAt(event->pos())->text(0) )) {
- //do nothing
- event->accept();
- return;
- }
- }
- m_mouseReleaseEventModifiers = event->modifiers();
- QTreeWidget::mouseReleaseEvent(event);
-
-}
-
-/** Called when an item is clicked with mouse or activated with keyboard. */
-void CBookshelfIndex::slotExecuted( QTreeWidgetItem* i ) {
- qDebug("CBookshelfIndex::slotExecuted");
-
- //HACK: checking the modifier keys from the last mouseReleaseEvent
- //depends on executing order: mouseReleaseEvent first, then itemClicked signal
- int modifiers = m_mouseReleaseEventModifiers;
- m_mouseReleaseEventModifiers = Qt::NoModifier;
- if (modifiers != Qt::NoModifier) {
- return;
- }
-
- BTIndexItem* btItem = dynamic_cast<BTIndexItem*>(i);
- if (!btItem) {
- qWarning("item was not BTIndexItem!");
- return;
- }
-
- if (BTIndexModule* m = dynamic_cast<BTIndexModule*>(i)) { //clicked on a module
- CSwordModuleInfo* mod = m->moduleInfo();
- if (!m_frozenModules.contains(mod->name())) {
- m_frozenModules.insert(mod->name());
- QList<CSwordModuleInfo*> modules;
- modules.append(mod);
- qDebug("will emit createReadDisplayWindow");
- emit createReadDisplayWindow(modules, QString::null);
-
- }
- }
- else {
- i->setExpanded( !i->isExpanded() );
- }
-}
-
-void CBookshelfIndex::unfreezeModules(QList<CSwordModuleInfo*> modules) {
- foreach (CSwordModuleInfo* mInfo, modules) {
- m_frozenModules.remove(mInfo->name());
- }
-}
-
-/** Reimplementation. Returns the drag object for the current selection. */
-QMimeData* CBookshelfIndex::dragObject() {
- //TODO: we have to add a mime type "module" if we want to for example enable draggin a module to a displaywindow
- return 0;
-}
-
-
-/** Reimplementation from QTreeWidget. Returns true if the drag is acceptable for the widget. */
-void CBookshelfIndex::dragEnterEvent( QDragEnterEvent* event ) {
- //qDebug("CBookshelfIndex::dragEnterEvent");
- event->acceptProposedAction();
-}
-
-void CBookshelfIndex::dragMoveEvent( QDragMoveEvent* event ) {
- const QPoint pos = event->pos();
-
- BTIndexItem* i = dynamic_cast<BTIndexItem*>(itemAt(pos));
- //TODO: implement accepting drop in item
- if (i && i->acceptDrop(event->mimeData()) ) {
- event->acceptProposedAction();
- }
- else {
- event->ignore();
- }
-}
-
-void CBookshelfIndex::dropEvent( QDropEvent* event ) {
- const QPoint pos = event->pos();
-
- BTIndexItem* i = dynamic_cast<BTIndexItem*>(itemAt(pos));
- //TODO: implement accepting drop in item
- if (i && i->acceptDrop(event->mimeData()) ) {
- QMenu* menu = new QMenu(this);
- QAction* openAction = menu->addAction("Open reference in new subwindow");
- QAction* searchRefAction = menu->addAction("Search for reference as crossreference");
- QAction* searchAction = menu->addAction("Search text");
- QAction* selectedAction = menu->exec(this->mapToGlobal(pos));
- if (selectedAction == openAction) {
- ;
- }
- if (selectedAction == searchAction) {
- ;
- }
- if (selectedAction == searchRefAction) {
- ;
- }
- event->acceptProposedAction();
- }
- else {
- event->ignore();
- }
-}
-
-void CBookshelfIndex::changeEvent(QEvent* e) {
- if (e->type() == QEvent::StyleChange) {
- // Single/double click item activation is style dependend
- QObject::disconnect(this, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotExecuted(QTreeWidgetItem*)));
- if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) == 0) {
- QObject::connect(this, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotExecuted(QTreeWidgetItem*)));
- }
- }
- QTreeWidget::changeEvent(e);
-}
-
-/** No descriptions */
-void CBookshelfIndex::initTree() {
- qDebug("CBookshelfIndex::initTree");
-
- //first clean the tree
- clear();
- //m_grouping = (BTModuleTreeItem::Grouping)CBTConfig::get(CBTConfig::bookshelfGrouping);
-
- BTModuleTreeItem::HiddenOff hiddenFilter;
- QList<BTModuleTreeItem::Filter*> filters;
- if (!m_showHidden) {
- filters.append(&hiddenFilter);
- }
- BTModuleTreeItem root(filters, m_grouping);
- addToTree(&root, this->invisibleRootItem());
-}
-
-void CBookshelfIndex::addToTree(BTModuleTreeItem* item, QTreeWidgetItem* widgetItem) {
- foreach (BTModuleTreeItem* i, item->children()) {
- if (i->type() == BTModuleTreeItem::Module) {
- addToTree(i, new BTIndexModule(i, widgetItem));
- }
- else
- addToTree(i, new BTIndexFolder(i, widgetItem));
- }
- // Possible TODO: if item is Language and it's under Category and Category is Glossaries,
- // add the second language name - but how to add other language group?
- // do we have to modify btmoduletreeitem?
-}
-
-
-/** No descriptions */
-void CBookshelfIndex::emitModulesChosen( QList<CSwordModuleInfo*> modules, QString key ) {
- emit createReadDisplayWindow(modules, key);
-}
-
-
-
-/** Shows the context menu at the given position. */
-void CBookshelfIndex::contextMenu(const QPoint& p) {
- qDebug("CBookshelfIndex::contextMenu");
- qDebug() << "list of actions: ";
- foreach (QAction* action, m_actionList) {
- qDebug() << action->text();
- }
- //setup menu entries depending on current selection
- QTreeWidgetItem* i = itemAt(p);
- qDebug() << "item at point: " << i;
- QList<QTreeWidgetItem *> items = selectedItems();
- //The item which was clicked may not be selected - but don't add folder
- if (i && !dynamic_cast<BTIndexFolder*>(i) && !items.contains(i))
- items.append(i);
-
- // disable those menu entries which are item dependent,
- // dis/enable some others
- qDebug() << "grouping action type:" << (int)Grouping;
- foreach (QAction* action, m_actionList) {
- IndexAction actionType = (IndexAction)action->property("indexActionType").toInt();
- qDebug() << "action type:" << actionType;
- if ( actionType == Grouping ) {
- qDebug() << "grouping action, enabling...";
- action->setEnabled(true);
- qDebug() << action->isEnabled();
- }
- else if (actionType == ShowAllModules) {
- //enabled only if there are hidden modules
- if (!CBTConfig::get(CBTConfig::hiddenModules).empty()) {
- action->setEnabled(true);
- }
- else {
- action->setEnabled(false);
- }
- action->setChecked(m_showHidden);
-
- }
- else if (actionType == SearchModules) {
- action->setText(tr("Search"));
- if (items.count() > 0)
- action->setEnabled(true);
- else action->setEnabled(false);
- }
- else if (actionType == HideModules) {
- //action->setText(tr("Hide"));
- action->setEnabled(true);
- }
- else action->setEnabled(false);
- }
-
-
- if (items.count() == 0) {
- //special handling for no selection: do nothing
- }
-
- if (items.count() == 1) {
- //special handling for one selected item
- qDebug("there was one selected item");
- BTIndexItem* btItem = dynamic_cast<BTIndexItem*>(items.at(0));
-
- if (btItem && !dynamic_cast<BTIndexFolder*>(btItem)) {
- foreach (QAction* action, m_actionList) {
- if ( (IndexAction)action->property("indexActionType").toInt() == AboutModule ) {
- qDebug() << "enabling action" << action->text();
- action->setEnabled(true);
- }
- else if ((IndexAction)action->property("indexActionType").toInt() == SearchModules ) {
- // Change the text of the menu item to reflect the module name
- BTIndexModule* modItem = dynamic_cast<BTIndexModule*>(btItem);
- if (modItem) {
- CSwordModuleInfo* info = modItem->moduleInfo();
- action->setText(tr("Search in %1...").arg(info->name()));
- }
- }
- else {
- qDebug() << "ask item" << items.at(0)->text(0) << "to enable the action" << action->text();
- btItem->enableAction(action);
- }
- qDebug() << "action enabled is: " << action->isEnabled();
- }
- }
- }
- else { // more than one item
- foreach (QAction* action, m_actionList) {
- // Change the text of some menu items to reflect multiple selection
- if ((IndexAction)action->property("indexActionType").toInt() == SearchModules ) {
- action->setText(tr("Search in selected..."));
- }
- // Enable items
- foreach(QTreeWidgetItem* item, items) {
- BTIndexItem* btItem = dynamic_cast<BTIndexItem*>(item);
- if (btItem && !action->property("singleItemAction").isValid()) {
- btItem->enableAction(action);
- }
- }
- }
- }
-
- //finally, open the popup
- m_popup->exec(mapToGlobal(p));
-}
-
-void CBookshelfIndex::actionChangeGrouping(QAction* action) {
- BTModuleTreeItem::Grouping grouping = (BTModuleTreeItem::Grouping)action->property("grouping").toInt();
- m_grouping = grouping;
- CBTConfig::set(CBTConfig::bookshelfGrouping, grouping);
- initTree();
-}
-
-
-/** Opens the searchdialog for the selected modules. */
-void CBookshelfIndex::actionSearchInModules() {
- QList<QTreeWidgetItem *> items = selectedItems();
- QListIterator<QTreeWidgetItem *> it(items);
- QList<CSwordModuleInfo*> modules;
- while (it.hasNext()) {
- if (BTIndexModule* i = dynamic_cast<BTIndexModule*>(it.next())) {
- if (i->moduleInfo()) {
- modules.append(i->moduleInfo());
- }
- }
- }
-
- if (modules.isEmpty()) { //get a list of useful default modules for the search if no modules were selected
- CSwordModuleInfo* m = CBTConfig::get(CBTConfig::standardBible);
- if (m) {
- modules.append(m);
- }
- }
-
- Search::CSearchDialog::openDialog(modules, QString::null);
-}
-
-/** Unlocks the current module. */
-void CBookshelfIndex::actionUnlockModule() {
- if (BTIndexModule* i = dynamic_cast<BTIndexModule*>(currentItem())) {
- bool ok = false;
- const QString unlockKey =
- QInputDialog::getText(
- this,
- tr("Unlock Work"),
- tr("Enter the unlock key for this work."),
- QLineEdit::Normal,
- i->moduleInfo()->config(CSwordModuleInfo::CipherKey),
- &ok
- );
-
- if (ok) {
- i->moduleInfo()->unlock( unlockKey );
- CPointers::backend()->reloadModules(CSwordBackend::OtherChange);
- }
- }
-}
-
-void CBookshelfIndex::actionShowModules(bool checked) {
- qDebug("CBookshelfIndex::actionShowModules");
- m_showHidden = checked;
- CBTConfig::set(CBTConfig::bookshelfShowHidden, m_showHidden);
- // show hidden status is changed, notify others who may rebuild their module lists
- CPointers::backend()->notifyChange(CSwordBackend::HidedModules);
-
-}
-
-void CBookshelfIndex::actionHideModules() {
- qDebug("CBookshelfIndex::actionHideModules");
- QString current;
- if (BTIndexModule* i = dynamic_cast<BTIndexModule*>(currentItem())) {
- current = i->text(0);
- }
-
- QString title(tr("Hide/Unhide Works"));
- QString label(tr("Select the works to be hidden."));
- CHideModuleChooserDialog* dlg = new CHideModuleChooserDialog(this, title, label, current);
- connect(dlg, SIGNAL(modulesChanged(QList<CSwordModuleInfo*>)),
- this, SLOT(setHiddenModules(QList<CSwordModuleInfo*>)));
- int code = dlg->exec();
- if (code == QDialog::Accepted) {
- // notify all who may rebuild their module lists
- CPointers::backend()->notifyChange(CSwordBackend::HidedModules);
- }
-}
-
-
-/** Shows information about the current module. */
-void CBookshelfIndex::actionAboutModule() {
- if (BTIndexModule* i = dynamic_cast<BTIndexModule*>(currentItem())) {
- BTAboutModuleDialog* dialog = new BTAboutModuleDialog(this, i->moduleInfo());
- dialog->show();
- dialog->raise();
- }
-}
-
-/** Reimplementation. Takes care of movable items. */
-void CBookshelfIndex::startDrag(Qt::DropActions /*supportedActions*/) {
-
-}
-
-/** Reimplementation to support the items dragEnter and dragLeave functions. */
-void CBookshelfIndex::contentsDragMoveEvent( QDragMoveEvent* /*event*/ ) {
-// // qWarning("void CBookshelfIndex:: drag move event ( QDragLeaveEvent* e )");
-// CIndexItemBase* i = dynamic_cast<CIndexItemBase*>( itemAt( contentsToViewport(event->pos())) );
-// if (i) {
-// if (i->allowAutoOpen(event) || (i->acceptDrop(event) && i->isFolder() && i->allowAutoOpen(event) && !i->isOpen() && autoOpen()) ) {
-// if (m_autoOpenFolder != i) {
-// m_autoOpenTimer.stop();
-// }
-//
-// m_autoOpenFolder = i;
-// m_autoOpenTimer.start( 400 );
-// }
-// else {
-// m_autoOpenFolder = 0;
-// }
-// }
-// else {
-// m_autoOpenFolder = 0;
-// }
-//
-// QTreeWidget::contentsDragMoveEvent(event);
-}
-
-
-void CBookshelfIndex::autoOpenTimeout() {
- m_autoOpenTimer.stop();
- if (m_autoOpenFolder && !m_autoOpenFolder->isExpanded() && m_autoOpenFolder->childCount()) {
- m_autoOpenFolder->setExpanded(true);
- }
-}
-
-/** No descriptions */
-void CBookshelfIndex::contentsDragLeaveEvent( QDragLeaveEvent* /*e*/ ) {
-// m_autoOpenTimer.stop();
-// QTreeWidget::contentsDragLeaveEvent(e);
-}
-
-
-/** Opens an editor window to edit the modules content. */
-void CBookshelfIndex::actionEditModulePlain() {
- QList<CSwordModuleInfo*> modules;
- QList<QTreeWidgetItem *> items = selectedItems();
- QListIterator<QTreeWidgetItem *> it(items);
- //loop through items
- while (it.hasNext()) {
- if (BTIndexModule* i = dynamic_cast<BTIndexModule*>(it.next())) {
- modules.append(i->moduleInfo());
- }
- }
- if (modules.count() == 1) {
- emit createWriteDisplayWindow(modules.first(), QString::null, CDisplayWindow::PlainTextWindow);
- };
-}
-
-/** Opens an editor window to edit the modules content. */
-void CBookshelfIndex::actionEditModuleHTML() {
- QList<CSwordModuleInfo*> modules;
- QList<QTreeWidgetItem *> items = selectedItems();
- QListIterator<QTreeWidgetItem *> it(items);
- while (it.hasNext()) {
- if (BTIndexModule* i = dynamic_cast<BTIndexModule*>(it.next())) {
- modules.append(i->moduleInfo());
- }
- }
-
- if (modules.count() == 1) {
- emit createWriteDisplayWindow(modules.first(), QString::null, CDisplayWindow::HTMLWindow);
- }
-}
-
-/** Reloads the main index's Sword dependend things like modules */
-void CBookshelfIndex::reloadSword(CSwordBackend::SetupChangedReason) {
- //reload the modules
- qDebug("CBookshelfIndex::reloadSword");
- initTree();
-}
diff --git a/src/frontend/mainindex/bookshelf/cbookshelfindex.h b/src/frontend/mainindex/bookshelf/cbookshelfindex.h
deleted file mode 100644
index b5e821f..0000000
--- a/src/frontend/mainindex/bookshelf/cbookshelfindex.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#ifndef CBOOKSHELFINDEX_H
-#define CBOOKSHELFINDEX_H
-
-//BibleTime includes
-#include "btindexitem.h"
-#include "backend/btmoduletreeitem.h"
-class CSwordModuleInfo;
-#include "frontend/displaywindow/cdisplaywindow.h"
-
-#include "util/cpointers.h"
-
-//Qt includes
-#include <QTimer>
-#include <QList>
-#include <QTreeWidget>
-#include <QTreeWidgetItem>
-
-
-
-class CSearchDialog;
-class QWidget;
-class QDropEvent;
-class QDragMoveEvent;
-class QDragLeaveEvent;
-class BTMimeData;
-class QMenu;
-class QActionGroup;
-class QMouseEvent;
-class BTModuleTreeItem;
-
-
-
-/**
-* The widget which manages the modules. The modules are put into own,
-* fixed subfolders sorted by category and/or language.
-* @author The BibleTime team
-*/
-class CBookshelfIndex : public QTreeWidget {
- Q_OBJECT
-
- public:
- CBookshelfIndex(QWidget *parent);
- virtual ~CBookshelfIndex();
-
- void initTree();
- /**
- * Opens the searchdialog using the given modules using the given search text.
- */
- void emitModulesChosen( QList<CSwordModuleInfo*> modules, QString key );
-
- /** Helper method for "freezing" modules while opening them in windows. */
- void unfreezeModules(QList<CSwordModuleInfo*>);
-
- public slots:
-
- /**
- * Reloads the main index's Sword dependend things like modules
- */
- void reloadSword(CSwordBackend::SetupChangedReason);
-
- /**
- * Opens the searchdialog for the selected modules.
- */
- void actionSearchInModules();
-
- protected:
-
- /** Handle mouse clicks.*/
- virtual void mouseReleaseEvent(QMouseEvent* event);
-
- /** Empty re-implementation to prevent unwanted opening of folders with some styles.*/
- virtual void mouseDoubleClickEvent(QMouseEvent*) {}
-
- /**
- * Initialize the SIGNAL<->SLOT connections
- */
- void initConnections();
- /**
- * Reimplementation. Returns the drag object for the current selection.
- */
- virtual QMimeData* dragObject();
- /**
- * Reimplementation from QTreeWidget (QAbstractItemView). Returns true if the drag is acceptable for the listview.
- */
- virtual void dragEnterEvent( QDragEnterEvent* event );
- virtual void dragMoveEvent( QDragMoveEvent* event );
- virtual void dropEvent( QDropEvent* event );
-
- /** Receive style change event to change single/double click activation behaviour. */
- virtual void changeEvent(QEvent*);
-
- /**
- * Reimplementation from QAbstractItemView. Takes care of movable items.
- */
- virtual void startDrag(Qt::DropActions supportedActions);
- /**
- * TODO: qt4 Reimplementation to support the items dragEnter and dragLeave functions.
- */
- virtual void contentsDragMoveEvent( QDragMoveEvent* event );
- /**
- * Reimplementation.
- */
- virtual void contentsDragLeaveEvent( QDragLeaveEvent* e );
-
-
- protected slots: // Protected slots
- /**
- * Called when the selection is changed.
- */
- void slotModifySelection();
- /**
- * Is called when an item was clicked or activated.
- */
- void slotExecuted( QTreeWidgetItem* );
-
- /**
- * Shows the context menu at the given position.
- */
- void contextMenu(const QPoint&);
-
- /**
- * Changes the grouping.
- */
- void actionChangeGrouping(QAction* action);
-
- /**
- * Shows information about the current module.
- */
-
- /**
- * Show or hide the hidden modules, depending on the action check state.
- */
- void actionShowModules(bool checked);
-
- /**
- * Set the selected modules hidden.
- */
- void actionHideModules();
-
-
- void actionAboutModule();
- /**
- * Unlocks the current module.
- */
- void actionUnlockModule();
- void autoOpenTimeout();
-
- /**
- * Opens a plain text editor window to edit the modules content.
- */
- void actionEditModulePlain();
- /**
- * Opens an HTML editor window to edit the modules content.
- */
- void actionEditModuleHTML();
-
- void addToTree(BTModuleTreeItem* item, QTreeWidgetItem* widgetItem);
-
-
- private:
- CSearchDialog* m_searchDialog;
- //ToolTip* m_toolTip;
- bool m_itemsMovable;
- QTreeWidgetItem* m_autoOpenFolder;
- QTimer m_autoOpenTimer;
- BTModuleTreeItem::Grouping m_grouping; //temporary solution - this should be in config
- QActionGroup* m_groupingGroup;
- int m_mouseReleaseEventModifiers;
- bool m_showHidden;
- QSet<QString> m_frozenModules;
-
- /**
- * Initializes the view.
- */
- void initView();
- void initActions();
-
- /** Convenience function for creating a new QAction. */
- QAction* newQAction(const QString& text, const QString& pix, int shortcut, const QObject* receiver, const char* slot, QObject* parent);
-
- QList<QAction*> m_actionList;
-
- QMenu* m_popup;
-
- signals:
- /**
- * Is emitted when a module should be opened,
- */
- void createReadDisplayWindow( QList<CSwordModuleInfo*>, const QString& );
- /**
- * Is emitted when a write window should be created.
- */
- void createWriteDisplayWindow( CSwordModuleInfo*, const QString&, const CDisplayWindow::WriteWindowType& );
-
-};
-
-#endif
diff --git a/src/frontend/mainindex/bookshelf/chidemodulechooserdialog.cpp b/src/frontend/mainindex/bookshelf/chidemodulechooserdialog.cpp
deleted file mode 100644
index 2888020..0000000
--- a/src/frontend/mainindex/bookshelf/chidemodulechooserdialog.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2007 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#include "chidemodulechooserdialog.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/managers/cswordbackend.h"
-#include "backend/btmoduletreeitem.h"
-
-#include "util/cpointers.h"
-#include "util/cresmgr.h"
-#include "util/ctoolclass.h"
-#include "util/directoryutil.h"
-
-#include <QDialog>
-#include <QButtonGroup>
-#include <QDialogButtonBox>
-#include <QHBoxLayout>
-#include <QSpacerItem>
-#include <QTreeWidget>
-#include <QVBoxLayout>
-#include <QStringList>
-#include <QDebug>
-#include <QHeaderView>
-
-
-CHideModuleChooserDialog::CHideModuleChooserDialog( QWidget* parent, QString title, QString label, QString currentModule)
- : CModuleChooserDialog(parent, title, label),
- m_currentModule(currentModule),
- m_focusItem(0) {
- QObject::connect(this, SIGNAL(modulesChanged(QList<CSwordModuleInfo*>, QTreeWidget*)), this, SLOT(applyHiddenModules(QList<CSwordModuleInfo*>)));
- init();
- if (m_focusItem) {
- treeWidget()->scrollToItem(m_focusItem);
- }
-}
-
-
-void CHideModuleChooserDialog::initModuleItem(BTModuleTreeItem* btItem, QTreeWidgetItem* widgetItem) {
- widgetItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- if (btItem->moduleInfo()->isHidden())
- widgetItem->setCheckState(0, Qt::Checked);
- else
- widgetItem->setCheckState(0, Qt::Unchecked);
- if (m_currentModule == widgetItem->text(0)) {
- m_focusItem = widgetItem;
- }
-}
-
-void CHideModuleChooserDialog::applyHiddenModules(QList<CSwordModuleInfo*> hiddenModules) {
- qDebug("CHideModuleChooserDialog::applyHiddenModules");
- QList<CSwordModuleInfo*> allModules = CPointers::backend()->moduleList();
- foreach(CSwordModuleInfo* i, allModules) {
- if (hiddenModules.contains(i)) {
- i->setHidden(true);
- }
- else {
- i->setHidden(false);
- }
-
- }
-}
diff --git a/src/frontend/mainindex/bookshelf/chidemodulechooserdialog.h b/src/frontend/mainindex/bookshelf/chidemodulechooserdialog.h
deleted file mode 100644
index 3b7984e..0000000
--- a/src/frontend/mainindex/bookshelf/chidemodulechooserdialog.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*********
-*
-* This file is part of BibleTime's source code, http://www.bibletime.info/.
-*
-* Copyright 1999-2008 by the BibleTime developers.
-* The BibleTime source code is licensed under the GNU General Public License version 2.0.
-*
-**********/
-
-#ifndef CHIDEMODULECHOOSERDIALOG_H
-#define CHIDEMODULECHOOSERDIALOG_H
-
-class CSwordModuleInfo;
-
-#include "frontend/cmodulechooserdialog.h"
-
-class QTreeWidgetItem;
-
-class BTModuleTreeItem;
-
-
-
-class CHideModuleChooserDialog : public CModuleChooserDialog {
- Q_OBJECT
- public:
- CHideModuleChooserDialog(QWidget* parent, QString title, QString label, QString currentModule);
- ~CHideModuleChooserDialog() {}
-
- protected:
- virtual void initModuleItem(BTModuleTreeItem* btItem, QTreeWidgetItem* widgetItem);
- protected slots:
- void applyHiddenModules(QList<CSwordModuleInfo*> hiddenModules);
-
-
- private:
- QString m_currentModule;
- QTreeWidgetItem* m_focusItem;
-};
-
-
-
-#endif
diff --git a/src/frontend/mainindex/btbookshelfview.cpp b/src/frontend/mainindex/btbookshelfview.cpp
index b770f13..60b10d1 100644
--- a/src/frontend/mainindex/btbookshelfview.cpp
+++ b/src/frontend/mainindex/btbookshelfview.cpp
@@ -18,6 +18,7 @@
#include "backend/bookshelfmodel/btbookshelftreemodel.h"
#include "backend/drivers/cswordmoduleinfo.h"
+
BtBookshelfView::BtBookshelfView(QWidget *parent)
: QTreeView(parent) {
header()->hide();
diff --git a/src/frontend/mainindex/btbookshelfview.h b/src/frontend/mainindex/btbookshelfview.h
index 112178a..b91d60f 100644
--- a/src/frontend/mainindex/btbookshelfview.h
+++ b/src/frontend/mainindex/btbookshelfview.h
@@ -15,6 +15,7 @@
#include <QTreeView>
+
class CSwordModuleInfo;
class BtBookshelfView: public QTreeView {
diff --git a/src/frontend/profile/cprofile.cpp b/src/frontend/profile/cprofile.cpp
index 95ce53d..9d97b5c 100644
--- a/src/frontend/profile/cprofile.cpp
+++ b/src/frontend/profile/cprofile.cpp
@@ -7,14 +7,14 @@
*
**********/
-#include "cprofile.h"
-#include "util/directoryutil.h"
+#include "frontend/profile/cprofile.h"
-//Qt includes
+#include <QDomDocument>
#include <QFile>
#include <QString>
#include <QTextStream>
-#include <QDomDocument>
+#include "util/directory.h"
+
#define CURRENT_SYNTAX_VERSION 3
@@ -23,16 +23,16 @@ namespace Profile {
CProfile::CProfile( const QString& file, const QString& name )
: m_name(name.isEmpty() ? QObject::tr("unknown") : name),
m_filename(file),
- m_fullscreen(false),
- m_geometry(10, 20, 640, 480),
m_mdiArrangementMode((CMDIArea::MDIArrangementMode)0) { //0 is not a valid enum entry, means "unknown"
+ namespace DU = util::directory;
+
if (!m_filename.isEmpty() && name.isEmpty()) {
loadBasics();
}
else if (m_filename.isEmpty() && !name.isEmpty()) {
m_filename = name;
m_filename.replace(QRegExp("\\s=#."), "_");
- m_filename = util::filesystem::DirectoryUtil::getUserSessionsDir().absolutePath() + "/" + m_filename + ".xml";
+ m_filename = DU::getUserSessionsDir().absolutePath() + "/" + m_filename + ".xml";
init(m_filename);
}
else {
@@ -83,41 +83,23 @@ QList<CProfileWindow*> CProfile::load() {
elem = elem.nextSibling().toElement();
}
if (!mainWindow.isNull()) { //was found
- setFullscreen( (bool)mainWindow.attribute("fullscreen").toInt());
+
+ QByteArray bgeometry;
+ bgeometry += mainWindow.attribute("geometry");
+ setMainwindowGeometry(QByteArray::fromHex(bgeometry));
QByteArray bstate;
bstate += mainWindow.attribute("state");
setMainwindowState(QByteArray::fromHex(bstate));
- QDomElement geometry_element = mainWindow.namedItem("GEOMETRY").toElement();
- QRect rect;
- if (!geometry_element.isNull()) {
- if (geometry_element.hasAttribute("x")) {
- rect.setX(geometry_element.attribute("x").toInt());
- }
- if (geometry_element.hasAttribute("y")) {
- rect.setY(geometry_element.attribute("y").toInt());
- }
- if (geometry_element.hasAttribute("width")) {
- rect.setWidth(geometry_element.attribute("width").toInt());
- }
- if (geometry_element.hasAttribute("height")) {
- rect.setHeight(geometry_element.attribute("height").toInt());
- }
- if (geometry_element.hasAttribute("isMaximized")) {
- this->setMaximized( static_cast<bool>(geometry_element.attribute("isMaximized").toInt()) );
- }
- setGeometry(rect);
- }
-
QDomElement mdi_element = mainWindow.namedItem("MDI").toElement();
if (!mdi_element.isNull()) {
if (mdi_element.hasAttribute("ArrangementMode")) {
this->setMDIArrangementMode((CMDIArea::MDIArrangementMode)mdi_element.attribute("ArrangementMode").toInt());
}
- }
- }
- }
+ }
+ }
+ }
m_profileWindows.clear();
QDomElement elem = document.firstChild().toElement();
@@ -219,20 +201,13 @@ bool CProfile::save(QList<CProfileWindow*> windows) {
//save mainwindow settings
{
QDomElement mainWindow = doc.createElement("MAINWINDOW");
- mainWindow.setAttribute("fullscreen", fullscreen());
+
+ QString sgeometry = QString(getMainwindowGeometry().toHex());
+ mainWindow.setAttribute("geometry", sgeometry);
QString sstate = QString(getMainwindowState().toHex());
mainWindow.setAttribute("state", sstate);
- QDomElement geometry = doc.createElement("GEOMETRY");
- mainWindow.appendChild(geometry);
- const QRect r = this->geometry();
- geometry.setAttribute("x", r.x());
- geometry.setAttribute("y", r.y());
- geometry.setAttribute("width", r.width());
- geometry.setAttribute("height", r.height());
- geometry.setAttribute("isMaximized", static_cast<int>(this->maximized()));
-
QDomElement mdi = doc.createElement("MDI");
mainWindow.appendChild(mdi);
mdi.setAttribute("ArrangementMode", static_cast<int>(this->getMDIArrangementMode()));
@@ -377,36 +352,6 @@ void CProfile::saveBasics() {
}
}
-/** Returns true if the main window was in fullscreen mode as the profile was saved. */
-bool CProfile::fullscreen() const {
- return m_fullscreen;
-}
-
-/** Set the parameter to true if the main window coveres the full screen size. */
-void CProfile::setFullscreen( const bool fullscreen ) {
- m_fullscreen = fullscreen;
-}
-
-/** Returns true if the main window was maximized as the profile was saved. */
-bool CProfile::maximized() const {
- return m_maximized;
-}
-
-/** Set the parameter to true if the main window is maximized. */
-void CProfile::setMaximized( const bool maximized ) {
- m_maximized = maximized;
-}
-
-/** Returns the geometry of the main window */
-const QRect CProfile::geometry() {
- return m_geometry;
-}
-
-/** Stes the geoemtry of the main window */
-void CProfile::setGeometry( const QRect rect ) {
- m_geometry = rect;
-}
-
void CProfile::setMDIArrangementMode(const CMDIArea::MDIArrangementMode newArrangementMode) {
m_mdiArrangementMode = newArrangementMode;
}
@@ -415,6 +360,14 @@ CMDIArea::MDIArrangementMode CProfile::getMDIArrangementMode(void) {
return m_mdiArrangementMode;
}
+void CProfile::setMainwindowGeometry(const QByteArray& geometry) {
+ m_mainwindowGeometry = geometry;
+}
+
+QByteArray CProfile::getMainwindowGeometry() {
+ return m_mainwindowGeometry;
+}
+
void CProfile::setMainwindowState(const QByteArray& state) {
m_mainwindowState = state;
}
diff --git a/src/frontend/profile/cprofile.h b/src/frontend/profile/cprofile.h
index 49f241a..621167e 100644
--- a/src/frontend/profile/cprofile.h
+++ b/src/frontend/profile/cprofile.h
@@ -10,12 +10,11 @@
#ifndef CPROFILE_H
#define CPROFILE_H
-#include "cprofilewindow.h"
+#include <QByteArray>
+#include <QList>
#include "frontend/cmdiarea.h"
+#include "frontend/profile/cprofilewindow.h"
-//Qt includes
-#include <QList>
-#include <QByteArray>
namespace Profile {
@@ -58,14 +57,6 @@ class CProfile {
*/
void setName( const QString& );
/**
- * Returns true if the main window was in fullscreen mode as the profile was saved.
- */
- bool fullscreen() const;
- /**
- * Set the parameter to true if the main window coveres the full screen size.
- */
- void setFullscreen( const bool fullscreen );
- /**
* Returns true if the main window was maximized as the profile was saved.
*/
bool maximized() const;
@@ -74,14 +65,6 @@ class CProfile {
*/
void setMaximized( const bool maximized );
/**
- * Sets the geoemtry of the main window
- */
- void setGeometry( const QRect rect );
- /**
- * Returns the geometry of the main window
- */
- const QRect geometry();
- /**
* Sets the MDI arrangement mode
*/
void setMDIArrangementMode(const CMDIArea::MDIArrangementMode);
@@ -90,6 +73,14 @@ class CProfile {
*/
CMDIArea::MDIArrangementMode getMDIArrangementMode(void);
/**
+ * set mainwindow saveGeometry - size and position of window
+ */
+ void setMainwindowGeometry(const QByteArray& geometry);
+ /**
+ * Return mainwindow saveGeometry - size and position of window
+ */
+ QByteArray getMainwindowGeometry();
+ /**
* set mainwindow saveState - position of docking windows and toolbar
*/
void setMainwindowState(const QByteArray& state);
@@ -108,10 +99,8 @@ class CProfile {
QList<CProfileWindow*> m_profileWindows;
QString m_name;
QString m_filename;
- bool m_fullscreen;
- bool m_maximized;
- QRect m_geometry;
CMDIArea::MDIArrangementMode m_mdiArrangementMode;
+ QByteArray m_mainwindowGeometry;
QByteArray m_mainwindowState;
};
diff --git a/src/frontend/profile/cprofilemgr.cpp b/src/frontend/profile/cprofilemgr.cpp
index 0666fd8..279a562 100644
--- a/src/frontend/profile/cprofilemgr.cpp
+++ b/src/frontend/profile/cprofilemgr.cpp
@@ -7,23 +7,22 @@
*
**********/
+#include "frontend/profile/cprofilemgr.h"
-
-#include "cprofilemgr.h"
-#include "util/directoryutil.h"
-
-//Qt includes
#include <QDir>
#include <QFile>
#include <QList>
+#include "util/directory.h"
namespace Profile {
CProfileMgr::CProfileMgr() : m_startupProfile(0) {
+ namespace DU = util::directory;
+
//m_profiles.setAutoDelete(true);
- m_profilePath = util::filesystem::DirectoryUtil::getUserSessionsDir().absolutePath() + "/";
+ m_profilePath = DU::getUserSessionsDir().absolutePath() + "/";
QDir d( m_profilePath );
QStringList files = d.entryList(QStringList("*.xml"));
diff --git a/src/frontend/profile/cprofilemgr.h b/src/frontend/profile/cprofilemgr.h
index 344333d..462ce93 100644
--- a/src/frontend/profile/cprofilemgr.h
+++ b/src/frontend/profile/cprofilemgr.h
@@ -7,16 +7,13 @@
*
**********/
-
-
#ifndef CPROFILEMGR_H
#define CPROFILEMGR_H
-#include "cprofile.h"
-
-//Qt includes
-#include <QString>
#include <QList>
+#include <QString>
+#include "frontend/profile/cprofile.h"
+
namespace Profile {
/** The manager for profiles.
diff --git a/src/frontend/profile/cprofilewindow.cpp b/src/frontend/profile/cprofilewindow.cpp
index 16b440e..bfeabc8 100644
--- a/src/frontend/profile/cprofilewindow.cpp
+++ b/src/frontend/profile/cprofilewindow.cpp
@@ -7,17 +7,13 @@
*
**********/
+#include "frontend/profile/cprofilewindow.h"
-
-#include "cprofilewindow.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/managers/cswordbackend.h"
-
-
-#include <QString>
#include <QRect>
+#include <QString>
#include <QStringList>
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "backend/managers/cswordbackend.h"
namespace Profile {
diff --git a/src/frontend/profile/cprofilewindow.h b/src/frontend/profile/cprofilewindow.h
index 4b3a700..74294f7 100644
--- a/src/frontend/profile/cprofilewindow.h
+++ b/src/frontend/profile/cprofilewindow.h
@@ -7,19 +7,16 @@
*
**********/
-
-
#ifndef CPROFILEWINDOW_H
#define CPROFILEWINDOW_H
-class CSwordModuleInfo;
-#include "backend/managers/cswordbackend.h"
-
-//Qt includes
-#include <QString>
#include <QRect>
+#include <QString>
#include <QStringList>
-//#include <QList>
+#include "backend/managers/cswordbackend.h"
+
+
+class CSwordModuleInfo;
namespace Profile {
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp b/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp
index 76483de..e638130 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp
+++ b/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp
@@ -7,19 +7,19 @@
*
**********/
-#include "csearchanalysisdialog.h"
-#include "csearchanalysisscene.h"
-#include "csearchanalysisview.h"
+#include "frontend/searchdialog/analysis/csearchanalysisdialog.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "util/dialogutil.h"
-
-#include <QDialog>
#include <QAbstractButton>
-#include <QDialogButtonBox>
-#include <QVBoxLayout>
#include <QApplication>
#include <QDesktopWidget>
+#include <QDialog>
+#include <QDialogButtonBox>
+#include <QVBoxLayout>
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/searchdialog/analysis/csearchanalysisscene.h"
+#include "frontend/searchdialog/analysis/csearchanalysisview.h"
+#include "util/dialogutil.h"
+
namespace Search {
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisdialog.h b/src/frontend/searchdialog/analysis/csearchanalysisdialog.h
index 7c48c15..4bff4a0 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysisdialog.h
+++ b/src/frontend/searchdialog/analysis/csearchanalysisdialog.h
@@ -10,12 +10,12 @@
#ifndef SEARCHCSEARCHANALYSISDIALOG_H
#define SEARCHCSEARCHANALYSISDIALOG_H
-
-class CSwordModuleInfo;
-
#include <QDialog>
+
#include <QObject>
+
+class CSwordModuleInfo;
class QAbstractButton;
class QDialogButtonBox;
@@ -24,14 +24,11 @@ namespace Search {
class CSearchAnalysisView;
class CSearchAnalysisScene;
-
-
/**
@author The BibleTime team <info@bibletime.info>
*/
class CSearchAnalysisDialog : public QDialog {
Q_OBJECT
-
public:
CSearchAnalysisDialog(QList<CSwordModuleInfo*> modules, QWidget* parentDialog);
~CSearchAnalysisDialog() {}
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisitem.cpp b/src/frontend/searchdialog/analysis/csearchanalysisitem.cpp
index fb3810d..b2fc1ad 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysisitem.cpp
+++ b/src/frontend/searchdialog/analysis/csearchanalysisitem.cpp
@@ -7,17 +7,16 @@
*
**********/
-#include "csearchanalysisitem.h"
-#include "csearchanalysisscene.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/searchdialog/analysis/csearchanalysisitem.h"
+#include <QFont>
#include <QGraphicsRectItem>
#include <QPainter>
-#include <QFont>
#include <QPen>
#include <QPoint>
#include <QRect>
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/searchdialog/analysis/csearchanalysisscene.h"
namespace Search {
@@ -141,7 +140,7 @@ const QString CSearchAnalysisItem::getToolTip() {
QString toolTipString = QString("<center><b>%1</b></center><hr/>").arg(m_bookName);
toolTipString += "<table cellspacing=\"0\" cellpadding=\"3\" width=\"100%\" height=\"100%\" align=\"center\">";
- //ToDo: Fix that loop
+ /// \todo Fix that loop
int i = 0;
QList<CSwordModuleInfo*>::iterator end_it = m_moduleList->end();
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisitem.h b/src/frontend/searchdialog/analysis/csearchanalysisitem.h
index 30ba9a3..d5a46a9 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysisitem.h
+++ b/src/frontend/searchdialog/analysis/csearchanalysisitem.h
@@ -10,15 +10,17 @@
#ifndef SEARCHCSEARCHANALYSISITEM_H
#define SEARCHCSEARCHANALYSISITEM_H
-class CSwordModuleInfo;
-
#include <QGraphicsRectItem>
+
#include <QGraphicsScene>
+
+class CSwordModuleInfo;
+
namespace Search {
/**
- @author The BibleTime team <info@bibletime.info>
+ @author The BibleTime team <info@bibletime.info>
*/
class CSearchAnalysisItem : public QGraphicsRectItem {
public:
diff --git a/src/frontend/searchdialog/analysis/csearchanalysislegenditem.cpp b/src/frontend/searchdialog/analysis/csearchanalysislegenditem.cpp
index cb25dab..38b6552 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysislegenditem.cpp
+++ b/src/frontend/searchdialog/analysis/csearchanalysislegenditem.cpp
@@ -7,14 +7,14 @@
*
**********/
-#include "csearchanalysislegenditem.h"
-#include "csearchanalysisscene.h"
-
-#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/searchdialog/analysis/csearchanalysislegenditem.h"
+#include <QFont>
#include <QPainter>
#include <QPen>
-#include <QFont>
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/searchdialog/analysis/csearchanalysisscene.h"
+
namespace Search {
diff --git a/src/frontend/searchdialog/analysis/csearchanalysislegenditem.h b/src/frontend/searchdialog/analysis/csearchanalysislegenditem.h
index a9eebc2..b3110eb 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysislegenditem.h
+++ b/src/frontend/searchdialog/analysis/csearchanalysislegenditem.h
@@ -10,14 +10,15 @@
#ifndef SEARCHCSEARCHANALYSISLEGENDITEM_H
#define SEARCHCSEARCHANALYSISLEGENDITEM_H
-class CSwordModuleInfo;
-
#include <QGraphicsRectItem>
+
+class CSwordModuleInfo;
+
namespace Search {
/**
- @author The BibleTime team <info@bibletime.info>
+ @author The BibleTime team <info@bibletime.info>
*/
class CSearchAnalysisLegendItem : public QGraphicsRectItem {
public:
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisscene.cpp b/src/frontend/searchdialog/analysis/csearchanalysisscene.cpp
index ce093f7..6d486a8 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysisscene.cpp
+++ b/src/frontend/searchdialog/analysis/csearchanalysisscene.cpp
@@ -7,20 +7,17 @@
*
**********/
-#include "csearchanalysisscene.h"
-#include "csearchanalysisitem.h"
-#include "csearchanalysislegenditem.h"
+#include "frontend/searchdialog/analysis/csearchanalysisscene.h"
-#include "frontend/searchdialog/csearchdialog.h"
-
-#include "backend/keys/cswordversekey.h"
-#include "util/ctoolclass.h"
-
-#include <QHashIterator>
+#include <QApplication>
#include <QFileDialog>
+#include <QHashIterator>
#include <QTextCodec>
-#include <QApplication>
-
+#include "backend/keys/cswordversekey.h"
+#include "frontend/searchdialog/analysis/csearchanalysisitem.h"
+#include "frontend/searchdialog/analysis/csearchanalysislegenditem.h"
+#include "frontend/searchdialog/csearchdialog.h"
+#include "util/tool.h"
namespace Search {
@@ -278,7 +275,7 @@ void CSearchAnalysisScene::saveAsHTML() {
text += QString("<center>") + tr("Created by <a href=\"http://www.bibletime.info/\">BibleTime</a>") + QString("</center>");
text += QString("</body></html>");
- CToolClass::savePlainFile(fileName, text, false, QTextCodec::codecForName("UTF8"));
+ util::tool::savePlainFile(fileName, text, false, QTextCodec::codecForName("UTF8"));
}
void CSearchAnalysisScene::resizeHeight(int height) {
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisscene.h b/src/frontend/searchdialog/analysis/csearchanalysisscene.h
index 63abdb9..2a4f171 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysisscene.h
+++ b/src/frontend/searchdialog/analysis/csearchanalysisscene.h
@@ -10,22 +10,22 @@
#ifndef SEARCHCSEARCHANALYSISSCENE_H
#define SEARCHCSEARCHANALYSISSCENE_H
-#include "csearchanalysisitem.h"
-
-class CSwordModuleInfo;
-
-
#include <QGraphicsScene>
+
#include <QColor>
-#include <QMap>
#include <QHash>
+#include <QMap>
+#include "frontend/searchdialog/analysis/csearchanalysisitem.h"
+
+
+class CSwordModuleInfo;
namespace Search {
class CSearchAnalysisLegendItem;
/**
- @author The BibleTime team <info@bibletime.info>
+ @author The BibleTime team <info@bibletime.info>
*/
class CSearchAnalysisScene : public QGraphicsScene {
Q_OBJECT
@@ -79,8 +79,6 @@ class CSearchAnalysisScene : public QGraphicsScene {
int m_maxCount;
double m_scaleFactor;
CSearchAnalysisLegendItem* m_legend;
-
-
};
}
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisview.cpp b/src/frontend/searchdialog/analysis/csearchanalysisview.cpp
index f43f133..7efa604 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysisview.cpp
+++ b/src/frontend/searchdialog/analysis/csearchanalysisview.cpp
@@ -7,12 +7,12 @@
*
**********/
-#include "csearchanalysisview.h"
-#include "csearchanalysisscene.h"
+#include "frontend/searchdialog/analysis/csearchanalysisview.h"
-#include <QWidget>
#include <QGraphicsView>
#include <QResizeEvent>
+#include <QWidget>
+#include "frontend/searchdialog/analysis/csearchanalysisscene.h"
namespace Search {
diff --git a/src/frontend/searchdialog/analysis/csearchanalysisview.h b/src/frontend/searchdialog/analysis/csearchanalysisview.h
index 6b75dfa..e66fc57 100644
--- a/src/frontend/searchdialog/analysis/csearchanalysisview.h
+++ b/src/frontend/searchdialog/analysis/csearchanalysisview.h
@@ -11,8 +11,10 @@
#define SEARCHCSEARCHANALYSISVIEW_H
#include <QGraphicsView>
+
#include <QSize>
+
class QResizeEvent;
namespace Search {
diff --git a/src/frontend/searchdialog/btsearchoptionsarea.cpp b/src/frontend/searchdialog/btsearchoptionsarea.cpp
index d6c3b4f..95c9218 100644
--- a/src/frontend/searchdialog/btsearchoptionsarea.cpp
+++ b/src/frontend/searchdialog/btsearchoptionsarea.cpp
@@ -7,28 +7,27 @@
*
**********/
-#include "btsearchoptionsarea.h"
-#include "csearchmodulechooserdialog.h"
-#include "crangechooserdialog.h"
+#include "frontend/searchdialog/btsearchoptionsarea.h"
-#include "util/directoryutil.h"
-#include "util/cresmgr.h"
-#include "util/ctoolclass.h"
-#include "util/cpointers.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/config/cbtconfig.h"
-#include "frontend/htmldialogs/bttabhtmldialog.h"
-
-#include <QHBoxLayout>
-#include <QGroupBox>
+#include <QDebug>
+#include <QEvent>
#include <QGridLayout>
+#include <QGroupBox>
+#include <QHBoxLayout>
#include <QLabel>
-#include <QPushButton>
-#include <QRadioButton>
-#include <QDebug>
#include <QLineEdit>
#include <QMessageBox>
-#include <QEvent>
+#include <QPushButton>
+#include <QRadioButton>
+#include "backend/config/cbtconfig.h"
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "frontend/htmldialogs/bttabhtmldialog.h"
+#include "frontend/searchdialog/crangechooserdialog.h"
+#include "frontend/searchdialog/csearchmodulechooserdialog.h"
+#include "util/cpointers.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
+#include "util/directory.h"
namespace Search {
@@ -83,6 +82,8 @@ void BtSearchOptionsArea::setSearchText(const QString& text) {
}
void BtSearchOptionsArea::initView() {
+ namespace DU = util::directory;
+
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
this->setSizePolicy(sizePolicy);
hboxLayout = new QHBoxLayout(this);
@@ -102,17 +103,17 @@ void BtSearchOptionsArea::initView() {
m_searchButton = new QPushButton(this);
m_searchButton->setText(tr("&Search"));
- m_searchButton->setIcon( util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::icon));
+ m_searchButton->setIcon(DU::getIcon(CResMgr::searchdialog::icon));
m_searchButton->setToolTip(tr("Start to search the text in the chosen works"));
gridLayout->addWidget(m_searchButton, 0, 2);
m_chooseModulesButton = new QPushButton(tr("Ch&oose..."), searchGroupBox);
- m_chooseModulesButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::chooseworks_icon));
+ m_chooseModulesButton->setIcon(DU::getIcon(CResMgr::searchdialog::chooseworks_icon));
m_chooseModulesButton->setToolTip( tr("Choose works for the search"));
gridLayout->addWidget(m_chooseModulesButton, 2, 2);
m_chooseRangeButton = new QPushButton(tr("S&etup..."), searchGroupBox);
- m_chooseRangeButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::setupscope_icon));
+ m_chooseRangeButton->setIcon(DU::getIcon(CResMgr::searchdialog::setupscope_icon));
m_chooseRangeButton->setToolTip(tr("Configure predefined scopes for search"));
gridLayout->addWidget(m_chooseRangeButton, 3, 2);
@@ -121,10 +122,10 @@ void BtSearchOptionsArea::initView() {
int tsLeft, tsTop, tsRight, tsBottom;
// Added space looks nicer and enhances readability
typeSelectorLayout->getContentsMargins(&tsLeft, &tsTop, &tsRight, &tsBottom);
- typeSelectorLayout->setContentsMargins(tsLeft, 0, tsRight, tsBottom + CToolClass::mWidth(this, 1) );
- typeSelectorLayout->setSpacing(typeSelectorLayout->spacing() + CToolClass::mWidth(this, 1));
+ typeSelectorLayout->setContentsMargins(tsLeft, 0, tsRight, tsBottom + util::tool::mWidth(this, 1) );
+ typeSelectorLayout->setSpacing(typeSelectorLayout->spacing() + util::tool::mWidth(this, 1));
QHBoxLayout* fullButtonLayout = new QHBoxLayout();
- fullButtonLayout->setSpacing(CToolClass::mWidth(this, 1) / 2);
+ fullButtonLayout->setSpacing(util::tool::mWidth(this, 1) / 2);
m_typeAndButton = new QRadioButton(tr("All words"));
m_typeAndButton->setChecked(true);
m_typeOrButton = new QRadioButton(tr("Some words"));
@@ -204,7 +205,7 @@ void BtSearchOptionsArea::initConnections() {
/** Sets the modules used by the search. */
void BtSearchOptionsArea::setModules( QList<CSwordModuleInfo*> modules ) {
- qDebug("BtSearchOptionsArea::setModules");
+ qDebug() << "BtSearchOptionsArea::setModules";
qDebug() << modules;
QString t;
@@ -212,7 +213,7 @@ void BtSearchOptionsArea::setModules( QList<CSwordModuleInfo*> modules ) {
QList<CSwordModuleInfo*>::iterator end_it = modules.end();
for (QList<CSwordModuleInfo*>::iterator it(modules.begin()); it != end_it; ++it) {
- //ToDo: Check for containsRef compat
+ /// \todo Check for containsRef compat
if (*it == 0) { //don't operate on null modules.
continue;
}
@@ -245,12 +246,12 @@ void BtSearchOptionsArea::setModules( QList<CSwordModuleInfo*> modules ) {
historyList.append(m_modulesCombo->itemText(i));
}
CBTConfig::set(CBTConfig::searchModulesHistory, historyList);
- emit( sigSetSearchButtonStatus( (modules.count() != 0) ) );
+ emit sigSetSearchButtonStatus(modules.count() != 0);
}
// Catch activated signal of module selector combobox
void BtSearchOptionsArea::moduleListTextSelected(int index) {
- qDebug("BtSearchOptionsArea::moduleListTextSelected");
+ qDebug() << "BtSearchOptionsArea::moduleListTextSelected";
//create the module list
QString text = m_modulesCombo->itemText(index);
qDebug() << text;
@@ -441,7 +442,7 @@ void BtSearchOptionsArea::refreshRanges() {
//the first option is fixed, the others can be edited using the "Setup ranges" button.
m_rangeChooserCombo->clear();
m_rangeChooserCombo->insertItem(0, QString("[") + tr("No search scope") + QString("]"));
- //TODO: what about this?
+ /// \todo what about this?
//m_rangeChooserCombo->insertItem(tr("Last search result"));
//insert the user-defined ranges
@@ -469,7 +470,7 @@ void BtSearchOptionsArea::addToHistory(const QString& text) {
}
void BtSearchOptionsArea::slotSearchTextEditReturnPressed() {
- qDebug("BtSearchOptionsArea::slotSearchTextEditReturnPressed");
+ qDebug() << "BtSearchOptionsArea::slotSearchTextEditReturnPressed";
m_searchTextCombo->addToHistory( m_searchTextCombo->currentText() );
emit sigStartSearch();
}
@@ -502,7 +503,7 @@ void BtSearchOptionsArea::slotValidateText(const QString& /*newText*/) {
// }
// }
// else {
-// qDebug("AND/OR!");
+// qDebug() << "AND/OR!";
// if (m_typeAndButton->isEnabled()) {
// m_typeOrButton->setChecked(true);
// m_typeOrButton->setEnabled(false);
diff --git a/src/frontend/searchdialog/btsearchoptionsarea.h b/src/frontend/searchdialog/btsearchoptionsarea.h
index 38bba54..c7c1b1c 100644
--- a/src/frontend/searchdialog/btsearchoptionsarea.h
+++ b/src/frontend/searchdialog/btsearchoptionsarea.h
@@ -10,24 +10,22 @@
#ifndef BTSEARCHOPTIONSAREA_H
#define BTSEARCHOPTIONSAREA_H
-#include "chistorycombobox.h"
+#include <QWidget>
#include "backend/keys/cswordversekey.h"
+#include "frontend/searchdialog/chistorycombobox.h"
-#include <QWidget>
class CSwordModuleInfo;
-
-class QGroupBox;
+class QComboBox;
+class QEvent;
class QGridLayout;
+class QGroupBox;
class QHBoxLayout;
class QLabel;
+class QObject;
class QPushButton;
class QRadioButton;
-class QComboBox;
-class QObject;
-class QEvent;
-
namespace Search {
diff --git a/src/frontend/searchdialog/btsearchresultarea.cpp b/src/frontend/searchdialog/btsearchresultarea.cpp
index 04e0415..f56c1b1 100644
--- a/src/frontend/searchdialog/btsearchresultarea.cpp
+++ b/src/frontend/searchdialog/btsearchresultarea.cpp
@@ -7,38 +7,37 @@
*
**********/
-#include "btsearchresultarea.h"
-#include "cmoduleresultview.h"
-#include "csearchresultview.h"
-#include "csearchdialog.h"
-#include "frontend/searchdialog/analysis/csearchanalysisdialog.h"
-
-#include "util/ctoolclass.h"
-#include "frontend/display/cdisplay.h"
-#include "frontend/display/creaddisplay.h"
-#include "backend/rendering/cdisplayrendering.h"
-#include "backend/keys/cswordversekey.h"
+#include "frontend/searchdialog/btsearchresultarea.h"
-#include <QWidget>
-#include <QStringList>
-#include <QVBoxLayout>
-#include <QSize>
-#include <QSplitter>
-#include <QFrame>
#include <QApplication>
+#include <QDebug>
+#include <QFrame>
#include <QProgressDialog>
#include <QPushButton>
+#include <QSize>
+#include <QSplitter>
+#include <QStringList>
+#include <QVBoxLayout>
+#include <QWidget>
+#include "backend/keys/cswordversekey.h"
+#include "backend/rendering/cdisplayrendering.h"
+#include "frontend/display/cdisplay.h"
+#include "frontend/display/creaddisplay.h"
+#include "frontend/searchdialog/analysis/csearchanalysisdialog.h"
+#include "frontend/searchdialog/cmoduleresultview.h"
+#include "frontend/searchdialog/csearchdialog.h"
+#include "frontend/searchdialog/csearchresultview.h"
+#include "util/tool.h"
-#include <QDebug>
namespace Search {
BtSearchResultArea::BtSearchResultArea(QWidget *parent)
: QWidget(parent) {
- qDebug("BtSearchResultArea::BtSearchResultArea");
+ qDebug() << "BtSearchResultArea::BtSearchResultArea";
initView();
initConnections();
- qDebug("BtSearchResultArea::BtSearchResultArea end");
+ qDebug() << "BtSearchResultArea::BtSearchResultArea end";
}
BtSearchResultArea::~BtSearchResultArea() {
@@ -52,7 +51,7 @@ void BtSearchResultArea::initView() {
//Size is calculated from the font rather than set in pixels,
// maybe this is better in different kinds of displays?
- int mWidth = CToolClass::mWidth(this, 1);
+ int mWidth = util::tool::mWidth(this, 1);
this->setMinimumSize(QSize(mWidth*40, mWidth*15));
mainLayout = new QVBoxLayout(this);
mainSplitter = new QSplitter(this);
@@ -207,6 +206,10 @@ QStringList BtSearchResultArea::QueryParser(const QString& queryString) {
token = token + queryString[cnt];
cnt++;
}
+ else if ((queryString[cnt]).isLetterOrNumber() || (queryString[cnt] == '?')) {
+ token = token + queryString[cnt];
+ cnt++;
+ }
// token break
else if (queryString[cnt] == ' ') {
token = token.simplified();
@@ -347,7 +350,7 @@ QString BtSearchResultArea::highlightSearchedText(const QString& content, const
int length = searchedText.length();
// Highlighting constants -
- // TODO: We need to make the highlight color configurable.
+ // \todo We need to make the highlight color configurable.
const QString rep1("<span style=\"background-color:#FFFF66;\">");
const QString rep2("</span>");
const unsigned int repLength = rep1.length() + rep1.length();
@@ -364,7 +367,7 @@ QString BtSearchResultArea::highlightSearchedText(const QString& content, const
QStringList list;
// split the search string - some possibilities are "\\s|\\|", "\\s|\\+", or "\\s|\\|\\+"
- // TODO: find all possible seperators
+ // \todo find all possible seperators
QString regExp = "\\s";
list = searchedText.split(QRegExp(regExp));
foreach (QString newSearchText, list) {
@@ -434,6 +437,7 @@ QString BtSearchResultArea::highlightSearchedText(const QString& content, const
// made a simple parser.
//===========================================================
QStringList words = QueryParser(newSearchText);
+ qDebug() << "btsearchresultarea.cpp: " << __LINE__ << ": " << words << '\n';
foreach (QString word, words) { //search for every word in the list
QRegExp findExp;
if (word.contains("*")) {
@@ -442,6 +446,12 @@ QString BtSearchResultArea::highlightSearchedText(const QString& content, const
findExp = QRegExp(word);
findExp.setMinimal(TRUE);
}
+ else if (word.contains("?")) {
+ length = word.length() - 1;
+ word.replace('?', "\\S?"); //match within a word
+ findExp = QRegExp(word);
+ findExp.setMinimal(TRUE);
+ }
else {
length = word.length();
findExp = QRegExp("\\b" + word + "\\b");
@@ -453,7 +463,7 @@ QString BtSearchResultArea::highlightSearchedText(const QString& content, const
//while ( (index = ret.find(findExp, index)) != -1 ) { //while we found the word
while ( (index = findExp.indexIn(ret, index)) != -1 ) { //while we found the word
matchLen = findExp.matchedLength();
- if (!CToolClass::inHTMLTag(index, ret)) {
+ if (!util::tool::inHTMLTag(index, ret)) {
length = matchLen;
ret = ret.insert( index + length, rep2 );
ret = ret.insert( index, rep1 );
@@ -462,6 +472,7 @@ QString BtSearchResultArea::highlightSearchedText(const QString& content, const
index += length;
}
}
+ qDebug() << "btsearchresultarea.cpp: " << __LINE__ << ": " << words << '\n';
//qWarning("\n\n\n%s", ret.latin1());
return ret;
}
diff --git a/src/frontend/searchdialog/btsearchresultarea.h b/src/frontend/searchdialog/btsearchresultarea.h
index cc87126..f0e3d6e 100644
--- a/src/frontend/searchdialog/btsearchresultarea.h
+++ b/src/frontend/searchdialog/btsearchresultarea.h
@@ -10,26 +10,23 @@
#ifndef BTSEARCHRESULTAREA_H
#define BTSEARCHRESULTAREA_H
-
-#include "backend/managers/cswordbackend.h"
-#include "backend/cswordmodulesearch.h"
-
-#include <QSplitter>
#include <QList>
+#include <QSplitter>
#include <QStringList>
#include <QWidget>
+#include "backend/managers/cswordbackend.h"
+#include "backend/cswordmodulesearch.h"
+
-//forward declarations
-class CReadDisplay;
-class CSwordModuleInfo;
namespace Search {
class CModuleResultView;
class CSearchResultView;
}
-
+class CReadDisplay;
+class CSwordModuleInfo;
+class QFrame;
class QHBoxLayout;
class QTreeWidget;
-class QFrame;
namespace Search {
diff --git a/src/frontend/searchdialog/chistorycombobox.cpp b/src/frontend/searchdialog/chistorycombobox.cpp
index ea854dc..355ed00 100644
--- a/src/frontend/searchdialog/chistorycombobox.cpp
+++ b/src/frontend/searchdialog/chistorycombobox.cpp
@@ -7,9 +7,11 @@
*
**********/
-#include "chistorycombobox.h"
-#include <QString>
+#include "frontend/searchdialog/chistorycombobox.h"
+
#include <QCompleter>
+#include <QString>
+
namespace Search {
diff --git a/src/frontend/searchdialog/chistorycombobox.h b/src/frontend/searchdialog/chistorycombobox.h
index d2828d8..d750e16 100644
--- a/src/frontend/searchdialog/chistorycombobox.h
+++ b/src/frontend/searchdialog/chistorycombobox.h
@@ -12,6 +12,7 @@
#include <QComboBox>
+
namespace Search {
class CHistoryComboBox : public QComboBox {
diff --git a/src/frontend/searchdialog/cmoduleresultview.cpp b/src/frontend/searchdialog/cmoduleresultview.cpp
index f243a61..0228ad2 100644
--- a/src/frontend/searchdialog/cmoduleresultview.cpp
+++ b/src/frontend/searchdialog/cmoduleresultview.cpp
@@ -7,55 +7,56 @@
*
**********/
+#include "frontend/searchdialog/cmoduleresultview.h"
-
-#include "cmoduleresultview.h"
+#include <QAction>
+#include <QContextMenuEvent>
+#include <QHeaderView>
+#include <QMenu>
+#include <QStringList>
+#include <QTreeWidget>
+#include <QDebug>
+#include <QtAlgorithms>
#include "backend/drivers/cswordmoduleinfo.h"
-
#include "frontend/cexportmanager.h"
-
#include "util/cresmgr.h"
-#include "util/ctoolclass.h"
-#include "util/directoryutil.h"
+#include "util/tool.h"
+#include "util/directory.h"
-//Qt includes
-#include <QTreeWidget>
-#include <QAction>
-#include <QStringList>
-#include <QMenu>
-#include <QContextMenuEvent>
-#include <QHeaderView>
namespace Search {
-
/********************************************
************ ModuleResultList **************
********************************************/
CModuleResultView::CModuleResultView(QWidget* parent)
- : QTreeWidget(parent),
- strongsResults(0) {
+ : QTreeWidget(parent) {
initView();
initConnections();
}
-CModuleResultView::~CModuleResultView() {}
+CModuleResultView::~CModuleResultView() {
+ qDeleteAll(strongsResults);
+ strongsResults.clear();
+}
/** Initializes this widget. */
void CModuleResultView::initView() {
+ namespace DU = util::directory;
+
// see also csearchresultview.cpp
setToolTip(tr("Works chosen for the search and the number of the hits in each work"));
setHeaderLabels( QStringList(tr("Work")) << tr("Hits") );
- setColumnWidth(0, CToolClass::mWidth(this, 8));
- setColumnWidth(1, CToolClass::mWidth(this, 4));
- QSize sz(CToolClass::mWidth(this, 13), CToolClass::mWidth(this, 5));
+ setColumnWidth(0, util::tool::mWidth(this, 8));
+ setColumnWidth(1, util::tool::mWidth(this, 4));
+ QSize sz(util::tool::mWidth(this, 13), util::tool::mWidth(this, 5));
//setMinimumSize(sz);
m_size = sz;
- //TODO: sorting
+ /// \todo sorting
//setSorting(0, true);
//setSorting(1, true);
@@ -63,7 +64,7 @@ void CModuleResultView::initView() {
m_popup = new QMenu(this);
m_actions.copyMenu = new QMenu(tr("Copy..."), m_popup);
- m_actions.copyMenu->setIcon(util::filesystem::DirectoryUtil::getIcon( CResMgr::searchdialog::result::moduleList::copyMenu::icon) );
+ m_actions.copyMenu->setIcon(DU::getIcon( CResMgr::searchdialog::result::moduleList::copyMenu::icon) );
m_actions.copy.result = new QAction(tr("Reference only"), this);
QObject::connect(m_actions.copy.result, SIGNAL(triggered()), this, SLOT(copyResult()) );
m_actions.copyMenu->addAction(m_actions.copy.result);
@@ -73,7 +74,7 @@ void CModuleResultView::initView() {
m_popup->addMenu(m_actions.copyMenu);
m_actions.saveMenu = new QMenu(tr("Save..."), m_popup);
- m_actions.saveMenu->setIcon(util::filesystem::DirectoryUtil::getIcon( CResMgr::searchdialog::result::moduleList::saveMenu::icon) );
+ m_actions.saveMenu->setIcon(DU::getIcon( CResMgr::searchdialog::result::moduleList::saveMenu::icon) );
m_actions.save.result = new QAction(tr("Reference only"), this);
QObject::connect(m_actions.save.result, SIGNAL(triggered()), this, SLOT(saveResult()) );
m_actions.saveMenu->addAction(m_actions.save.result);
@@ -83,7 +84,7 @@ void CModuleResultView::initView() {
m_popup->addMenu(m_actions.saveMenu);
m_actions.printMenu = new QMenu(tr("Print..."), m_popup);
- m_actions.printMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::result::moduleList::printMenu::icon));
+ m_actions.printMenu->setIcon(DU::getIcon(CResMgr::searchdialog::result::moduleList::printMenu::icon));
m_actions.print.result = new QAction(tr("Reference with text"), this);
QObject::connect(m_actions.print.result, SIGNAL(triggered()), this, SLOT(printResult()) );
m_actions.printMenu->addAction(m_actions.print.result);
@@ -92,7 +93,7 @@ void CModuleResultView::initView() {
/** Initializes the connections of this widget, */
void CModuleResultView::initConnections() {
- //TODO:
+ /// \todo
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(executed(QTreeWidgetItem*, QTreeWidgetItem*)));
}
@@ -100,7 +101,7 @@ void CModuleResultView::initConnections() {
/** Setups the tree using the given list of modules. */
void CModuleResultView::setupTree( QList<CSwordModuleInfo*> modules, const QString& searchedText ) {
clear();
- //TODO: this class is for sorting
+ /// \todo this class is for sorting
//util::CSortListViewItem* item = 0;
//util::CSortListViewItem* oldItem = 0;
QTreeWidgetItem* item = 0;
@@ -108,10 +109,8 @@ void CModuleResultView::setupTree( QList<CSwordModuleInfo*> modules, const QStri
sword::ListKey result;
- if (strongsResults) {
- delete strongsResults;
- strongsResults = 0;
- }
+ qDeleteAll(strongsResults);
+ strongsResults.clear();
bool strongsAvailable = false;
@@ -121,9 +120,9 @@ void CModuleResultView::setupTree( QList<CSwordModuleInfo*> modules, const QStri
result = (*it)->searchResult();
item = new QTreeWidgetItem(this, QStringList((*it)->name()) << QString::number(result.Count()) );
- //TODO: item->setColumnSorting(1, util::CSortListViewItem::Number);
+ /// \todo item->setColumnSorting(1, util::CSortListViewItem::Number);
- item->setIcon(0, CToolClass::getIconForModule(*it) );
+ item->setIcon(0, util::tool::getIconForModule(*it) );
oldItem = item;
//----------------------------------------------------------------------
// we need to make a decision here. Either don't show any Strong's
@@ -145,7 +144,7 @@ void CModuleResultView::setupTree( QList<CSwordModuleInfo*> modules, const QStri
setupStrongsResults((*it), item, sNumber);
- //TODO: item->setOpen(true);
+ /// \todo item->setOpen(true);
strongsAvailable = true;
}
};
@@ -157,22 +156,22 @@ void CModuleResultView::setupTree( QList<CSwordModuleInfo*> modules, const QStri
void CModuleResultView::setupStrongsResults(CSwordModuleInfo* module, QTreeWidgetItem* parent,
const QString& sNumber) {
QString lText;
- //TODO:
+ /// \todo
//util::CSortListViewItem* item = 0;
QTreeWidgetItem* item = 0;
- strongsResults = new StrongsResultClass(module, sNumber);
+ strongsResults[module] = new StrongsResultClass(module, sNumber);
- for (int cnt = 0; cnt < strongsResults->Count(); ++cnt) {
- lText = strongsResults->keyText(cnt);
+ for (int cnt = 0; cnt < strongsResults[module]->Count(); ++cnt) {
+ lText = strongsResults[module]->keyText(cnt);
- item = new QTreeWidgetItem(parent, QStringList(lText) << QString::number(strongsResults->keyCount(cnt)));
- //TODO:
+ item = new QTreeWidgetItem(parent, QStringList(lText) << QString::number(strongsResults[module]->keyCount(cnt)));
+ /// \todo
//item->setColumnSorting(1, util::CSortListViewItem::Number);
}
}
-//TODO:
+/// \todo
/** Is executed when an item was selected in the list. */
void CModuleResultView::executed( QTreeWidgetItem* i, QTreeWidgetItem*) {
QString itemText, lText;
@@ -188,17 +187,19 @@ void CModuleResultView::executed( QTreeWidgetItem* i, QTreeWidgetItem*) {
return;
}
- if (!strongsResults) {
+ StrongsResultClass* strongsResult = strongsResults[activeModule()];
+
+ if (!strongsResult) {
return;
}
itemText = i->text(0);
- for (int cnt = 0; cnt < strongsResults->Count(); cnt++) {
- lText = strongsResults->keyText(cnt);
+ for (int cnt = 0; cnt < strongsResult->Count(); cnt++) {
+ lText = strongsResult->keyText(cnt);
if (lText == itemText) {
//clear the verses list
emit moduleChanged();
- emit strongsSelected(activeModule(), strongsResults->getKeyList(cnt));
+ emit strongsSelected(activeModule(), strongsResult->getKeyList(cnt));
return;
}
}
@@ -228,7 +229,7 @@ CSwordModuleInfo* CModuleResultView::activeModule() {
/** Reimplementation from QWidget. */
void CModuleResultView::contextMenuEvent( QContextMenuEvent * event ) {
- qDebug("CModuleResultView::showPopup");
+ qDebug() << "CModuleResultView::showPopup";
//make sure that all entries have the correct status
m_popup->exec(event->globalPos());
}
diff --git a/src/frontend/searchdialog/cmoduleresultview.h b/src/frontend/searchdialog/cmoduleresultview.h
index 4295f82..ab48f60 100644
--- a/src/frontend/searchdialog/cmoduleresultview.h
+++ b/src/frontend/searchdialog/cmoduleresultview.h
@@ -7,34 +7,25 @@
*
**********/
-
-
#ifndef CMODULERESULTSVIEW_H
#define CMODULERESULTSVIEW_H
-//BibleTime includes
-#include "btsearchresultarea.h"
+#include <QTreeWidget>
-//Qt includes
#include <QLabel>
-#include <QTreeWidget>
+#include "frontend/searchdialog/btsearchresultarea.h"
-//forward declarations
class CSwordModuleInfo;
-
-class QPoint;
-class QMenu;
class QAction;
-class QStringList;
class QContextMenuEvent;
-
+class QMenu;
+class QPoint;
+class QStringList;
class StrongsResultClass;
-
namespace Search {
-
class CModuleResultView : public QTreeWidget {
Q_OBJECT
public:
@@ -128,7 +119,7 @@ class CModuleResultView : public QTreeWidget {
QMenu* m_popup;
- StrongsResultClass* strongsResults;
+ QHash<CSwordModuleInfo*, StrongsResultClass*> strongsResults;
QSize m_size;
};
diff --git a/src/frontend/searchdialog/crangechooserdialog.cpp b/src/frontend/searchdialog/crangechooserdialog.cpp
index 58175f9..335fc5e 100644
--- a/src/frontend/searchdialog/crangechooserdialog.cpp
+++ b/src/frontend/searchdialog/crangechooserdialog.cpp
@@ -7,35 +7,29 @@
*
**********/
+#include "frontend/searchdialog/crangechooserdialog.h"
-
-#include "crangechooserdialog.h"
-
+#include <QDialogButtonBox>
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QListWidget>
+#include <QListWidgetItem>
+#include <QPushButton>
+#include <QString>
+#include <QTextEdit>
+#include <QVBoxLayout>
#include "backend/config/cbtconfig.h"
#include "util/dialogutil.h"
-//sword
+// Sword includes:
#include "versekey.h"
#include "listkey.h"
-
-
-#include <QListWidget>
-#include <QListWidgetItem>
-#include <QString>
-#include <QLabel>
-#include <QPushButton>
-#include <QTextEdit>
-#include <QLineEdit>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QFrame>
-#include <QDialogButtonBox>
-
namespace Search {
-
/********** RangeItem ******************/
CRangeChooserDialog::RangeItem::RangeItem(QListWidget* view, QListWidgetItem* /*afterThis*/, const QString caption, const QString range)
: QListWidgetItem(view) {
@@ -185,7 +179,7 @@ void CRangeChooserDialog::initConnections() {
/** Adds a new range to the list. */
void CRangeChooserDialog::addNewRange() {
- //qDebug("CRangeChooserDialog::addNewRange");
+ //qDebug() << "CRangeChooserDialog::addNewRange";
//RangeItem* i = new RangeItem(m_rangeList, m_rangeList->lastItem(), tr("New range"));
RangeItem* i = new RangeItem(m_rangeList, 0, tr("New range"));
//use just setCurrentItem... m_rangeList->setSelected(i, true);
@@ -197,7 +191,7 @@ void CRangeChooserDialog::addNewRange() {
/** No descriptions */
void CRangeChooserDialog::editRange(QListWidgetItem* item) {
- //qDebug("CRangeChooserDialog::editRange");
+ //qDebug() << "CRangeChooserDialog::editRange";
RangeItem* const range = dynamic_cast<RangeItem*>(item);
m_nameEdit->setEnabled( range ); //only if an item is selected enable the edit part
@@ -213,10 +207,10 @@ void CRangeChooserDialog::editRange(QListWidgetItem* item) {
/** Parses the entered text and prints out the result in the list box below the edit area. */
void CRangeChooserDialog::parseRange() {
- //qDebug("CRangeChooserDialog::parseRange");
+ //qDebug() << "CRangeChooserDialog::parseRange";
m_resultList->clear();
- //TODO: remove this hack:
+ /// \todo remove this hack:
//HACK: repair range to work with Sword 1.5.6
QString range( m_rangeEdit->toPlainText() );
range.replace(QRegExp("\\s{0,}-\\s{0,}"), "-" );
@@ -232,11 +226,11 @@ void CRangeChooserDialog::parseRange() {
/** No descriptions */
void CRangeChooserDialog::rangeChanged() {
- //qDebug("CRangeChooserDialog::rangeChanged");
+ //qDebug() << "CRangeChooserDialog::rangeChanged";
if (RangeItem* i = dynamic_cast<RangeItem*>(m_rangeList->currentItem())
) {
QString range( m_rangeEdit->toPlainText() );
- //TODO: remove this hack:
+ /// \todo remove this hack:
//HACK: repair range to work with Sword 1.5.6
range.replace(QRegExp("\\s{0,}-\\s{0,}"), "-" );
i->setRange(range);
@@ -245,7 +239,7 @@ void CRangeChooserDialog::rangeChanged() {
/** No descriptions */
void CRangeChooserDialog::nameChanged(const QString& newCaption) {
- //qDebug("CRangeChooserDialog::nameChanged");
+ //qDebug() << "CRangeChooserDialog::nameChanged";
m_rangeEdit->setEnabled(!newCaption.isEmpty());
m_resultList->setEnabled(!newCaption.isEmpty());
//m_resultList->header()->setEnabled(!newCaption.isEmpty());
@@ -271,7 +265,7 @@ void CRangeChooserDialog::nameChanged(const QString& newCaption) {
/** Deletes the selected range. */
void CRangeChooserDialog::deleteCurrentRange() {
- //qDebug("CRangeChooserDialog::deleteCurrentRange");
+ //qDebug() << "CRangeChooserDialog::deleteCurrentRange";
if (RangeItem* i = dynamic_cast<RangeItem*>(m_rangeList->currentItem()) ) {
int row = m_rangeList->row(i);
m_rangeList->takeItem(row);
@@ -296,7 +290,7 @@ void CRangeChooserDialog::slotOk() {
}
void CRangeChooserDialog::slotDefault() {
- //qDebug("CRangeChooserDialog::slotDefault");
+ //qDebug() << "CRangeChooserDialog::slotDefault";
m_rangeList->clear();
CBTConfig::StringMap map = CBTConfig::getDefault(CBTConfig::searchScopes);
CBTConfig::StringMap::Iterator it;
diff --git a/src/frontend/searchdialog/crangechooserdialog.h b/src/frontend/searchdialog/crangechooserdialog.h
index 8711eab..b665a8f 100644
--- a/src/frontend/searchdialog/crangechooserdialog.h
+++ b/src/frontend/searchdialog/crangechooserdialog.h
@@ -7,20 +7,19 @@
*
**********/
-
-
#ifndef CRANGECHOOSERDIALOG_H
#define CRANGECHOOSERDIALOG_H
#include <QDialog>
+
#include <QListWidgetItem>
-class QListWidget;
+
+class QDialogButtonBox;
class QLineEdit;
-class QTextEdit;
+class QListWidget;
class QPushButton;
-class QDialogButtonBox;
-
+class QTextEdit;
namespace Search {
@@ -28,7 +27,7 @@ class CRangeChooserDialog : public QDialog {
Q_OBJECT
public:
CRangeChooserDialog(QWidget* parentDialog);
- ~CRangeChooserDialog() {};
+ ~CRangeChooserDialog() {}
protected: // Protected methods
class RangeItem : public QListWidgetItem {
diff --git a/src/frontend/searchdialog/csearchdialog.cpp b/src/frontend/searchdialog/csearchdialog.cpp
index 221be09..8442c61 100644
--- a/src/frontend/searchdialog/csearchdialog.cpp
+++ b/src/frontend/searchdialog/csearchdialog.cpp
@@ -6,32 +6,31 @@
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
-#include "csearchdialog.h"
-#include "btsearchoptionsarea.h"
-#include "btsearchresultarea.h"
+#include "frontend/searchdialog/csearchdialog.h"
+
+#include <QDebug>
+#include <QDialogButtonBox>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QSettings>
+#include <QSizePolicy>
+#include <QString>
+#include <QRegExp>
+#include <QVBoxLayout>
+#include <QWidget>
+
+#include "backend/config/cbtconfig.h"
#include "backend/cswordmodulesearch.h"
#include "backend/keys/cswordkey.h"
#include "backend/keys/cswordversekey.h"
-#include "backend/config/cbtconfig.h"
-
#include "frontend/cmoduleindexdialog.h"
-
+#include "frontend/searchdialog/btsearchoptionsarea.h"
+#include "frontend/searchdialog/btsearchresultarea.h"
#include "util/cresmgr.h"
-#include "util/ctoolclass.h"
-#include "util/directoryutil.h"
+#include "util/directory.h"
+#include "util/dialogutil.h"
-//Qt includes
-#include <QString>
-#include <QWidget>
-#include <QMessageBox>
-#include <QVBoxLayout>
-#include <QLineEdit>
-#include <QSettings>
-#include <QDialogButtonBox>
-#include <QPushButton>
-#include <QSizePolicy>
-#include <QDebug>
namespace Search {
@@ -64,6 +63,12 @@ void CSearchDialog::openDialog(const QList<CSwordModuleInfo*> modules, const QSt
m_staticDialog->activateWindow();
}
+void CSearchDialog::closeDialog()
+{
+ if (m_staticDialog != 0)
+ m_staticDialog->closeButtonClicked();
+}
+
CSearchDialog* CSearchDialog::getSearchDialog() {
Q_ASSERT(m_staticDialog);
return m_staticDialog;
@@ -72,7 +77,9 @@ CSearchDialog* CSearchDialog::getSearchDialog() {
CSearchDialog::CSearchDialog(QWidget *parent)
: QDialog(parent), /*m_searchButton(0),*/ m_closeButton(0),
m_searchResultArea(0), m_searchOptionsArea(0) {
- setWindowIcon( util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::icon) );
+ namespace DU = util::directory;
+
+ setWindowIcon(DU::getIcon(CResMgr::searchdialog::icon));
setWindowTitle(tr("Search"));
setAttribute(Qt::WA_DeleteOnClose);
m_searcher.connectFinished( this, SLOT(searchFinished()));
@@ -90,8 +97,13 @@ void CSearchDialog::startSearch() {
QString originalSearchText(m_searchOptionsArea->searchText());
QString searchText("");
- if (originalSearchText.isEmpty()) {
- return;
+ // first check the search string for errors
+ {
+ QString TestString(originalSearchText);
+ QRegExp ReservedWords("heading:|footnote:|morph:|strong:");
+ if (TestString.replace(ReservedWords, "").simplified().isEmpty()) {
+ return;
+ }
}
searchText = prepareSearchText(originalSearchText);
@@ -101,11 +113,10 @@ void CSearchDialog::startSearch() {
// check that we have the indices we need for searching
if (!m_searcher.modulesHaveIndices( modules() ) ) {
- int result = QMessageBox::question(this, tr("Missing indices"),
- tr("One or more works need indexing before they can be searched.\n"
- "This could take a long time. Proceed with indexing?"),
- QMessageBox::Yes | QMessageBox::Default,
- QMessageBox::No | QMessageBox::Escape);
+ int result = util::showQuestion(this, tr("Missing indices"),
+ tr("One or more works need indexing before they can be searched.\n"
+ "This could take a long time. Proceed with indexing?"),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
// In SuSE 10.0 the result is the logical or of the button type, just like it is
// inputed into the QMessageBox.
if ( (result == (QMessageBox::Yes | QMessageBox::Default)) ||
@@ -205,6 +216,8 @@ void CSearchDialog::setSearchText( const QString searchText ) {
/** Initializes this object. */
void CSearchDialog::initView() {
+ namespace DU = util::directory;
+
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
setLayout(verticalLayout);
@@ -224,7 +237,7 @@ void CSearchDialog::initView() {
m_closeButton = new QPushButton(this);
m_closeButton->setText(tr("&Close"));
- m_closeButton->setIcon( util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::close_icon));
+ m_closeButton->setIcon(DU::getIcon(CResMgr::searchdialog::close_icon));
horizontalLayout->addWidget(m_closeButton);
verticalLayout->addLayout(horizontalLayout);
diff --git a/src/frontend/searchdialog/csearchdialog.h b/src/frontend/searchdialog/csearchdialog.h
index a250bc7..98034fc 100644
--- a/src/frontend/searchdialog/csearchdialog.h
+++ b/src/frontend/searchdialog/csearchdialog.h
@@ -10,37 +10,31 @@
#ifndef CSEARCHDIALOG_H
#define CSEARCHDIALOG_H
-//BibleTime includes
-#include "backend/managers/cswordbackend.h"
-#include "backend/cswordmodulesearch.h"
-
-#include "util/cpointers.h"
+#include <QDialog>
-//Qt includes
#include <QString>
-#include <QDialog>
+#include "backend/cswordmodulesearch.h"
+#include "backend/managers/cswordbackend.h"
+#include "util/cpointers.h"
-//forward declarations
namespace Search {
class BtSearchResultArea;
class BtSearchOptionsArea;
}
-
-class QWidget;
class QPushButton;
-
+class QWidget;
namespace Search {
/**
*@author The BibleTime team
*/
-class CSearchDialog : public QDialog {
+class CSearchDialog : public QDialog {
Q_OBJECT
-
public:
static void openDialog(const QList<CSwordModuleInfo*> modules, const QString& searchText = QString::null, QWidget* parentDialog = 0);
+ static void closeDialog();
protected:
friend class CSearchAnalysisScene;
diff --git a/src/frontend/searchdialog/csearchmodulechooserdialog.cpp b/src/frontend/searchdialog/csearchmodulechooserdialog.cpp
index 6c183ca..d09ae2a 100644
--- a/src/frontend/searchdialog/csearchmodulechooserdialog.cpp
+++ b/src/frontend/searchdialog/csearchmodulechooserdialog.cpp
@@ -7,27 +7,25 @@
*
**********/
-#include "csearchmodulechooserdialog.h"
+#include "frontend/searchdialog/csearchmodulechooserdialog.h"
-#include "backend/drivers/cswordmoduleinfo.h"
-#include "backend/managers/cswordbackend.h"
-#include "backend/btmoduletreeitem.h"
-
-#include "util/cpointers.h"
-#include "util/cresmgr.h"
-#include "util/ctoolclass.h"
-#include "util/directoryutil.h"
-
-#include <QDialog>
#include <QButtonGroup>
+#include <QDebug>
+#include <QDialog>
#include <QDialogButtonBox>
#include <QHBoxLayout>
+#include <QHeaderView>
#include <QSpacerItem>
+#include <QStringList>
#include <QTreeWidget>
#include <QVBoxLayout>
-#include <QStringList>
-#include <QDebug>
-#include <QHeaderView>
+#include "backend/btmoduletreeitem.h"
+#include "backend/drivers/cswordmoduleinfo.h"
+#include "backend/managers/cswordbackend.h"
+#include "util/cpointers.h"
+#include "util/cresmgr.h"
+#include "util/directory.h"
+
namespace Search {
diff --git a/src/frontend/searchdialog/csearchmodulechooserdialog.h b/src/frontend/searchdialog/csearchmodulechooserdialog.h
index ab9f5cc..bfa6126 100644
--- a/src/frontend/searchdialog/csearchmodulechooserdialog.h
+++ b/src/frontend/searchdialog/csearchmodulechooserdialog.h
@@ -1,26 +1,21 @@
-//
-// C++ Interface: cmodulechooserdialog
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef CSEARCHMODULECHOOSERDIALOG_H
#define CSEARCHMODULECHOOSERDIALOG_H
-class CSwordModuleInfo;
-
#include "frontend/cmodulechooserdialog.h"
-class QTreeWidgetItem;
class BTModuleTreeItem;
-
+class CSwordModuleInfo;
+class QTreeWidgetItem;
namespace Search {
diff --git a/src/frontend/searchdialog/csearchresultview.cpp b/src/frontend/searchdialog/csearchresultview.cpp
index f13b9d2..fc137e2 100644
--- a/src/frontend/searchdialog/csearchresultview.cpp
+++ b/src/frontend/searchdialog/csearchresultview.cpp
@@ -7,28 +7,24 @@
*
**********/
-#include "csearchresultview.h"
+#include "frontend/searchdialog/csearchresultview.h"
+#include <QContextMenuEvent>
+#include <QList>
+#include <QMenu>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QWidget>
+#include <QDebug>
#include "backend/keys/cswordversekey.h"
-
#include "frontend/cdragdrop.h"
#include "frontend/cexportmanager.h"
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
-
-#include <QWidget>
-#include <QMenu>
-#include <QList>
-#include <QTreeWidget>
-#include <QTreeWidgetItem>
-#include <QContextMenuEvent>
-
-//KDE includes
+#include "util/directory.h"
namespace Search {
-
CSearchResultView::CSearchResultView(QWidget* parent)
: QTreeWidget(parent),
m_module(0) {
@@ -40,6 +36,8 @@ CSearchResultView::~CSearchResultView() {}
/** Initializes the view of this widget. */
void CSearchResultView::initView() {
+ namespace DU = util::directory;
+
setToolTip(tr("Search result of the selected work"));
setHeaderLabel(tr("Results"));
setDragEnabled(true);
@@ -50,7 +48,7 @@ void CSearchResultView::initView() {
m_popup = new QMenu(this);
m_actions.copyMenu = new QMenu(tr("Copy..."), m_popup);
- m_actions.copyMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::result::foundItems::copyMenu::icon));
+ m_actions.copyMenu->setIcon(DU::getIcon(CResMgr::searchdialog::result::foundItems::copyMenu::icon));
m_actions.copy.result = new QAction(tr("Reference only"), this);
QObject::connect(m_actions.copy.result, SIGNAL(triggered()), this, SLOT(copyItems()) );
@@ -64,7 +62,7 @@ void CSearchResultView::initView() {
m_popup->addMenu(m_actions.copyMenu);
m_actions.saveMenu = new QMenu(tr("Save..."), m_popup);
- m_actions.saveMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::result::foundItems::saveMenu::icon));
+ m_actions.saveMenu->setIcon(DU::getIcon(CResMgr::searchdialog::result::foundItems::saveMenu::icon));
m_actions.save.result = new QAction(tr("Reference only"), this);
QObject::connect(m_actions.save.result, SIGNAL(triggered()), this, SLOT(saveItems()) );
@@ -76,7 +74,7 @@ void CSearchResultView::initView() {
m_popup->addMenu(m_actions.saveMenu);
m_actions.printMenu = new QMenu(tr("Print..."), m_popup);
- m_actions.printMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::searchdialog::result::foundItems::printMenu::icon));
+ m_actions.printMenu->setIcon(DU::getIcon(CResMgr::searchdialog::result::foundItems::printMenu::icon));
m_actions.print.result = new QAction(tr("Reference with text"), this);
QObject::connect(m_actions.print.result, SIGNAL(triggered()), this, SLOT(printItems()) );
@@ -88,7 +86,7 @@ void CSearchResultView::initView() {
void CSearchResultView::initConnections() {
// connect(this, SIGNAL(executed(QListViewItem*)),
// this, SLOT(executed(QListViewItem*)));
- //TODO: are these right after porting?
+ /// \todo are these right after porting?
//items: current, previous
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(executed(QTreeWidgetItem*, QTreeWidgetItem*)));
@@ -145,12 +143,12 @@ void CSearchResultView::setupStrongsTree(CSwordModuleInfo* m, QStringList* vList
setUpdatesEnabled(true);
- //TODO:select the first item
+ /// \todo select the first item
//setSelected(firstChild(), true);
//executed(currentItem());
}
-//TODO: is this still valid?
+/// \todo is this still valid?
/** Is connected to the signal executed, which is emitted when a mew item was chosen. */
void CSearchResultView::executed(QTreeWidgetItem* current, QTreeWidgetItem*) {
if (current) {
@@ -161,10 +159,10 @@ void CSearchResultView::executed(QTreeWidgetItem* current, QTreeWidgetItem*) {
}
}
-//TODO: another function?
+/// \todo another function?
/** Reimplementation to show the popup menu. */
void CSearchResultView::contextMenuEvent(QContextMenuEvent* event) {
- qDebug("CSearchResultView::showPopup");
+ qDebug() << "CSearchResultView::showPopup";
m_popup->exec(event->globalPos());
}
@@ -255,7 +253,7 @@ CSwordModuleInfo* CSearchResultView::module() {
return m_module;
}
-//TODO: port this to the new d'n'd
+/// \todo port this to the new d'n'd
// Q3DragObject* CSearchResultView::dragObject() {
// //return a valid DragObject to make DnD possible!
//
diff --git a/src/frontend/searchdialog/csearchresultview.h b/src/frontend/searchdialog/csearchresultview.h
index 071ccac..52e6929 100644
--- a/src/frontend/searchdialog/csearchresultview.h
+++ b/src/frontend/searchdialog/csearchresultview.h
@@ -14,10 +14,10 @@ class CSwordModuleInfo;
#include <QTreeWidget>
-//forward declarations
-class QMenu;
-class QAction;
+
class CReadDisplay;
+class QAction;
+class QMenu;
namespace Search {
diff --git a/src/frontend/settingsdialogs/btshortcutsdialog.cpp b/src/frontend/settingsdialogs/btshortcutsdialog.cpp
index 4d16664..ec92855 100644
--- a/src/frontend/settingsdialogs/btshortcutsdialog.cpp
+++ b/src/frontend/settingsdialogs/btshortcutsdialog.cpp
@@ -7,14 +7,16 @@
*
**********/
-#include "btshortcutsdialog.h"
+#include "frontend/settingsdialogs/btshortcutsdialog.h"
+#include "util/dialogutil.h"
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include <QRadioButton>
-#include <QLabel>
#include <QDialogButtonBox>
+#include <QGridLayout>
#include <QKeyEvent>
+#include <QLabel>
+#include <QRadioButton>
+#include <QVBoxLayout>
+
// *************** BtShortcutsDialog ***************************************************************************
// A dialog to allow the user to input a shortcut for a primary and alternate key
@@ -31,24 +33,31 @@ BtShortcutsDialog::BtShortcutsDialog(QWidget* parent)
QGridLayout* gridLayout = new QGridLayout();
vLayout->addLayout(gridLayout);
+ QString dialogTooltip = tr("Select first or second shortcut and type the shortcut with keyboard");
+
m_primaryButton = new QRadioButton(tr("First shortcut"));
+ m_primaryButton->setToolTip(dialogTooltip);
m_primaryButton->setChecked(true);
gridLayout->addWidget(m_primaryButton, 0, 0);
m_alternateButton = new QRadioButton(tr("Second shortcut"));
+ m_alternateButton->setToolTip(dialogTooltip);
gridLayout->addWidget(m_alternateButton, 1, 0);
m_primaryLabel = new QLabel();
+ m_primaryLabel->setToolTip(dialogTooltip);
m_primaryLabel->setMinimumWidth(100);
m_primaryLabel->setFrameShape(QFrame::Panel);
gridLayout->addWidget(m_primaryLabel, 0, 1);
m_alternateLabel = new QLabel();
+ m_alternateLabel->setToolTip(dialogTooltip);
m_alternateLabel->setMinimumWidth(100);
m_alternateLabel->setFrameShape(QFrame::Panel);
gridLayout->addWidget(m_alternateLabel, 1, 1);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ util::prepareDialogBox(buttons);
vLayout->addWidget(buttons);
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
diff --git a/src/frontend/settingsdialogs/btshortcutsdialog.h b/src/frontend/settingsdialogs/btshortcutsdialog.h
index f2d439d..53f738c 100644
--- a/src/frontend/settingsdialogs/btshortcutsdialog.h
+++ b/src/frontend/settingsdialogs/btshortcutsdialog.h
@@ -12,7 +12,7 @@
#include <QDialog>
-// forwards
+
class QLabel;
class QRadioButton;
diff --git a/src/frontend/settingsdialogs/btshortcutseditor.cpp b/src/frontend/settingsdialogs/btshortcutseditor.cpp
index 0be1d0a..3c9027d 100644
--- a/src/frontend/settingsdialogs/btshortcutseditor.cpp
+++ b/src/frontend/settingsdialogs/btshortcutseditor.cpp
@@ -7,22 +7,22 @@
*
**********/
-#include "btshortcutseditor.h"
-#include "btshortcutsdialog.h"
+#include "frontend/settingsdialogs/btshortcutseditor.h"
-#include "frontend/displaywindow/btactioncollection.h"
-
-#include <QTableWidget>
-#include <QTableWidgetItem>
-#include <QKeySequence>
-#include <QVBoxLayout>
-#include <QHeaderView>
#include <QAction>
#include <QGroupBox>
-#include <QRadioButton>
+#include <QHeaderView>
+#include <QKeySequence>
#include <QLabel>
-#include <QSpacerItem>
#include <QPushButton>
+#include <QRadioButton>
+#include <QSpacerItem>
+#include <QTableWidget>
+#include <QTableWidgetItem>
+#include <QVBoxLayout>
+#include "frontend/displaywindow/btactioncollection.h"
+#include "frontend/settingsdialogs/btshortcutsdialog.h"
+
// *************** BtShortcutsEditorItem *******************************************************************
// BtShortcutsEditorItem is the widget for the first column of the BtShortcutsEditor
diff --git a/src/frontend/settingsdialogs/btshortcutseditor.h b/src/frontend/settingsdialogs/btshortcutseditor.h
index 017ac19..93e2bfc 100644
--- a/src/frontend/settingsdialogs/btshortcutseditor.h
+++ b/src/frontend/settingsdialogs/btshortcutseditor.h
@@ -13,14 +13,14 @@
#include <QWidget>
-// forwards
+
class BtActionCollection;
class BtShortcutsEditorItem;
class BtShortcutsDialog;
+class QLabel;
class QPushButton;
class QRadioButton;
class QTableWidget;
-class QLabel;
// This class is the table in the center of the Shortcuts page of the config dialog
class BtShortcutsEditor : public QWidget {
diff --git a/src/frontend/settingsdialogs/cacceleratorsettings.cpp b/src/frontend/settingsdialogs/cacceleratorsettings.cpp
index cc8769b..9fe7a9b 100644
--- a/src/frontend/settingsdialogs/cacceleratorsettings.cpp
+++ b/src/frontend/settingsdialogs/cacceleratorsettings.cpp
@@ -7,26 +7,26 @@
*
**********/
-#include "cacceleratorsettings.h"
+#include "frontend/settingsdialogs/cacceleratorsettings.h"
+#include <QComboBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QList>
+#include <QMessageBox>
+#include <QStackedWidget>
+#include <QVBoxLayout>
+#include <QWidget>
#include "bibletime.h"
#include "backend/config/cbtconfig.h"
+#include "frontend/displaywindow/btactioncollection.h"
#include "frontend/displaywindow/cbiblereadwindow.h"
+#include "frontend/displaywindow/cbookreadwindow.h"
#include "frontend/displaywindow/ccommentaryreadwindow.h"
#include "frontend/displaywindow/clexiconreadwindow.h"
-#include "frontend/displaywindow/cbookreadwindow.h"
#include "frontend/displaywindow/creadwindow.h"
-#include "frontend/displaywindow/btactioncollection.h"
#include "util/cresmgr.h"
-#include <QWidget>
-#include <QComboBox>
-#include <QStackedWidget>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QLabel>
-#include <QList>
-#include <QMessageBox>
CAcceleratorSettingsPage::CAcceleratorSettingsPage(QWidget* /* parent */ )
: BtConfigPage() {
@@ -128,7 +128,7 @@ CAcceleratorSettingsPage::CAcceleratorSettingsPage(QWidget* /* parent */ )
slotKeyChooserTypeChanged(m_application.title);
m_typeChooser->setFocus(Qt::MouseFocusReason);
- qDebug("CAcceleratorSettingsPage::CAcceleratorSettingsPage end");
+ qDebug() << "CAcceleratorSettingsPage::CAcceleratorSettingsPage end";
}
CAcceleratorSettingsPage::~CAcceleratorSettingsPage() {
diff --git a/src/frontend/settingsdialogs/cacceleratorsettings.h b/src/frontend/settingsdialogs/cacceleratorsettings.h
index e06a9b9..74401ab 100644
--- a/src/frontend/settingsdialogs/cacceleratorsettings.h
+++ b/src/frontend/settingsdialogs/cacceleratorsettings.h
@@ -10,26 +10,24 @@
#ifndef CACCELERATORSETTINGS_H
#define CACCELERATORSETTINGS_H
-#include "btshortcutseditor.h"
-
-#include "util/cpointers.h"
-//#include "backend/config/cbtconfig.h"
#include "frontend/bookshelfmanager/btconfigdialog.h"
+#include "util/cpointers.h"
-#include <QWidget>
#include <QPointer>
+#include <QWidget>
+#include "frontend/settingsdialogs/btshortcutseditor.h"
+
-class QComboBox;
-class QStackedWidget;
class BtActionCollection;
class BtShortcutsEditor;
+class QComboBox;
+class QStackedWidget;
/**
- @author The BibleTime team <info@bibletime.info>
+ @author The BibleTime team <info@bibletime.info>
*/
class CAcceleratorSettingsPage : public BtConfigPage, CPointers {
Q_OBJECT
-
public:
CAcceleratorSettingsPage(QWidget *parent);
~CAcceleratorSettingsPage();
diff --git a/src/frontend/settingsdialogs/cconfigurationdialog.cpp b/src/frontend/settingsdialogs/cconfigurationdialog.cpp
index d06b342..f127883 100644
--- a/src/frontend/settingsdialogs/cconfigurationdialog.cpp
+++ b/src/frontend/settingsdialogs/cconfigurationdialog.cpp
@@ -7,23 +7,22 @@
*
**********/
-#include "cconfigurationdialog.h"
-
-#include "cdisplaysettings.h"
-#include "cswordsettings.h"
-#include "clanguagesettings.h"
-#include "cacceleratorsettings.h"
+#include "frontend/settingsdialogs/cconfigurationdialog.h"
+#include <QAbstractButton>
+#include <QDialogButtonBox>
+#include <QLayout>
+#include <QPushButton>
+#include <QWidget>
+#include "frontend/settingsdialogs/cacceleratorsettings.h"
+#include "frontend/settingsdialogs/cdisplaysettings.h"
+#include "frontend/settingsdialogs/clanguagesettings.h"
+#include "frontend/settingsdialogs/cswordsettings.h"
#include "util/cpointers.h"
#include "util/cresmgr.h"
-#include "util/directoryutil.h"
+#include "util/directory.h"
#include "util/dialogutil.h"
-#include <QWidget>
-#include <QDialogButtonBox>
-#include <QAbstractButton>
-#include <QPushButton>
-#include <QLayout>
CConfigurationDialog::CConfigurationDialog(QWidget * parent, BtActionCollection* actionCollection )
: BtConfigDialog(parent),
diff --git a/src/frontend/settingsdialogs/cconfigurationdialog.h b/src/frontend/settingsdialogs/cconfigurationdialog.h
index 3fae5e3..6b423e4 100644
--- a/src/frontend/settingsdialogs/cconfigurationdialog.h
+++ b/src/frontend/settingsdialogs/cconfigurationdialog.h
@@ -1,33 +1,29 @@
-//
-// C++ Interface: cconfigurationdialog
-//
-// Description: BibleTime Configuration dialog.
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2009
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef CCONFIGURATIONDIALOG_H
#define CCONFIGURATIONDIALOG_H
#include "frontend/bookshelfmanager/btconfigdialog.h"
-class QWidget;
-class QAbstractButton;
+class BtActionCollection;
+class CAcceleratorSettingsPage;
class CDisplaySettingsPage;
-class CSwordSettingsPage;
class CLanguageSettingsPage;
-class CAcceleratorSettingsPage;
+class CSwordSettingsPage;
+class QAbstractButton;
class QDialogButtonBox;
-class BtActionCollection;
+class QWidget;
class CConfigurationDialog : public BtConfigDialog {
Q_OBJECT
-
public:
CConfigurationDialog(QWidget *parent, BtActionCollection* actionCollection);
virtual ~CConfigurationDialog();
diff --git a/src/frontend/settingsdialogs/cdisplaysettings.cpp b/src/frontend/settingsdialogs/cdisplaysettings.cpp
index e34eb8b..9341632 100644
--- a/src/frontend/settingsdialogs/cdisplaysettings.cpp
+++ b/src/frontend/settingsdialogs/cdisplaysettings.cpp
@@ -7,21 +7,20 @@
*
**********/
-#include "cdisplaysettings.h"
+#include "frontend/settingsdialogs/cdisplaysettings.h"
+#include <QCheckBox>
+#include <QComboBox>
+#include <QLabel>
+#include <QVBoxLayout>
+#include <QWebView>
#include "backend/config/cbtconfig.h"
-#include "backend/rendering/cdisplayrendering.h"
#include "backend/managers/cdisplaytemplatemgr.h"
-
-#include "util/cresmgr.h"
-#include "util/ctoolclass.h"
+#include "backend/rendering/cdisplayrendering.h"
#include "util/cpointers.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
-#include <QWebView>
-#include <QCheckBox>
-#include <QComboBox>
-#include <QVBoxLayout>
-#include <QLabel>
// ***********************
// Container for QWebView to control its size
@@ -60,7 +59,7 @@ CDisplaySettingsPage::CDisplaySettingsPage(QWidget* /*parent*/)
layout->addSpacing(20);
layout->addWidget(
- CToolClass::explanationLabel(
+ util::tool::explanationLabel(
this,
tr("Display templates"),
tr("Display templates define how text is displayed.")
@@ -107,7 +106,7 @@ CDisplaySettingsPage::CDisplaySettingsPage(QWidget* /*parent*/)
void CDisplaySettingsPage::updateStylePreview() {
//update the style preview widget
- qDebug("CDisplaySettingsPage::updateStylePreview");
+ qDebug() << "CDisplaySettingsPage::updateStylePreview";
using namespace Rendering;
const QString styleName = m_styleChooserCombo->currentText();
@@ -162,7 +161,7 @@ void CDisplaySettingsPage::updateStylePreview() {
CBTConfig::set
(CBTConfig::displayStyle, oldStyleName);
- qDebug("CDisplaySettingsPage::updateStylePreview end");
+ qDebug() << "CDisplaySettingsPage::updateStylePreview end";
}
void CDisplaySettingsPage::save() {
diff --git a/src/frontend/settingsdialogs/cdisplaysettings.h b/src/frontend/settingsdialogs/cdisplaysettings.h
index 7d6800a..be9a359 100644
--- a/src/frontend/settingsdialogs/cdisplaysettings.h
+++ b/src/frontend/settingsdialogs/cdisplaysettings.h
@@ -7,7 +7,6 @@
*
**********/
-
#ifndef CDISPLAYSETTINGS_H
#define CDISPLAYSETTINGS_H
@@ -15,13 +14,13 @@
#include <QWidget>
+
class QCheckBox;
class QComboBox;
class QWebView;
class CDisplaySettingsPage : public BtConfigPage {
Q_OBJECT
-
public:
CDisplaySettingsPage(QWidget* parent);
void save();
diff --git a/src/frontend/settingsdialogs/cfontchooser.cpp b/src/frontend/settingsdialogs/cfontchooser.cpp
index a2a8290..786847b 100644
--- a/src/frontend/settingsdialogs/cfontchooser.cpp
+++ b/src/frontend/settingsdialogs/cfontchooser.cpp
@@ -7,17 +7,18 @@
*
**********/
-#include "cfontchooser.h"
-#include "clistwidget.h"
-#include <QVBoxLayout>
+#include "frontend/settingsdialogs/cfontchooser.h"
+
+#include <QWidget>
+#include <QFontDatabase>
+#include <QFrame>
#include <QLabel>
#include <QListWidget>
-#include <QFrame>
-#include <QFontDatabase>
#include <QListWidgetItem>
+#include <QVBoxLayout>
#include <QWebSettings>
-#include <QFrame>
#include <QWebView>
+#include "frontend/settingsdialogs/clistwidget.h"
// ***********************
diff --git a/src/frontend/settingsdialogs/cfontchooser.h b/src/frontend/settingsdialogs/cfontchooser.h
index 7dcefda..fc5b8dd 100644
--- a/src/frontend/settingsdialogs/cfontchooser.h
+++ b/src/frontend/settingsdialogs/cfontchooser.h
@@ -1,38 +1,32 @@
-//
-// C++ Interface: CFontChooser
-//
-// Description: BibleTime font chooser
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef CFONTCHOOSER_H
#define CFONTCHOOSER_H
-// These following two defines allow chosing between using KDE and
-// Qt only for rendering the preview text
-
+#include <QFrame>
#include <QWidget>
-#include <QFrame>
-class QString;
-class QFrame;
+
+class CListWidget;
class QListWidget;
class QListWidgetItem;
+class QString;
class QVBoxLayout;
class QWebView;
-class CListWidget;
class CFontChooser : public QFrame {
Q_OBJECT
public:
- CFontChooser(QWidget* parent = 0);
+ CFontChooser(QWidget *parent = 0);
~CFontChooser();
void setFont(const QFont& font);
void setSampleText(const QString& text);
diff --git a/src/frontend/settingsdialogs/clanguagesettings.cpp b/src/frontend/settingsdialogs/clanguagesettings.cpp
index 152de40..a54a023 100644
--- a/src/frontend/settingsdialogs/clanguagesettings.cpp
+++ b/src/frontend/settingsdialogs/clanguagesettings.cpp
@@ -1,45 +1,40 @@
-//
-// C++ Implementation: clanguagesettings
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#include "clanguagesettings.h"
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
-#include "util/cpointers.h"
-#include "util/ctoolclass.h"
-#include "util/cresmgr.h"
-#include "util/directoryutil.h"
+#include "frontend/settingsdialogs/clanguagesettings.h"
-#include <QWidget>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QComboBox>
#include <QCheckBox>
+#include <QComboBox>
+#include <QHBoxLayout>
#include <QLabel>
+#include <QVBoxLayout>
+#include <QWidget>
+#include "frontend/settingsdialogs/cfontchooser.h"
+#include "util/cpointers.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
+#include "util/directory.h"
-
-#include "cfontchooser.h"
-
-
-//Sword includes
+// Sword includes:
#include <localemgr.h>
#include <swlocale.h>
+
CLanguageSettingsPage::CLanguageSettingsPage(QWidget* /*parent*/)
: BtConfigPage() {
+ namespace DU = util::directory;
QVBoxLayout* layout = new QVBoxLayout(this);
//Sword locales
layout->addWidget(
- CToolClass::explanationLabel(
+ util::tool::explanationLabel(
this,
tr(""),
tr("Select the language in which the Biblical book names are displayed.")
@@ -112,7 +107,7 @@ CLanguageSettingsPage::CLanguageSettingsPage(QWidget* /*parent*/)
//Font settings
layout->addWidget(
- CToolClass::explanationLabel(
+ util::tool::explanationLabel(
this,
tr("Fonts"),
tr("You can specify a custom font for each language.")
@@ -138,7 +133,7 @@ CLanguageSettingsPage::CLanguageSettingsPage(QWidget* /*parent*/)
for ( QMap<QString, CBTConfig::FontSettingsPair>::Iterator it = m_fontMap.begin(); it != m_fontMap.end(); ++it ) {
if ( m_fontMap[it.key()].first ) { //show font icon
- m_usageCombo->addItem(util::filesystem::DirectoryUtil::getIcon("fonts.svg"), it.key() );
+ m_usageCombo->addItem(DU::getIcon("fonts.svg"), it.key() );
}
else { //don't show icon for font
m_usageCombo->addItem(it.key());
@@ -152,11 +147,11 @@ CLanguageSettingsPage::CLanguageSettingsPage(QWidget* /*parent*/)
layout->addLayout(hLayout);
hLayout->setContentsMargins(0, 0, 0, 0);
- //#warning TODO: remember the last selected font and jump there.
+ /// \todo remember the last selected font and jump there.
m_fontChooser = new CFontChooser(this);
- //TODO: Eeli's wishlist: why not show something relevant here, like a Bible verse in chosen (not tr()'ed!) language?
+ /// \todo Eeli's wishlist: why not show something relevant here, like a Bible verse in chosen (not tr()'ed!) language?
QString sampleText;
sampleText.append("1 In the beginning God created the heaven and the earth. ");
sampleText.append("2 And the earth was without form, and void; and darkness was on the face of the deep.");
@@ -242,17 +237,19 @@ void CLanguageSettingsPage::newDisplayWindowFontAreaSelected(const QString& usag
/** This slot is called when the "Use own font for language" bo was clicked. */
-void CLanguageSettingsPage::useOwnFontClicked( bool isOn ) {
+void CLanguageSettingsPage::useOwnFontClicked(bool isOn) {
+ namespace DU = util::directory;
+
//belongs to fonts/languages
m_fontChooser->setEnabled(isOn);
m_fontMap[ m_usageCombo->currentText() ].first = isOn;
if (isOn) { //show font icon
- m_usageCombo->setItemIcon(m_usageCombo->currentIndex(), util::filesystem::DirectoryUtil::getIcon("fonts.svg") );
+ m_usageCombo->setItemIcon(m_usageCombo->currentIndex(), DU::getIcon("fonts.svg"));
}
else { //don't show
- m_usageCombo->setItemText(m_usageCombo->currentIndex(), m_usageCombo->currentText() ); //TODO: should this change icon to empty?
+ m_usageCombo->setItemText(m_usageCombo->currentIndex(), m_usageCombo->currentText() ); /// \todo should this change icon to empty?
}
}
diff --git a/src/frontend/settingsdialogs/clanguagesettings.h b/src/frontend/settingsdialogs/clanguagesettings.h
index d4f588b..4d55cda 100644
--- a/src/frontend/settingsdialogs/clanguagesettings.h
+++ b/src/frontend/settingsdialogs/clanguagesettings.h
@@ -1,32 +1,29 @@
-//
-// C++ Interface: clanguagesettings
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
#ifndef CLANGUAGESETTINGS_H
#define CLANGUAGESETTINGS_H
-
-#include "util/cpointers.h"
-#include "backend/config/cbtconfig.h"
#include "frontend/bookshelfmanager/btconfigdialog.h"
+#include "util/cpointers.h"
-#include <QWidget>
#include <QMap>
+#include <QWidget>
+#include "backend/config/cbtconfig.h"
-class QComboBox;
-class QCheckBox;
-class CFontChooser;
+class CFontChooser;
+class QCheckBox;
+class QComboBox;
/**
- @author The BibleTime team <info@bibletime.info>
+ @author The BibleTime team <info@bibletime.info>
*/
class CLanguageSettingsPage : public BtConfigPage, CPointers {
Q_OBJECT
diff --git a/src/frontend/settingsdialogs/clistwidget.cpp b/src/frontend/settingsdialogs/clistwidget.cpp
index 61be4b5..44cc246 100644
--- a/src/frontend/settingsdialogs/clistwidget.cpp
+++ b/src/frontend/settingsdialogs/clistwidget.cpp
@@ -7,14 +7,18 @@
*
**********/
-#include "util/ctoolclass.h"
-#include "clistwidget.h"
+#include "frontend/settingsdialogs/clistwidget.h"
+
+#include "util/tool.h"
+
CListWidget::CListWidget(QWidget* parent)
: QListWidget(parent) {
+ // Intentionally empty
}
CListWidget::~CListWidget() {
+ // Intentionally empty
}
QSize CListWidget::sizeHint () const {
@@ -22,5 +26,5 @@ QSize CListWidget::sizeHint () const {
}
void CListWidget::setCharWidth(int width) {
- setMaximumWidth(CToolClass::mWidth(this, width));
+ setMaximumWidth(util::tool::mWidth(this, width));
}
diff --git a/src/frontend/settingsdialogs/clistwidget.h b/src/frontend/settingsdialogs/clistwidget.h
index ae93db6..0011f93 100644
--- a/src/frontend/settingsdialogs/clistwidget.h
+++ b/src/frontend/settingsdialogs/clistwidget.h
@@ -1,23 +1,20 @@
-//
-// C++ Interface: CListWidget
-//
-// Description: BibleTime font chooser
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef CLISTWIDGET_H
#define CLISTWIDGET_H
#include <QListWidget>
+
class CListWidget : public QListWidget {
Q_OBJECT
-
public:
CListWidget(QWidget* parent = 0);
~CListWidget();
diff --git a/src/frontend/settingsdialogs/cswordsettings.cpp b/src/frontend/settingsdialogs/cswordsettings.cpp
index 3b5b89e..c6a5bcc 100644
--- a/src/frontend/settingsdialogs/cswordsettings.cpp
+++ b/src/frontend/settingsdialogs/cswordsettings.cpp
@@ -1,34 +1,28 @@
-//
-// C++ Implementation: cswordsettings
-//
-// Description:
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#include "cswordsettings.h"
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
-#include "backend/config/cbtconfig.h"
+#include "frontend/settingsdialogs/cswordsettings.h"
-#include "util/cresmgr.h"
-#include "util/ctoolclass.h"
-#include "util/cpointers.h"
-
-#include <QWidget>
-#include <QTabWidget>
-#include <QComboBox>
#include <QCheckBox>
-#include <QString>
+#include <QComboBox>
#include <QGridLayout>
-#include <QVBoxLayout>
+#include <QLabel>
#include <QList>
+#include <QString>
#include <QStringList>
-#include <QLabel>
-
+#include <QTabWidget>
+#include <QVBoxLayout>
+#include <QWidget>
+#include "backend/config/cbtconfig.h"
+#include "util/cresmgr.h"
+#include "util/tool.h"
+#include "util/cpointers.h"
CSwordSettingsPage::CSwordSettingsPage(QWidget* /*parent*/)
@@ -55,7 +49,7 @@ StandardWorksTab::StandardWorksTab()
gridLayout->setSizeConstraint(QLayout::SetMinimumSize);
gridLayout->addWidget(
- CToolClass::explanationLabel(
+ util::tool::explanationLabel(
this,
tr(""),
tr("Standard works are used when no particular work is specified, \
@@ -263,7 +257,7 @@ StandardWorksTab::StandardWorksTab()
TextFiltersTab::TextFiltersTab() {
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(5);
- QWidget* eLabel = CToolClass::explanationLabel(
+ QWidget* eLabel = util::tool::explanationLabel(
this,
tr(""),
tr("Filters control the appearance of text. \
diff --git a/src/frontend/settingsdialogs/cswordsettings.h b/src/frontend/settingsdialogs/cswordsettings.h
index 032471c..9af4c70 100644
--- a/src/frontend/settingsdialogs/cswordsettings.h
+++ b/src/frontend/settingsdialogs/cswordsettings.h
@@ -1,34 +1,27 @@
-//
-// C++ Interface: cswordsettings
-//
-// Description: Widgets for "Sword" ("Desk") settings of configuration dialog.
-//
-//
-// Author: The BibleTime team <info@bibletime.info>, (C) 1999-2008
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2009 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
#ifndef CSWORDSETTINGS_H
#define CSWORDSETTINGS_H
#include "frontend/bookshelfmanager/btconfigdialog.h"
-
#include "util/cpointers.h"
-
-#include <QTabWidget>
+#include <QWidget>
-class QComboBox;
class QCheckBox;
-
+class QComboBox;
class StandardWorksTab;
class TextFiltersTab;
class CSwordSettingsPage : public BtConfigPage {
Q_OBJECT
-
public:
CSwordSettingsPage(QWidget* parent);
void save();
@@ -45,7 +38,6 @@ class CSwordSettingsPage : public BtConfigPage {
class StandardWorksTab : public QWidget, CPointers {
Q_OBJECT
-
public:
StandardWorksTab();
void save();
@@ -63,7 +55,6 @@ class StandardWorksTab : public QWidget, CPointers {
class TextFiltersTab : public QWidget {
Q_OBJECT
-
public:
TextFiltersTab();
void save();