CPaster: Use new pattern for SettingsPage

Change-Id: I90f8684e51dd7855000dd93b68b94c7c6b56402b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-01-16 12:46:45 +01:00
parent 43113470a4
commit 20725da050
4 changed files with 38 additions and 78 deletions

View File

@@ -115,9 +115,10 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe
// Create the settings Page
m_settings->fromSettings(ICore::settings());
auto settingsPage = new SettingsPage(m_settings, this);
// Create the protocols and append them to the Settings
QStringList protocolNames;
Protocol *protos[] = {new PasteBinDotComProtocol,
new FileShareProtocol,
new PasteCodeDotXyzProtocol,
@@ -126,10 +127,12 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe
for (int i = 0; i < count; ++i) {
connect(protos[i], &Protocol::pasteDone, this, &CodepasterPlugin::finishPost);
connect(protos[i], &Protocol::fetchDone, this, &CodepasterPlugin::finishFetch);
settingsPage->addProtocol(protos[i]->name());
protocolNames.append(protos[i]->name());
m_protocols.append(protos[i]);
}
(void) new SettingsPage(m_settings, protocolNames, this);
m_urlOpen = new UrlOpenProtocol;
connect(m_urlOpen, &Protocol::fetchDone, this, &CodepasterPlugin::finishFetch);