aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpaster
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-09-29 18:15:00 +0200
committerhjk <hjk@qt.io>2022-09-30 10:13:08 +0000
commit63f3921334b2607407f66340f52644954ce5bff9 (patch)
tree36602781bceb0a4f9a8115380c08cffcbcaca592 /src/plugins/cpaster
parentc42ae96ba8c65a1a0d76903dfabf478133a677ae (diff)
CPaster: Convert to Tr::tr
Change-Id: I00242638e483aa9cb5b54473982eed137e859ff6 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/plugins/cpaster')
-rw-r--r--src/plugins/cpaster/cpasterplugin.cpp19
-rw-r--r--src/plugins/cpaster/dpastedotcomprotocol.cpp6
-rw-r--r--src/plugins/cpaster/dpastedotcomprotocol.h3
-rw-r--r--src/plugins/cpaster/fileshareprotocol.cpp10
-rw-r--r--src/plugins/cpaster/fileshareprotocol.h4
-rw-r--r--src/plugins/cpaster/fileshareprotocolsettingspage.cpp12
-rw-r--r--src/plugins/cpaster/fileshareprotocolsettingspage.h4
-rw-r--r--src/plugins/cpaster/pastebindotcomprotocol.cpp16
-rw-r--r--src/plugins/cpaster/pastebindotcomprotocol.h3
-rw-r--r--src/plugins/cpaster/pasteselectdialog.cpp14
-rw-r--r--src/plugins/cpaster/pasteselectdialog.h1
-rw-r--r--src/plugins/cpaster/pasteview.cpp27
-rw-r--r--src/plugins/cpaster/pasteview.h4
-rw-r--r--src/plugins/cpaster/protocol.cpp22
-rw-r--r--src/plugins/cpaster/protocol.h2
-rw-r--r--src/plugins/cpaster/settings.cpp19
-rw-r--r--src/plugins/cpaster/settings.h4
-rw-r--r--src/plugins/cpaster/stickynotespasteprotocol.cpp13
-rw-r--r--src/plugins/cpaster/stickynotespasteprotocol.h8
-rw-r--r--src/plugins/cpaster/urlopenprotocol.cpp4
-rw-r--r--src/plugins/cpaster/urlopenprotocol.h3
21 files changed, 95 insertions, 103 deletions
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp
index eaeb1e5c30..edc3913ccd 100644
--- a/src/plugins/cpaster/cpasterplugin.cpp
+++ b/src/plugins/cpaster/cpasterplugin.cpp
@@ -3,6 +3,7 @@
#include "cpasterplugin.h"
+#include "cpastertr.h"
#include "dpastedotcomprotocol.h"
#include "fileshareprotocol.h"
#include "pastebindotcomprotocol.h"
@@ -44,8 +45,6 @@ namespace CodePaster {
class CodePasterPluginPrivate : public QObject
{
- Q_DECLARE_TR_FUNCTIONS(CodePaster::CodepasterPlugin)
-
public:
CodePasterPluginPrivate();
@@ -149,24 +148,24 @@ CodePasterPluginPrivate::CodePasterPluginPrivate()
ActionContainer *toolsContainer = ActionManager::actionContainer(Core::Constants::M_TOOLS);
ActionContainer *cpContainer = ActionManager::createMenu("CodePaster");
- cpContainer->menu()->setTitle(tr("&Code Pasting"));
+ cpContainer->menu()->setTitle(Tr::tr("&Code Pasting"));
toolsContainer->addMenu(cpContainer);
Command *command;
- m_postEditorAction = new QAction(tr("Paste Snippet..."), this);
+ m_postEditorAction = new QAction(Tr::tr("Paste Snippet..."), this);
command = ActionManager::registerAction(m_postEditorAction, "CodePaster.Post");
- command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+C,Meta+P") : tr("Alt+C,Alt+P")));
+ command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+C,Meta+P") : Tr::tr("Alt+C,Alt+P")));
connect(m_postEditorAction, &QAction::triggered, this, &CodePasterPluginPrivate::pasteSnippet);
cpContainer->addAction(command);
- m_fetchAction = new QAction(tr("Fetch Snippet..."), this);
+ m_fetchAction = new QAction(Tr::tr("Fetch Snippet..."), this);
command = ActionManager::registerAction(m_fetchAction, "CodePaster.Fetch");
- command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+C,Meta+F") : tr("Alt+C,Alt+F")));
+ command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+C,Meta+F") : Tr::tr("Alt+C,Alt+F")));
connect(m_fetchAction, &QAction::triggered, this, &CodePasterPluginPrivate::fetch);
cpContainer->addAction(command);
- m_fetchUrlAction = new QAction(tr("Fetch from URL..."), this);
+ m_fetchUrlAction = new QAction(Tr::tr("Fetch from URL..."), this);
command = ActionManager::registerAction(m_fetchUrlAction, "CodePaster.FetchUrl");
connect(m_fetchUrlAction, &QAction::triggered, this, &CodePasterPluginPrivate::fetchUrl);
cpContainer->addAction(command);
@@ -268,7 +267,7 @@ void CodePasterPluginPrivate::fetchUrl()
QUrl url;
do {
bool ok = true;
- url = QUrl(QInputDialog::getText(ICore::dialogParent(), tr("Fetch from URL"), tr("Enter URL:"), QLineEdit::Normal, QString(), &ok));
+ url = QUrl(QInputDialog::getText(ICore::dialogParent(), Tr::tr("Fetch from URL"), Tr::tr("Enter URL:"), QLineEdit::Normal, QString(), &ok));
if (!ok)
return;
} while (!url.isValid());
@@ -357,7 +356,7 @@ void CodePasterPluginPrivate::finishFetch(const QString &titleDescription,
}
if (content.isEmpty()) {
MessageManager::writeDisrupting(
- tr("Empty snippet received for \"%1\".").arg(titleDescription));
+ Tr::tr("Empty snippet received for \"%1\".").arg(titleDescription));
return;
}
// If the mime type has a preferred suffix (cpp/h/patch...), use that for
diff --git a/src/plugins/cpaster/dpastedotcomprotocol.cpp b/src/plugins/cpaster/dpastedotcomprotocol.cpp
index 3f87884e65..107343f823 100644
--- a/src/plugins/cpaster/dpastedotcomprotocol.cpp
+++ b/src/plugins/cpaster/dpastedotcomprotocol.cpp
@@ -3,6 +3,8 @@
#include "dpastedotcomprotocol.h"
+#include "cpastertr.h"
+
#include <coreplugin/messagemanager.h>
#include <QNetworkReply>
@@ -124,8 +126,8 @@ bool DPasteDotComProtocol::checkConfiguration(QString * /*errorMessage*/)
void DPasteDotComProtocol::reportError(const QString &message)
{
- const QString fullMessage = tr("%1: %2").arg(protocolName(), message);
+ const QString fullMessage = Tr::tr("%1: %2").arg(protocolName(), message);
Core::MessageManager::writeDisrupting(fullMessage);
}
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/dpastedotcomprotocol.h b/src/plugins/cpaster/dpastedotcomprotocol.h
index 34842dda87..88662243a6 100644
--- a/src/plugins/cpaster/dpastedotcomprotocol.h
+++ b/src/plugins/cpaster/dpastedotcomprotocol.h
@@ -9,7 +9,6 @@ namespace CodePaster {
class DPasteDotComProtocol : public NetworkProtocol
{
- Q_OBJECT
public:
static QString protocolName();
@@ -30,4 +29,4 @@ private:
static void reportError(const QString &message);
};
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/fileshareprotocol.cpp b/src/plugins/cpaster/fileshareprotocol.cpp
index 0212924c93..5251c18538 100644
--- a/src/plugins/cpaster/fileshareprotocol.cpp
+++ b/src/plugins/cpaster/fileshareprotocol.cpp
@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "fileshareprotocol.h"
+
+#include "cpastertr.h"
#include "fileshareprotocolsettingspage.h"
#include <coreplugin/icore.h>
@@ -74,7 +76,7 @@ static bool parse(const QString &fileName,
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
- *errorMessage = FileShareProtocol::tr("Cannot open %1: %2").arg(fileName, file.errorString());
+ *errorMessage = Tr::tr("Cannot open %1: %2").arg(fileName, file.errorString());
return false;
}
QXmlStreamReader reader(&file);
@@ -83,7 +85,7 @@ static bool parse(const QString &fileName,
const auto elementName = reader.name();
// Check start element
if (elementCount == 0 && elementName != QLatin1String(pasterElementC)) {
- *errorMessage = FileShareProtocol::tr("%1 does not appear to be a paster file.").arg(fileName);
+ *errorMessage = Tr::tr("%1 does not appear to be a paster file.").arg(fileName);
return false;
}
// Parse elements
@@ -97,7 +99,7 @@ static bool parse(const QString &fileName,
}
}
if (reader.hasError()) {
- *errorMessage = FileShareProtocol::tr("Error in %1 at %2: %3")
+ *errorMessage = Tr::tr("Error in %1 at %2: %3")
.arg(fileName).arg(reader.lineNumber()).arg(reader.errorString());
return false;
}
@@ -108,7 +110,7 @@ bool FileShareProtocol::checkConfiguration(QString *errorMessage)
{
if (m_settings.path.value().isEmpty()) {
if (errorMessage)
- *errorMessage = tr("Please configure a path.");
+ *errorMessage = Tr::tr("Please configure a path.");
return false;
}
return true;
diff --git a/src/plugins/cpaster/fileshareprotocol.h b/src/plugins/cpaster/fileshareprotocol.h
index 00820122cf..262a8f77c5 100644
--- a/src/plugins/cpaster/fileshareprotocol.h
+++ b/src/plugins/cpaster/fileshareprotocol.h
@@ -15,8 +15,6 @@ class FileShareProtocolSettingsPage;
class FileShareProtocol : public Protocol
{
- Q_OBJECT
-
public:
FileShareProtocol();
~FileShareProtocol() override;
@@ -40,4 +38,4 @@ private:
FileShareProtocolSettingsPage *m_settingsPage;
};
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/fileshareprotocolsettingspage.cpp b/src/plugins/cpaster/fileshareprotocolsettingspage.cpp
index 3661f6d9e2..dbbdbb862b 100644
--- a/src/plugins/cpaster/fileshareprotocolsettingspage.cpp
+++ b/src/plugins/cpaster/fileshareprotocolsettingspage.cpp
@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "fileshareprotocolsettingspage.h"
+
+#include "cpastertr.h"
#include "cpasterconstants.h"
#include <utils/layoutbuilder.h>
@@ -21,13 +23,13 @@ FileShareProtocolSettings::FileShareProtocolSettings()
path.setDisplayStyle(StringAspect::PathChooserDisplay);
path.setExpectedKind(PathChooser::ExistingDirectory);
path.setDefaultValue(TemporaryDirectory::masterDirectoryPath());
- path.setLabelText(tr("&Path:"));
+ path.setLabelText(Tr::tr("&Path:"));
registerAspect(&displayCount);
displayCount.setSettingsKey("DisplayCount");
displayCount.setDefaultValue(10);
- displayCount.setSuffix(' ' + tr("entries"));
- displayCount.setLabelText(tr("&Display:"));
+ displayCount.setSuffix(' ' + Tr::tr("entries"));
+ displayCount.setLabelText(Tr::tr("&Display:"));
}
// Settings page
@@ -35,14 +37,14 @@ FileShareProtocolSettings::FileShareProtocolSettings()
FileShareProtocolSettingsPage::FileShareProtocolSettingsPage(FileShareProtocolSettings *settings)
{
setId("X.CodePaster.FileSharePaster");
- setDisplayName(FileShareProtocolSettings::tr("Fileshare"));
+ setDisplayName(Tr::tr("Fileshare"));
setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
setSettings(settings);
setLayouter([&s = *settings](QWidget *widget) {
using namespace Layouting;
- auto label = new QLabel(FileShareProtocolSettings::tr(
+ auto label = new QLabel(Tr::tr(
"The fileshare-based paster protocol allows for sharing code snippets using "
"simple files on a shared network drive. Files are never deleted."));
label->setWordWrap(true);
diff --git a/src/plugins/cpaster/fileshareprotocolsettingspage.h b/src/plugins/cpaster/fileshareprotocolsettingspage.h
index 78197f75e0..625d8ac071 100644
--- a/src/plugins/cpaster/fileshareprotocolsettingspage.h
+++ b/src/plugins/cpaster/fileshareprotocolsettingspage.h
@@ -11,8 +11,6 @@ namespace CodePaster {
class FileShareProtocolSettings : public Utils::AspectContainer
{
- Q_DECLARE_TR_FUNCTIONS(CodePaster::FileShareProtocolSettings)
-
public:
FileShareProtocolSettings();
@@ -26,4 +24,4 @@ public:
explicit FileShareProtocolSettingsPage(FileShareProtocolSettings *settings);
};
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp
index 852f41188e..9aef023ec8 100644
--- a/src/plugins/cpaster/pastebindotcomprotocol.cpp
+++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp
@@ -14,16 +14,16 @@
enum { debug = 0 };
-static const char PASTEBIN_BASE[]="https://pastebin.com/";
-static const char PASTEBIN_API[]="api/api_post.php";
-static const char PASTEBIN_RAW[]="raw/";
-static const char PASTEBIN_ARCHIVE[]="archive";
+namespace CodePaster {
-static const char API_KEY[]="api_dev_key=516686fc461fb7f9341fd7cf2af6f829&"; // user: qtcreator_apikey
+const char PASTEBIN_BASE[]="https://pastebin.com/";
+const char PASTEBIN_API[]="api/api_post.php";
+const char PASTEBIN_RAW[]="raw/";
+const char PASTEBIN_ARCHIVE[]="archive";
-static const char PROTOCOL_NAME[] = "Pastebin.Com";
+const char API_KEY[]="api_dev_key=516686fc461fb7f9341fd7cf2af6f829&"; // user: qtcreator_apikey
-namespace CodePaster {
+const char PROTOCOL_NAME[] = "Pastebin.Com";
QString PasteBinDotComProtocol::protocolName()
{
@@ -470,4 +470,4 @@ void PasteBinDotComProtocol::listFinished()
m_listReply = nullptr;
}
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/pastebindotcomprotocol.h b/src/plugins/cpaster/pastebindotcomprotocol.h
index 658b26a281..740fbca744 100644
--- a/src/plugins/cpaster/pastebindotcomprotocol.h
+++ b/src/plugins/cpaster/pastebindotcomprotocol.h
@@ -9,7 +9,6 @@ namespace CodePaster {
class PasteBinDotComProtocol : public NetworkProtocol
{
- Q_OBJECT
public:
static QString protocolName();
QString name() const override { return protocolName(); }
@@ -39,4 +38,4 @@ private:
bool m_hostChecked = false;
};
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/pasteselectdialog.cpp b/src/plugins/cpaster/pasteselectdialog.cpp
index 9c7fc6ae05..3454824fbf 100644
--- a/src/plugins/cpaster/pasteselectdialog.cpp
+++ b/src/plugins/cpaster/pasteselectdialog.cpp
@@ -3,6 +3,7 @@
#include "pasteselectdialog.h"
+#include "cpastertr.h"
#include "protocol.h"
#include <utils/hostosinfo.h>
@@ -37,7 +38,7 @@ PasteSelectDialog::PasteSelectDialog(const QList<Protocol*> &protocols, QWidget
auto buttons = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
- m_refreshButton = buttons->addButton(tr("Refresh"), QDialogButtonBox::ActionRole);
+ m_refreshButton = buttons->addButton(Tr::tr("Refresh"), QDialogButtonBox::ActionRole);
m_listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
if (!Utils::HostOsInfo::isMacHost())
@@ -52,8 +53,8 @@ PasteSelectDialog::PasteSelectDialog(const QList<Protocol*> &protocols, QWidget
using namespace Utils::Layouting;
Column {
Form {
- tr("Protocol:"), m_protocolBox, br,
- tr("Paste:"), m_pasteEdit
+ Tr::tr("Protocol:"), m_protocolBox, br,
+ Tr::tr("Paste:"), m_pasteEdit
},
m_listWidget,
buttons
@@ -126,7 +127,7 @@ void PasteSelectDialog::list()
m_listWidget->clear();
if (Protocol::ensureConfiguration(protocol, this)) {
- m_listWidget->addItem(new QListWidgetItem(tr("Waiting for items")));
+ m_listWidget->addItem(new QListWidgetItem(Tr::tr("Waiting for items")));
protocol->list();
}
}
@@ -139,7 +140,8 @@ void PasteSelectDialog::protocolChanged(int i)
list();
} else {
m_listWidget->clear();
- m_listWidget->addItem(new QListWidgetItem(tr("This protocol does not support listing")));
+ m_listWidget->addItem(new QListWidgetItem(Tr::tr("This protocol does not support listing")));
}
}
-} // namespace CodePaster
+
+} // CodePaster
diff --git a/src/plugins/cpaster/pasteselectdialog.h b/src/plugins/cpaster/pasteselectdialog.h
index caf4f581e9..8c82adbe4a 100644
--- a/src/plugins/cpaster/pasteselectdialog.h
+++ b/src/plugins/cpaster/pasteselectdialog.h
@@ -19,7 +19,6 @@ class Protocol;
class PasteSelectDialog : public QDialog
{
- Q_OBJECT
public:
explicit PasteSelectDialog(const QList<Protocol*> &protocols,
QWidget *parent = nullptr);
diff --git a/src/plugins/cpaster/pasteview.cpp b/src/plugins/cpaster/pasteview.cpp
index e75ee805da..5d3d9816ef 100644
--- a/src/plugins/cpaster/pasteview.cpp
+++ b/src/plugins/cpaster/pasteview.cpp
@@ -4,6 +4,7 @@
#include "pasteview.h"
#include "columnindicatortextedit.h"
+#include "cpastertr.h"
#include "protocol.h"
#include <coreplugin/icore.h>
@@ -26,36 +27,36 @@
#include <QStackedWidget>
#include <QTextEdit>
+namespace CodePaster {
+
const char groupC[] = "CPaster";
const char heightKeyC[] = "PasteViewHeight";
const char widthKeyC[] = "PasteViewWidth";
-namespace CodePaster {
-
PasteView::PasteView(const QList<Protocol *> &protocols,
const QString &mt,
QWidget *parent) :
QDialog(parent),
m_protocols(protocols),
- m_commentPlaceHolder(tr("<Comment>")),
+ m_commentPlaceHolder(Tr::tr("<Comment>")),
m_mimeType(mt)
{
resize(670, 678);
- setWindowTitle(tr("Send to Codepaster"));
+ setWindowTitle(Tr::tr("Send to Codepaster"));
m_protocolBox = new QComboBox;
for (const Protocol *p : protocols)
m_protocolBox->addItem(p->name());
m_expirySpinBox = new QSpinBox;
- m_expirySpinBox->setSuffix(tr(" Days"));
+ m_expirySpinBox->setSuffix(Tr::tr(" Days"));
m_expirySpinBox->setRange(1, 365);
m_uiUsername = new QLineEdit(this);
- m_uiUsername->setPlaceholderText(tr("<Username>"));
+ m_uiUsername->setPlaceholderText(Tr::tr("<Username>"));
m_uiDescription = new QLineEdit(this);
- m_uiDescription->setPlaceholderText(tr("<Description>"));
+ m_uiDescription->setPlaceholderText(Tr::tr("<Description>"));
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@@ -78,7 +79,7 @@ PasteView::PasteView(const QList<Protocol *> &protocols,
m_uiPatchView->setFont(font);
m_uiPatchView->setReadOnly(true);
- auto groupBox = new QGroupBox(tr("Parts to Send to Server"));
+ auto groupBox = new QGroupBox(Tr::tr("Parts to Send to Server"));
groupBox->setFlat(true);
m_plainTextEdit = new QPlainTextEdit;
@@ -89,7 +90,7 @@ PasteView::PasteView(const QList<Protocol *> &protocols,
m_stackedWidget->setCurrentIndex(0);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
- buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Paste"));
+ buttonBox->button(QDialogButtonBox::Ok)->setText(Tr::tr("Paste"));
const bool __sortingEnabled = m_uiPatchList->isSortingEnabled();
m_uiPatchList->setSortingEnabled(false);
@@ -104,10 +105,10 @@ PasteView::PasteView(const QList<Protocol *> &protocols,
Column {
Form {
- tr("Protocol:"), m_protocolBox, br,
- tr("&Expires after:"), m_expirySpinBox, br,
- tr("&Username:"), m_uiUsername, br,
- tr("&Description:"), m_uiDescription,
+ Tr::tr("Protocol:"), m_protocolBox, br,
+ Tr::tr("&Expires after:"), m_expirySpinBox, br,
+ Tr::tr("&Username:"), m_uiUsername, br,
+ Tr::tr("&Description:"), m_uiDescription,
},
m_uiComment,
m_stackedWidget,
diff --git a/src/plugins/cpaster/pasteview.h b/src/plugins/cpaster/pasteview.h
index 108e888151..e6c1176385 100644
--- a/src/plugins/cpaster/pasteview.h
+++ b/src/plugins/cpaster/pasteview.h
@@ -24,8 +24,6 @@ class Protocol;
class PasteView : public QDialog
{
- Q_OBJECT
-
public:
enum Mode
{
@@ -83,4 +81,4 @@ private:
Mode m_mode = DiffChunkMode;
};
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/protocol.cpp b/src/plugins/cpaster/protocol.cpp
index 4e0ca21465..7f76f0d81b 100644
--- a/src/plugins/cpaster/protocol.cpp
+++ b/src/plugins/cpaster/protocol.cpp
@@ -3,6 +3,8 @@
#include "protocol.h"
+#include "cpastertr.h"
+
#include <utils/networkaccessmanager.h>
#include <cppeditor/cppeditorconstants.h>
@@ -13,19 +15,17 @@
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/ioptionspage.h>
+#include <QApplication>
+#include <QDebug>
+#include <QMessageBox>
#include <QNetworkCookie>
#include <QNetworkCookieJar>
-#include <QNetworkRequest>
#include <QNetworkReply>
-
+#include <QNetworkRequest>
+#include <QPushButton>
#include <QUrl>
-#include <QDebug>
#include <QVariant>
-#include <QMessageBox>
-#include <QApplication>
-#include <QPushButton>
-
#include <memory>
namespace CodePaster {
@@ -140,7 +140,7 @@ bool Protocol::showConfigurationError(const Protocol *p,
if (!parent)
parent = Core::ICore::dialogParent();
- const QString title = tr("%1 - Configuration Error").arg(p->name());
+ const QString title = Tr::tr("%1 - Configuration Error").arg(p->name());
QMessageBox mb(QMessageBox::Warning, title, message, QMessageBox::Cancel, parent);
QPushButton *settingsButton = nullptr;
if (showConfig)
@@ -197,8 +197,8 @@ bool NetworkProtocol::httpStatus(QString url, QString *errorMessage, bool useHtt
}
std::unique_ptr<QNetworkReply> reply(httpGet(url));
QMessageBox box(QMessageBox::Information,
- tr("Checking connection"),
- tr("Connecting to %1...").arg(url),
+ Tr::tr("Checking connection"),
+ Tr::tr("Connecting to %1...").arg(url),
QMessageBox::Cancel,
Core::ICore::dialogParent());
connect(reply.get(), &QNetworkReply::finished, &box, &QWidget::close);
@@ -219,4 +219,4 @@ bool NetworkProtocol::httpStatus(QString url, QString *errorMessage, bool useHtt
return false;
}
-} //namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/protocol.h b/src/plugins/cpaster/protocol.h
index d4f0db9b39..f5e15dbf3e 100644
--- a/src/plugins/cpaster/protocol.h
+++ b/src/plugins/cpaster/protocol.h
@@ -82,8 +82,6 @@ protected:
class NetworkProtocol : public Protocol
{
- Q_OBJECT
-
public:
NetworkProtocol() = default;
diff --git a/src/plugins/cpaster/settings.cpp b/src/plugins/cpaster/settings.cpp
index b9046d1b52..f86c62029d 100644
--- a/src/plugins/cpaster/settings.cpp
+++ b/src/plugins/cpaster/settings.cpp
@@ -4,6 +4,7 @@
#include "settings.h"
#include "cpasterconstants.h"
+#include "cpastertr.h"
#include <utils/layoutbuilder.h>
@@ -19,12 +20,12 @@ Settings::Settings()
registerAspect(&username);
username.setDisplayStyle(StringAspect::LineEditDisplay);
username.setSettingsKey("UserName");
- username.setLabelText(tr("Username:"));
+ username.setLabelText(Tr::tr("Username:"));
registerAspect(&protocols);
protocols.setSettingsKey("DefaultProtocol");
protocols.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
- protocols.setLabelText(tr("Default protocol:"));
+ protocols.setLabelText(Tr::tr("Default protocol:"));
protocols.setToSettingsTransformation([this](const QVariant &val) {
return protocols.displayForIndex(val.toInt());
});
@@ -35,18 +36,18 @@ Settings::Settings()
registerAspect(&expiryDays);
expiryDays.setSettingsKey("ExpiryDays");
expiryDays.setDefaultValue(1);
- expiryDays.setSuffix(tr(" Days"));
- expiryDays.setLabelText(tr("&Expires after:"));
+ expiryDays.setSuffix(Tr::tr(" Days"));
+ expiryDays.setLabelText(Tr::tr("&Expires after:"));
registerAspect(&copyToClipboard);
copyToClipboard.setSettingsKey("CopyToClipboard");
copyToClipboard.setDefaultValue(true);
- copyToClipboard.setLabelText(tr("Copy-paste URL to clipboard"));
+ copyToClipboard.setLabelText(Tr::tr("Copy-paste URL to clipboard"));
registerAspect(&displayOutput);
displayOutput.setSettingsKey("DisplayOutput");
displayOutput.setDefaultValue(true);
- displayOutput.setLabelText(tr("Display General Messages after sending a post"));
+ displayOutput.setLabelText(Tr::tr("Display General Messages after sending a post"));
}
// SettingsPage
@@ -54,9 +55,9 @@ Settings::Settings()
SettingsPage::SettingsPage(Settings *settings)
{
setId("A.CodePaster.General");
- setDisplayName(Settings::tr("General"));
+ setDisplayName(Tr::tr("General"));
setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
- setDisplayCategory(Settings::tr("Code Pasting"));
+ setDisplayCategory(Tr::tr("Code Pasting"));
setCategoryIconPath(":/cpaster/images/settingscategory_cpaster.png");
setSettings(settings);
@@ -77,4 +78,4 @@ SettingsPage::SettingsPage(Settings *settings)
});
}
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/settings.h b/src/plugins/cpaster/settings.h
index 17184d4558..1e37f6f812 100644
--- a/src/plugins/cpaster/settings.h
+++ b/src/plugins/cpaster/settings.h
@@ -11,8 +11,6 @@ namespace CodePaster {
class Settings : public Utils::AspectContainer
{
- Q_DECLARE_TR_FUNCTIONS(CodePaster::Settings)
-
public:
Settings();
@@ -29,4 +27,4 @@ public:
SettingsPage(Settings *settings);
};
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/stickynotespasteprotocol.cpp b/src/plugins/cpaster/stickynotespasteprotocol.cpp
index a48a419ed1..3d7edd41cd 100644
--- a/src/plugins/cpaster/stickynotespasteprotocol.cpp
+++ b/src/plugins/cpaster/stickynotespasteprotocol.cpp
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "stickynotespasteprotocol.h"
-#ifdef CPASTER_PLUGIN_GUI
-#endif
+
+#include "cpastertr.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
@@ -21,7 +21,9 @@
enum { debug = 0 };
-static inline QByteArray expiryParameter(int daysRequested)
+namespace CodePaster {
+
+static QByteArray expiryParameter(int daysRequested)
{
// Obtained by 'pastebin.kde.org/api/json/parameter/expire' on 26.03.2014
static const int expiryTimesSec[] = {1800, 21600, 86400, 604800, 2592000, 31536000};
@@ -31,8 +33,6 @@ static inline QByteArray expiryParameter(int daysRequested)
return QByteArray("expire=") + QByteArray::number(*match);
}
-namespace CodePaster {
-
void StickyNotesPasteProtocol::setHostUrl(const QString &hostUrl)
{
m_hostUrl = hostUrl;
@@ -246,5 +246,4 @@ void StickyNotesPasteProtocol::listFinished()
m_listReply = nullptr;
}
-
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/stickynotespasteprotocol.h b/src/plugins/cpaster/stickynotespasteprotocol.h
index 264be22fd0..e497fac2d8 100644
--- a/src/plugins/cpaster/stickynotespasteprotocol.h
+++ b/src/plugins/cpaster/stickynotespasteprotocol.h
@@ -9,7 +9,6 @@ namespace CodePaster {
class StickyNotesPasteProtocol : public NetworkProtocol
{
- Q_OBJECT
public:
unsigned capabilities() const override;
@@ -22,15 +21,12 @@ public:
const QString &description = QString()) override;
void list() override;
-
-
QString hostUrl() const { return m_hostUrl; }
void setHostUrl(const QString &hostUrl);
-protected:
+private:
bool checkConfiguration(QString *errorMessage = nullptr) override;
-private:
void fetchFinished();
void pasteFinished();
void listFinished();
@@ -46,4 +42,4 @@ private:
bool m_hostChecked = false;
};
-} // namespace CodePaster
+} // CodePaster
diff --git a/src/plugins/cpaster/urlopenprotocol.cpp b/src/plugins/cpaster/urlopenprotocol.cpp
index 39d1a3beb6..64c2029cab 100644
--- a/src/plugins/cpaster/urlopenprotocol.cpp
+++ b/src/plugins/cpaster/urlopenprotocol.cpp
@@ -7,7 +7,7 @@
#include <QNetworkReply>
-using namespace CodePaster;
+namespace CodePaster {
QString UrlOpenProtocol::name() const
{
@@ -45,3 +45,5 @@ void UrlOpenProtocol::paste(const QString &, ContentType, int, const QString &,
const QString &, const QString &)
{
}
+
+} // CodePaster
diff --git a/src/plugins/cpaster/urlopenprotocol.h b/src/plugins/cpaster/urlopenprotocol.h
index d6d16e56b1..8bc5695b01 100644
--- a/src/plugins/cpaster/urlopenprotocol.h
+++ b/src/plugins/cpaster/urlopenprotocol.h
@@ -9,7 +9,6 @@ namespace CodePaster {
class UrlOpenProtocol : public NetworkProtocol
{
- Q_OBJECT
public:
QString name() const override;
unsigned capabilities() const override;
@@ -22,4 +21,4 @@ private:
QNetworkReply *m_fetchReply = nullptr;
};
-} // namespace CodePaster
+} // CodePaster