aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp2
-rw-r--r--src/browser.h10
-rw-r--r--src/commandline.cpp6
-rw-r--r--src/commandline.h4
-rw-r--r--src/forms/aboutdialog.cpp33
-rw-r--r--src/forms/aboutdialog.h6
-rw-r--r--src/forms/aboutdialog.ui4
-rw-r--r--src/main.cpp6
8 files changed, 52 insertions, 19 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 53ca5d6..4782512 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -131,7 +131,7 @@ MainWindow *Browser::createSession(const QString &profileName, bool newWindow, c
return window;
}
-std::shared_ptr<WebEngineProfile> Browser::profile(const QString storageName)
+std::shared_ptr<WebEngineProfile> Browser::profile(const QString &storageName)
{
if(m_profiles.contains(storageName)) {
return m_profiles[storageName];
diff --git a/src/browser.h b/src/browser.h
index f58dce7..cc4cbb8 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -37,7 +37,15 @@ public:
void setConfiguration(std::shared_ptr<Configuration> &config);
- std::shared_ptr<WebEngineProfile> profile(const QString storageName);
+ std::shared_ptr<WebEngineProfile> profile(const QString &storageName);
+
+ const QList<QString> profiles() const {
+ return m_profiles.keys();
+ }
+
+ const QVector<Plugin> plugins() const {
+ return m_plugins;
+ }
public slots:
MainWindow *createSession(const QString &profileName, bool newWindow, const QStringList &urls);
diff --git a/src/commandline.cpp b/src/commandline.cpp
index adfdf52..e10e638 100644
--- a/src/commandline.cpp
+++ b/src/commandline.cpp
@@ -73,11 +73,11 @@ void CommandLine::parseCommandLine(const QCoreApplication &app)
for(const QString &opt : unknownOptionNames()) {
QCommandLineOption o(opt, "dummy desc", "dummy value");
- opts.append(o);
+ unknownOptions.append(o);
}
// add list and reparse to set the new options
- addOptions(opts);
+ addOptions(unknownOptions);
parse(app.arguments());
}
void CommandLine::printHelp(int exitCode)
@@ -108,7 +108,7 @@ void CommandLine::printHelp(int exitCode)
<< std::endl
<< std::endl;
- exit(0);
+ exit(exitCode);
}
void CommandLine::printVersion()
{
diff --git a/src/commandline.h b/src/commandline.h
index 99aa1cb..81063d3 100644
--- a/src/commandline.h
+++ b/src/commandline.h
@@ -29,10 +29,10 @@ public:
const QCommandLineOption socketOption;
const QCommandLineOption newWindowOption;
- QList<QCommandLineOption> opts;
+ QList<QCommandLineOption> unknownOptions;
private:
QCoreApplication *application;
};
-#endif //SMOLBOTE_COMMANDLINE_H
+#endif // SMOLBOTE_COMMANDLINE_H
diff --git a/src/forms/aboutdialog.cpp b/src/forms/aboutdialog.cpp
index 5b788bd..93cb688 100644
--- a/src/forms/aboutdialog.cpp
+++ b/src/forms/aboutdialog.cpp
@@ -7,6 +7,7 @@
*/
#include "aboutdialog.h"
+#include "browser.h"
#include "ui_aboutdialog.h"
#include "version.h"
#include <boost/version.hpp>
@@ -28,10 +29,9 @@ AboutDialog::AboutDialog(QWidget *parent)
setAttribute(Qt::WA_DeleteOnClose, true);
ui->setupUi(this);
- // clang-tidy: don't use static_cast to downcast from a base to a derived class,
- // use dynamic_cast instead
- //ui->icon->setPixmap(qApp->windowIcon().pixmap(72, 72));
- ui->icon->setPixmap(dynamic_cast<QApplication *>(QApplication::instance())->windowIcon().pixmap(72, 72));
+ auto *browser = dynamic_cast<Browser *>(QApplication::instance());
+
+ ui->icon->setPixmap(dynamic_cast<QApplication *>(browser)->windowIcon().pixmap(72, 72));
auto *aboutLabel = new QLabel(this);
aboutLabel->setWordWrap(true);
@@ -63,6 +63,31 @@ AboutDialog::AboutDialog(QWidget *parent)
"<li>Boost " BOOST_LIB_VERSION " </li>"
"</ul></p>"));
ui->toolBox->addItem(libsLabel, tr("Details"));
+
+ // list profiles
+ if(!browser->profiles().isEmpty()) {
+ QString profilesText = tr("<p>Profile list:</p>"
+ "<p><ul>");
+ for(const QString &name : browser->profiles()) {
+ if(name.isEmpty())
+ profilesText += tr("<li>Off-the-record</li>");
+ else
+ profilesText += tr("<li>%1</li>").arg(name);
+ }
+ profilesText += tr("</ul></p>");
+ libsLabel->setText(libsLabel->text() + profilesText);
+ }
+
+ // list plugins
+ if(!browser->plugins().isEmpty()) {
+ QString pluginText = tr("<p>Plugin list:</p>"
+ "<p><ul>");
+ for(const Browser::Plugin &plugin : browser->plugins()) {
+ pluginText += tr("<li>%1 (%2)</li>").arg(plugin.meta["name"].toString(), plugin.meta["author"].toString());
+ }
+ pluginText += tr("</ul></p>");
+ libsLabel->setText(libsLabel->text() + pluginText);
+ }
}
AboutDialog::~AboutDialog()
diff --git a/src/forms/aboutdialog.h b/src/forms/aboutdialog.h
index 3175939..265f3c9 100644
--- a/src/forms/aboutdialog.h
+++ b/src/forms/aboutdialog.h
@@ -6,8 +6,8 @@
* SPDX-License-Identifier: GPL-3.0
*/
-#ifndef ABOUTDIALOG_H
-#define ABOUTDIALOG_H
+#ifndef SMOLBOTE_ABOUTDIALOG_H
+#define SMOLBOTE_ABOUTDIALOG_H
#include <QDialog>
@@ -28,4 +28,4 @@ private:
Ui::AboutDialog *ui;
};
-#endif // ABOUTDIALOG_H
+#endif // SMOLBOTE_ABOUTDIALOG_H
diff --git a/src/forms/aboutdialog.ui b/src/forms/aboutdialog.ui
index 60fd875..f7fe21e 100644
--- a/src/forms/aboutdialog.ui
+++ b/src/forms/aboutdialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>550</width>
- <height>320</height>
+ <width>500</width>
+ <height>600</height>
</rect>
</property>
<property name="windowTitle">
diff --git a/src/main.cpp b/src/main.cpp
index 51087ae..e29e547 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -62,15 +62,15 @@ int main(int argc, char **argv)
// unfortunately, QCommandLineParser will only give us the unknown option
// names, so we need to build a list, add them as options, reparse, and then
// we get their values
- if(!parser.opts.isEmpty()) {
- int _argc = parser.opts.length() + 1;
+ if(!parser.unknownOptions.isEmpty()) {
+ int _argc = parser.unknownOptions.length() + 1;
const char *_argv[_argc];
// program_options requires 0 to be the program name, otherwise it seems to fail
_argv[0] = qUtf8Printable(instance.arguments().at(0));
for(int i = 1; i < _argc; ++i) {
- _argv[i] = qUtf8Printable(QString("--%1=%2").arg(parser.opts[i - 1].names().at(0), parser.value(parser.opts[i - 1])));
+ _argv[i] = qUtf8Printable(QString("--%1=%2").arg(parser.unknownOptions[i - 1].names().at(0), parser.value(parser.unknownOptions[i - 1])));
}
qDebug("Parsing command-line overrides: %s", config->parse(_argc, _argv) ? "ok" : "failed");