Move about info to settings

This commit is contained in:
Gres 2020-04-03 19:13:24 +03:00
parent ca99f570f7
commit 58f6283fe3
5 changed files with 44 additions and 30 deletions

View File

@ -1,6 +1,5 @@
#include "manager.h"
#include "capturer.h"
#include "commonmodels.h"
#include "corrector.h"
#include "debug.h"
#include "recognizer.h"
@ -12,7 +11,6 @@
#include "updates.h"
#include <QApplication>
#include <QMessageBox>
#include <QNetworkProxy>
#include <QThread>
@ -290,25 +288,6 @@ void Manager::copyLastToClipboard()
representer_->clipboardLast();
}
void Manager::about()
{
const auto mail = "translator@gres.biz";
const auto issues = "https://github.com/OneMoreGres/ScreenTranslator/issues";
const auto text =
QObject::tr(
R"(<p>Optical character recognition (OCR) and translation tool</p>
<p>Version: %1</p>
<p>Author: Gres (<a href="mailto:%2">%2</a>)</p>
<p>Issues: <a href="%3">github</a></p>)")
.arg(QApplication::applicationVersion(), mail, issues);
QMessageBox message(QMessageBox::Information, QObject::tr("About"), text,
QMessageBox::Ok);
message.setIconPixmap(QIcon(":/icons/app.png").pixmap(QSize(64, 64)));
message.setTextFormat(Qt::RichText);
message.exec();
}
void Manager::quit()
{
QApplication::quit();

View File

@ -25,7 +25,6 @@ public:
void showTranslator();
void settings();
void copyLastToClipboard();
void about();
void quit();
private:

View File

@ -33,8 +33,8 @@ SettingsEditor::SettingsEditor(Manager &manager, update::Loader &updater)
{
auto model = new QStringListModel(this);
model->setStringList({tr("General"), tr("Recognition"), tr("Correction"),
tr("Translation"), tr("Representation"),
tr("Update")});
tr("Translation"), tr("Representation"), tr("Update"),
tr("About")});
ui->pagesList->setModel(model);
auto selection = ui->pagesList->selectionModel();
connect(selection, &QItemSelectionModel::currentRowChanged, //
@ -103,6 +103,24 @@ SettingsEditor::SettingsEditor(Manager &manager, update::Loader &updater)
connect(ui->applyUpdates, &QPushButton::clicked, //
&updater_, &update::Loader::applyUserActions);
// about
{
const auto mail = "translator@gres.biz";
const auto issues =
"https://github.com/OneMoreGres/ScreenTranslator/issues";
const auto aboutText =
QObject::tr(
R"(<p>Optical character recognition (OCR) and translation tool</p>
<p>Version: %1</p>
<p>Author: Gres (<a href="mailto:%2">%2</a>)</p>
<p>Issues: <a href="%3">%3</a></p>)")
.arg(QApplication::applicationVersion(), mail, issues);
ui->aboutLabel->setText(aboutText);
ui->aboutLabel->setTextFormat(Qt::RichText);
ui->aboutLabel->setOpenExternalLinks(true);
}
new service::WidgetState(this);
}

View File

@ -632,6 +632,30 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="pageAbout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="aboutLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -231,12 +231,6 @@ QMenu *TrayIcon::contextMenu()
this, [this] { manager_.settings(); });
}
{
auto action = menu->addAction(tr("About"));
connect(action, &QAction::triggered, //
this, [this] { manager_.about(); });
}
{
auto action = menu->addAction(tr("Quit"));
connect(action, &QAction::triggered, //