forked from qt-creator/qt-creator
CPaster: Convert to Tr::tr
Change-Id: I00242638e483aa9cb5b54473982eed137e859ff6 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
|
||||
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";
|
||||
|
||||
static const char API_KEY[]="api_dev_key=516686fc461fb7f9341fd7cf2af6f829&"; // user: qtcreator_apikey
|
||||
|
||||
static const char PROTOCOL_NAME[] = "Pastebin.Com";
|
||||
|
||||
namespace CodePaster {
|
||||
|
||||
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";
|
||||
|
||||
const char API_KEY[]="api_dev_key=516686fc461fb7f9341fd7cf2af6f829&"; // user: qtcreator_apikey
|
||||
|
||||
const char PROTOCOL_NAME[] = "Pastebin.Com";
|
||||
|
||||
QString PasteBinDotComProtocol::protocolName()
|
||||
{
|
||||
return QLatin1String(PROTOCOL_NAME);
|
||||
@@ -470,4 +470,4 @@ void PasteBinDotComProtocol::listFinished()
|
||||
m_listReply = nullptr;
|
||||
}
|
||||
|
||||
} // namespace CodePaster
|
||||
} // CodePaster
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,7 +19,6 @@ class Protocol;
|
||||
|
||||
class PasteSelectDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PasteSelectDialog(const QList<Protocol*> &protocols,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "protocol.h"
|
||||
|
||||
#include "cpastertr.h"
|
||||
|
||||
#include <utils/networkaccessmanager.h>
|
||||
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
@@ -13,18 +15,16 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkCookie>
|
||||
#include <QNetworkCookieJar>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
#include <QVariant>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
#include <QNetworkRequest>
|
||||
#include <QPushButton>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -82,8 +82,6 @@ protected:
|
||||
|
||||
class NetworkProtocol : public Protocol
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NetworkProtocol() = default;
|
||||
|
||||
|
||||
@@ -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(©ToClipboard);
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user