summaryrefslogtreecommitdiff
path: root/src/frontend/htmldialogs
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:29 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:29 -0400
commite8a196082586bb68e0bf254a8f6f4b8f39071f32 (patch)
treeb03dbbd1b5be6092ed5e9bcb3806aa2d4938bba3 /src/frontend/htmldialogs
parentdd2f7ce46df53f2c377c02d1bf4df8adcf092072 (diff)
Imported Upstream version 2.3.3
Diffstat (limited to 'src/frontend/htmldialogs')
-rw-r--r--src/frontend/htmldialogs/btaboutdialog.cpp378
-rw-r--r--src/frontend/htmldialogs/btaboutdialog.h21
-rw-r--r--src/frontend/htmldialogs/bttabhtmldialog.cpp170
-rw-r--r--src/frontend/htmldialogs/bttabhtmldialog.h60
4 files changed, 296 insertions, 333 deletions
diff --git a/src/frontend/htmldialogs/btaboutdialog.cpp b/src/frontend/htmldialogs/btaboutdialog.cpp
index 0f783e9..2c6f553 100644
--- a/src/frontend/htmldialogs/btaboutdialog.cpp
+++ b/src/frontend/htmldialogs/btaboutdialog.cpp
@@ -28,226 +28,208 @@ static QString make_version();
// Implements the Help > About dialog box
BtAboutDialog::BtAboutDialog(QWidget *parent, Qt::WindowFlags wflags )
- : BtTabHtmlDialog (tr("About BibleTime"), 5, parent, wflags)
-{
- resize(550,340);
- init_lic_tab();
- init_sword_tab();
- init_qt_tab();
- init_contributors_tab();
- init_bt_tab();
-}
-
-BtAboutDialog::~BtAboutDialog()
-{
-}
-
-void BtAboutDialog::init_bt_tab()
-{
- selectTab(0);
- setTabText("BibleTime" );
- QString content;
- content = make_file_icon("bibletime");
- content += "&nbsp;&nbsp;";
- content += make_bold("BibleTime " + make_version());
- content = make_center(content) + make_br();
- content += tr("BibleTime is an easy to use but powerful Bible study tool.");
- content += make_br() + make_br();
- content += tr("We are looking for developers and translators.");
- content += " ";
- content += tr("If you would like to join our team, please send an email to info@bibletime.info.");
- content += make_br() + make_br();
- content += tr("(c)1999-2009, The BibleTime Team");
- content += make_br();
- content += make_link("http://www.bibletime.info","http://www.bibletime.info");
- QString bibletime = make_html(make_head("") + make_body(content));
- setHtml(bibletime);
-}
-
-void BtAboutDialog::init_contributors_tab()
-{
- selectTab(1);
- setTabText(tr("Contributors"));
- QString content;
- content += make_bold(tr("The following people contributed to BibleTime:")) + make_br();
- // sorted alphabetically (last name)
- content += "<ul>";
- content += "<li>Thomas Abthorpe (" + tr("documentation and translation manager") + ")</li>";
- content += "<li>Joachim Ansorg (" + tr("project founder, developer") + ")</li>";
- content += "<li>David Blue (" + tr("designer") + ")</li>";
- content += "<li>Tim Brodie (" + tr("developer") + ")</li>";
- content += "<li>Timothy R. Butler (" + tr("designer") + ")</li>";
- content += "<li>Jim Campbell (" + tr("developer") + ")</li>";
- content += "<li>Lee Carpenter (" + tr("developer") + ")</li>";
- content += "<li>Jeremy Erickson (" + tr("packager") + ")</li>";
- content += "<li>Troy A. Griffitts (" + tr("creator of The Sword Project") + ")</li>";
- content += "<li>Martin Gruner (" + tr("project manager, developer") + ")</li>";
- content += "<li>Thomas Hagedorn (" + tr("domain sponsor") + ")</li>";
- content += "<li>Bob Harman (" + tr("howto") + ")</li>";
- content += "<li>Gary Holmlund (" + tr("developer") + ")</li>";
- content += "<li>Nikolay Igotti (" + tr("developer") + ")</li>";
- content += "<li>Eeli Kaikkonnen (" + tr("developer") + ")</li>";
- content += "<li>Chris Kujawa (" + tr("developer") + ")</li>";
- content += "<li>Mark Lybarger (" + tr("developer") + ")</li>";
- content += "<li>Luke Mauldin (" + tr("developer") + ")</li>";
- content += "<li>James Ots (" + tr("designer") + ")</li>";
- content += "<li>Fred Saalbach (" + tr("documentation") + ")</li>";
- content += "<li>Gary Sims (" + tr("developer") + ")</li>";
- content += "<li>Wolfgang Stradner (" + tr("tester, usability expert") + ")</li>";
- content += "<li>Thorsten Uhlmann (" + tr("developer") + ")</li>";
- content += "<li>David White (" + tr("developer") + ")</li>";
- content += "<li>Mark Zealey (" + tr("developer") + ")</li>";
- content += "</ul>";
-
- content += make_bold(tr("The following people translated BibleTime into their language:")) + make_br();
- // sorted alphabetically (last name)
- content += "<ul>";
- content += "<li>Horatiu Alexe</li>";
- content += "<li>Jan B&ecarron;lohoubek</li>";
- content += "<li>Chun-shek Chan</li>";
- content += "<li>Ilpo Kantonen</li>";
- content += "<li>Pavel Laukko</li>";
- content += "<li>Piotr Markiewicz</li>";
- content += "<li>G&eacute;za Nov&aacute;k</li>";
- content += "<li>Gabriel P&eacute;rez</li>";
- content += "<li>Igor Plisco</li>";
- content += "<li>Zdenko Podobn&yacute;</li>";
- content += "<li>Jaak Ristioja</li>";
- content += "<li>Igor Rykhlin</li>";
- content += "<li>Vlad Savitsky</li>";
- content += "<li>Johan van der Lingen</li>";
- content += "<li>Jean Van Schaftingen</li>";
- content += "<li>Dmitry Yurevich</li>";
- content += "<li>Esteban Zeller</li>";
- content += "</ul>";
- content += make_br();
- content += tr("Some names may be missing, please email bibletime-translations@lists.sourceforge.net if you notice errors or omissions.");
-
- QString contributors = make_html(make_head("") + make_body(content));
- setHtml(contributors);
-}
-
-
-void BtAboutDialog::init_sword_tab()
-{
- selectTab(2);
- setTabText("Sword" );
-
- QString version( sword::SWVersion::currentVersion.getText());
- QString content = make_br() + make_br();
- content += make_center(make_bold(tr("SWORD library version %1").arg(version)));
- content += make_br();
-
- content += tr("BibleTime makes use of the SWORD Project. The SWORD Project is the CrossWire Bible Society's free Bible software project. Its purpose is to create cross-platform open-source tools-- covered by the GNU General Public License-- that allow programmers and Bible societies to write new Bible software more quickly and easily.");
- content += make_br() + make_br();
- content += tr("The SWORD Project") + make_br();
- content += make_link("http://www.crosswire.org/sword/index.jsp","www.crosswire.org/sword/index.jsp");
-
- setHtml(content);
-
-}
-
-void BtAboutDialog::init_qt_tab()
-{
- selectTab(3);
- setTabText("Qt");
- QString content;
- 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 += 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 += 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.");
- QString qt = make_html(make_head("") + make_body(content));
- setHtml(qt);
-}
-
-void BtAboutDialog::init_lic_tab()
-{
- selectTab(4);
- setTabText(tr("License"));
-
- QByteArray text;
- text += tr("BibleTime is released under the GPL license.");
- text += " ";
- 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 += 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 += tr("The complete legally binding license is below.");
-
- QFile licFile(util::filesystem::DirectoryUtil::getLicenseDir().path() + "/license.html");
- if (licFile.open(QFile::ReadOnly))
- {
- QByteArray html;
- while (!licFile.atEnd())
- {
- QByteArray line = licFile.readLine();
- html = html + line;
- }
- licFile.close();
- html.replace("TRANSLATED TEXT", text);
- setHtml(QString(html));
- }
+ : BtTabHtmlDialog (tr("About BibleTime"), 5, parent, wflags) {
+ resize(550, 340);
+ init_lic_tab();
+ init_sword_tab();
+ init_qt_tab();
+ init_contributors_tab();
+ init_bt_tab();
+}
+
+BtAboutDialog::~BtAboutDialog() {
+}
+
+void BtAboutDialog::init_bt_tab() {
+ selectTab(0);
+ setTabText("BibleTime" );
+ QString content;
+ content = make_file_icon("bibletime");
+ content += "&nbsp;&nbsp;";
+ content += make_bold("BibleTime " + make_version());
+ content = make_center(content) + make_br();
+ content += tr("BibleTime is an easy to use but powerful Bible study tool.");
+ content += make_br() + make_br();
+ content += tr("We are looking for developers and translators.");
+ content += " ";
+ content += tr("If you would like to join our team, please send an email to info@bibletime.info.");
+ content += make_br() + make_br();
+ content += tr("(c)1999-2009, The BibleTime Team");
+ content += make_br();
+ content += make_link("http://www.bibletime.info", "http://www.bibletime.info");
+ QString bibletime = make_html(make_head("") + make_body(content));
+ setHtml(bibletime);
+}
+
+void BtAboutDialog::init_contributors_tab() {
+ selectTab(1);
+ setTabText(tr("Contributors"));
+ QString content;
+ content += make_bold(tr("The following people contributed to BibleTime:")) + make_br();
+ // sorted alphabetically (last name)
+ content += "<ul>";
+ content += "<li>Thomas Abthorpe (" + tr("documentation and translation manager") + ")</li>";
+ content += "<li>Joachim Ansorg (" + tr("project founder, developer") + ")</li>";
+ content += "<li>David Blue (" + tr("designer") + ")</li>";
+ content += "<li>Tim Brodie (" + tr("developer") + ")</li>";
+ content += "<li>Timothy R. Butler (" + tr("designer") + ")</li>";
+ content += "<li>Jim Campbell (" + tr("developer") + ")</li>";
+ content += "<li>Lee Carpenter (" + tr("developer") + ")</li>";
+ content += "<li>Jeremy Erickson (" + tr("packager") + ")</li>";
+ content += "<li>Troy A. Griffitts (" + tr("creator of The Sword Project") + ")</li>";
+ content += "<li>Martin Gruner (" + tr("project manager, developer") + ")</li>";
+ content += "<li>Thomas Hagedorn (" + tr("domain sponsor") + ")</li>";
+ content += "<li>Bob Harman (" + tr("howto") + ")</li>";
+ content += "<li>Gary Holmlund (" + tr("developer") + ")</li>";
+ content += "<li>Nikolay Igotti (" + tr("developer") + ")</li>";
+ content += "<li>Eeli Kaikkonnen (" + tr("developer") + ")</li>";
+ content += "<li>Chris Kujawa (" + tr("developer") + ")</li>";
+ content += "<li>Mark Lybarger (" + tr("developer") + ")</li>";
+ content += "<li>Luke Mauldin (" + tr("developer") + ")</li>";
+ content += "<li>James Ots (" + tr("designer") + ")</li>";
+ content += "<li>Fred Saalbach (" + tr("documentation") + ")</li>";
+ content += "<li>Gary Sims (" + tr("developer") + ")</li>";
+ content += "<li>Wolfgang Stradner (" + tr("tester, usability expert") + ")</li>";
+ content += "<li>Thorsten Uhlmann (" + tr("developer") + ")</li>";
+ content += "<li>David White (" + tr("developer") + ")</li>";
+ content += "<li>Mark Zealey (" + tr("developer") + ")</li>";
+ content += "</ul>";
+
+ content += make_bold(tr("The following people translated BibleTime into their language:")) + make_br();
+ // sorted alphabetically (last name)
+ content += "<ul>";
+ content += "<li>Horatiu Alexe</li>";
+ content += "<li>Jan B&ecarron;lohoubek</li>";
+ content += "<li>Chun-shek Chan</li>";
+ content += "<li>Ilpo Kantonen</li>";
+ content += "<li>Pavel Laukko</li>";
+ content += "<li>Piotr Markiewicz</li>";
+ content += "<li>G&eacute;za Nov&aacute;k</li>";
+ content += "<li>Gabriel P&eacute;rez</li>";
+ content += "<li>Igor Plisco</li>";
+ content += "<li>Zdenko Podobn&yacute;</li>";
+ content += "<li>Jaak Ristioja</li>";
+ content += "<li>Igor Rykhlin</li>";
+ content += "<li>Vlad Savitsky</li>";
+ content += "<li>Johan van der Lingen</li>";
+ content += "<li>Jean Van Schaftingen</li>";
+ content += "<li>Dmitry Yurevich</li>";
+ content += "<li>Esteban Zeller</li>";
+ content += "</ul>";
+ content += make_br();
+ content += tr("Some names may be missing, please email bibletime-translations@lists.sourceforge.net if you notice errors or omissions.");
+
+ QString contributors = make_html(make_head("") + make_body(content));
+ setHtml(contributors);
+}
+
+
+void BtAboutDialog::init_sword_tab() {
+ selectTab(2);
+ setTabText("Sword" );
+
+ QString version( sword::SWVersion::currentVersion.getText());
+ QString content = make_br() + make_br();
+ content += make_center(make_bold(tr("SWORD library version %1").arg(version)));
+ content += make_br();
+
+ content += tr("BibleTime makes use of the SWORD Project. The SWORD Project is the CrossWire Bible Society's free Bible software project. Its purpose is to create cross-platform open-source tools-- covered by the GNU General Public License-- that allow programmers and Bible societies to write new Bible software more quickly and easily.");
+ content += make_br() + make_br();
+ content += tr("The SWORD Project") + make_br();
+ content += make_link("http://www.crosswire.org/sword/index.jsp", "www.crosswire.org/sword/index.jsp");
+
+ setHtml(content);
+
+}
+
+void BtAboutDialog::init_qt_tab() {
+ selectTab(3);
+ setTabText("Qt");
+ QString content;
+ 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 += 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 += 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.");
+ QString qt = make_html(make_head("") + make_body(content));
+ setHtml(qt);
+}
+
+void BtAboutDialog::init_lic_tab() {
+ selectTab(4);
+ setTabText(tr("License"));
+
+ QByteArray text;
+ text += tr("BibleTime is released under the GPL license.");
+ text += " ";
+ 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 += 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 += tr("The complete legally binding license is below.");
+
+ QFile licFile(util::filesystem::DirectoryUtil::getLicenseDir().path() + "/license.html");
+ if (licFile.open(QFile::ReadOnly)) {
+ QByteArray html;
+ while (!licFile.atEnd()) {
+ QByteArray line = licFile.readLine();
+ html = html + line;
+ }
+ licFile.close();
+ html.replace("TRANSLATED TEXT", text);
+ setHtml(QString(html));
+ }
}
// Helper functions
-static QString make_center(const QString& content)
-{
- return "<center>" + content + "</center>";
+static QString make_center(const QString& content) {
+ return "<center>" + content + "</center>";
}
-static QString make_br()
-{
- return "<br>";
+static QString make_br() {
+ return "<br>";
}
-static QString make_bold(const QString& content)
-{
- return "<b>" + content + "</b>";
+static QString make_bold(const QString& content) {
+ return "<b>" + content + "</b>";
}
-static QString make_html(const QString& content)
-{
- return "<html>" + content + "</html>";
+static QString make_html(const QString& content) {
+ return "<html>" + content + "</html>";
}
-static QString make_head(const QString& content)
-{
- return "<head>" + content + "</head>";
+static QString make_head(const QString& content) {
+ return "<head>" + content + "</head>";
}
-static QString make_body(const QString& content)
-{
- return "<body>" + content + "</body>";
+static QString make_body(const QString& content) {
+ return "<body>" + content + "</body>";
}
-static QString make_link(const QString& link, const QString& text)
-{
- return "<a href=\"" + link + "\">" + text +"</a>";
+static QString make_link(const QString& link, const QString& text) {
+ return "<a href=\"" + link + "\">" + text + "</a>";
}
-static QString make_version()
-{
+static QString make_version() {
// return "";
- return BT_VERSION;
+ return BT_VERSION;
}
-static QString make_file_icon(const QString& icon)
-{
- QString dir = "<img src=file://" + util::filesystem::DirectoryUtil::getIconDir().path();
- return dir + "/" + icon +".png >";
+static QString make_file_icon(const QString& icon) {
+ QString dir = "<img src=file://" + util::filesystem::DirectoryUtil::getIconDir().path();
+ return dir + "/" + icon + ".png >";
}
diff --git a/src/frontend/htmldialogs/btaboutdialog.h b/src/frontend/htmldialogs/btaboutdialog.h
index 067cad7..6521f7f 100644
--- a/src/frontend/htmldialogs/btaboutdialog.h
+++ b/src/frontend/htmldialogs/btaboutdialog.h
@@ -12,18 +12,17 @@
#include "bttabhtmldialog.h"
-class BtAboutDialog : public BtTabHtmlDialog
-{
- Q_OBJECT
+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();
- void init_qt_tab();
- void init_lic_tab();
+ public:
+ BtAboutDialog(QWidget *parent = 0, Qt::WindowFlags wflags = Qt::Dialog);
+ ~BtAboutDialog();
+ void init_bt_tab();
+ void init_contributors_tab();
+ void init_sword_tab();
+ void init_qt_tab();
+ void init_lic_tab();
};
#endif
diff --git a/src/frontend/htmldialogs/bttabhtmldialog.cpp b/src/frontend/htmldialogs/bttabhtmldialog.cpp
index f8a83f7..4d2b57c 100644
--- a/src/frontend/htmldialogs/bttabhtmldialog.cpp
+++ b/src/frontend/htmldialogs/bttabhtmldialog.cpp
@@ -21,120 +21,104 @@
#include <QContextMenuEvent>
BtTabHtmlDialog::BtTabHtmlDialog
- (const QString& title, int tabs, QWidget *parent, Qt::WindowFlags wflags )
- : QDialog(parent, wflags), m_webView(0), m_tabWidget(0), m_tabs(tabs)
-{
- //Set the flag to destroy when closed
- setAttribute(Qt::WA_DeleteOnClose);
- setWindowTitle(title);
- resize(400, 300);
-
- QVBoxLayout *vboxLayout = new QVBoxLayout(this);
- if (tabs == 0)
- {
- m_webView = new BtWebView(this);
- init_connections(m_webView);
- vboxLayout->addWidget(m_webView);
- m_webView->setHtml("Hi");
- }
- else
- {
- m_tabWidget = new QTabWidget(this);
- vboxLayout->addWidget(m_tabWidget);
- for (int i=0; i<tabs; i++)
- {
- QWebView* webView = new BtWebView(this);
- init_connections(webView);
- webView->setObjectName("View" + QString::number(i));
- webView->setHtml(" ");
- m_tabWidget->addTab(webView,"Tab" + QString::number(i));
- m_tabWidget->show();
- }
- }
-
- QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this);
- util::prepareDialogBox(buttonBox);
- vboxLayout->addWidget(buttonBox);
-
- bool ok;
- ok = connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- Q_ASSERT(ok);
- ok = connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
- Q_ASSERT(ok);
+(const QString& title, int tabs, QWidget *parent, Qt::WindowFlags wflags )
+ : QDialog(parent, wflags), m_webView(0), m_tabWidget(0), m_tabs(tabs) {
+ //Set the flag to destroy when closed
+ setAttribute(Qt::WA_DeleteOnClose);
+ setWindowTitle(title);
+ resize(400, 300);
+
+ QVBoxLayout *vboxLayout = new QVBoxLayout(this);
+ if (tabs == 0) {
+ m_webView = new BtWebView(this);
+ init_connections(m_webView);
+ vboxLayout->addWidget(m_webView);
+ m_webView->setHtml("Hi");
+ }
+ else {
+ m_tabWidget = new QTabWidget(this);
+ vboxLayout->addWidget(m_tabWidget);
+ for (int i = 0; i < tabs; i++) {
+ QWebView* webView = new BtWebView(this);
+ init_connections(webView);
+ webView->setObjectName("View" + QString::number(i));
+ webView->setHtml(" ");
+ m_tabWidget->addTab(webView, "Tab" + QString::number(i));
+ m_tabWidget->show();
+ }
+ }
+
+ QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this);
+ util::prepareDialogBox(buttonBox);
+ vboxLayout->addWidget(buttonBox);
+
+ bool ok;
+ ok = connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ Q_ASSERT(ok);
+ ok = connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ Q_ASSERT(ok);
}
-BtTabHtmlDialog::~BtTabHtmlDialog()
-{
+BtTabHtmlDialog::~BtTabHtmlDialog() {
}
-
-void BtTabHtmlDialog::init_connections(QWebView* webView)
-{
- webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
- bool ok = connect(webView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
- Q_ASSERT(ok);
+
+void BtTabHtmlDialog::init_connections(QWebView* webView) {
+ webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+ bool ok = connect(webView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
+ Q_ASSERT(ok);
}
-void BtTabHtmlDialog::linkClicked(const QUrl url)
-{
- QDesktopServices::openUrl(url);
+void BtTabHtmlDialog::linkClicked(const QUrl url) {
+ QDesktopServices::openUrl(url);
}
-void BtTabHtmlDialog::selectTab(int tab)
-{
- Q_ASSERT(tab >= 0 && tab < m_tabWidget->count());
- m_tabWidget->setCurrentIndex(tab);
+void BtTabHtmlDialog::selectTab(int tab) {
+ Q_ASSERT(tab >= 0 && tab < m_tabWidget->count());
+ m_tabWidget->setCurrentIndex(tab);
}
-QWebView* BtTabHtmlDialog::webView()
-{
- QWebView* webview = 0;
- if (m_tabs == 0)
- webview = m_webView;
- else
- {
- QWidget* widget = m_tabWidget->currentWidget();
- QString name = widget->objectName();
- webview = qobject_cast<QWebView*>(widget);
- }
- Q_ASSERT(webview != 0);
- return webview;
+QWebView* BtTabHtmlDialog::webView() {
+ QWebView* webview = 0;
+ if (m_tabs == 0)
+ webview = m_webView;
+ else {
+ QWidget* widget = m_tabWidget->currentWidget();
+ QString name = widget->objectName();
+ webview = qobject_cast<QWebView*>(widget);
+ }
+ Q_ASSERT(webview != 0);
+ return webview;
}
-void BtTabHtmlDialog::setHtml(const QString& html, const QUrl& baseUrl)
-{
- QUrl url = baseUrl;
- if (url == QUrl())
- {
- QString dir = "file://" + util::filesystem::DirectoryUtil::getIconDir().path();
- url.setUrl(dir);
- }
- webView()->setHtml(html,url);
+void BtTabHtmlDialog::setHtml(const QString& html, const QUrl& baseUrl) {
+ QUrl url = baseUrl;
+ if (url == QUrl()) {
+ QString dir = "file://" + util::filesystem::DirectoryUtil::getIconDir().path();
+ url.setUrl(dir);
+ }
+ webView()->setHtml(html, url);
}
-void BtTabHtmlDialog::setUrl(const QUrl& url)
-{
- webView()->setUrl(url);
+void BtTabHtmlDialog::setUrl(const QUrl& url) {
+ webView()->setUrl(url);
}
-void BtTabHtmlDialog::setTabText(const QString& tabName)
-{
- Q_ASSERT(m_tabs != 0); // There are no tabs to name
- int index = m_tabWidget->currentIndex();
- m_tabWidget->setTabText(index,tabName);
+void BtTabHtmlDialog::setTabText(const QString& tabName) {
+ Q_ASSERT(m_tabs != 0); // There are no tabs to name
+ int index = m_tabWidget->currentIndex();
+ m_tabWidget->setTabText(index, tabName);
}
// ******************* BtWebView *******************
BtWebView::BtWebView(QWidget* parent)
- : QWebView(parent), m_popup(0)
-{
- m_popup = new QMenu(this);
- QAction* copyAction = pageAction(QWebPage::Copy);
- m_popup->addAction(copyAction);
+ : QWebView(parent), m_popup(0) {
+ m_popup = new QMenu(this);
+ QAction* copyAction = pageAction(QWebPage::Copy);
+ m_popup->addAction(copyAction);
}
-void BtWebView::contextMenuEvent(QContextMenuEvent* event)
-{
- m_popup->exec(event->globalPos());
+void BtWebView::contextMenuEvent(QContextMenuEvent* event) {
+ m_popup->exec(event->globalPos());
}
diff --git a/src/frontend/htmldialogs/bttabhtmldialog.h b/src/frontend/htmldialogs/bttabhtmldialog.h
index 2b40f12..3ccdc0f 100644
--- a/src/frontend/htmldialogs/bttabhtmldialog.h
+++ b/src/frontend/htmldialogs/bttabhtmldialog.h
@@ -18,10 +18,10 @@
class QTabWidget;
class QMenu;
-// This class creates a dialog with zero or more tabs. For zero tabs it is
+// This class creates a dialog with zero or more tabs. For zero tabs it is
// just a single QWebView inside the dialog. For 1 or more tabs, each tab
// contains a separate QWebView. Each QWebView can have either plain text or
-// html text. The class will automatically delete itself when closed.
+// html text. The class will automatically delete itself when closed.
// The class can either be directly called or subclassed. The dialog is not modal.
// Typical direct usage:
@@ -44,44 +44,42 @@ class QMenu;
// dlg->show();
-class BtTabHtmlDialog : public QDialog
-{
- Q_OBJECT
-public:
- BtTabHtmlDialog(const QString& title, int numberTabs, QWidget *parent=0, Qt::WindowFlags wflags = Qt::Dialog);
- ~BtTabHtmlDialog();
- void selectTab(int tab);
- void setTabText(const QString& tabName);
+class BtTabHtmlDialog : public QDialog {
+ Q_OBJECT
+ public:
+ BtTabHtmlDialog(const QString& title, int numberTabs, QWidget *parent = 0, Qt::WindowFlags wflags = Qt::Dialog);
+ ~BtTabHtmlDialog();
+ void selectTab(int tab);
+ void setTabText(const QString& tabName);
// See QWebView::setHtml()
- void setHtml(const QString& html, const QUrl& baseUrl=QUrl());
+ void setHtml(const QString& html, const QUrl& baseUrl = QUrl());
// See QWebView::setUrl()
- void setUrl(const QUrl& url);
-
-private slots:
- void linkClicked(const QUrl url);
-
-private:
- void init_connections(QWebView* webView);
- QWebView* webView();
-
- QWebView* m_webView;
- QTabWidget* m_tabWidget;
- int m_tabs;
+ void setUrl(const QUrl& url);
+
+ private slots:
+ void linkClicked(const QUrl url);
+
+ private:
+ void init_connections(QWebView* webView);
+ QWebView* webView();
+
+ QWebView* m_webView;
+ QTabWidget* m_tabWidget;
+ int m_tabs;
};
-class BtWebView : public QWebView
-{
-public:
- BtWebView(QWidget* parent=0);
+class BtWebView : public QWebView {
+ public:
+ BtWebView(QWidget* parent = 0);
-protected:
- void contextMenuEvent(QContextMenuEvent* event);
+ protected:
+ void contextMenuEvent(QContextMenuEvent* event);
-private:
- QMenu* m_popup;
+ private:
+ QMenu* m_popup;
};
#endif