mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-15 06:45:48 +00:00
refactor: simplify sources processing
Also fix desktop source
This commit is contained in:
@ -91,7 +91,7 @@ void AWAbstractPairConfig::updateUi()
|
||||
// remove current selector if it is empty and does not last
|
||||
if (sender() == m_selectors.last())
|
||||
return;
|
||||
auto *selector = m_selectors.takeAt(index);
|
||||
auto selector = m_selectors.takeAt(index);
|
||||
ui->verticalLayout->removeWidget(selector);
|
||||
selector->deleteLater();
|
||||
} else {
|
||||
@ -109,7 +109,7 @@ void AWAbstractPairConfig::addSelector(const QStringList &_keys, const QStringLi
|
||||
{
|
||||
qCDebug(LOG_AW) << "Add selector with keys" << _keys << "values" << _values << "and current ones" << _current;
|
||||
|
||||
auto *selector = new AWAbstractSelector(ui->scrollAreaWidgetContents, m_editable);
|
||||
auto selector = new AWAbstractSelector(ui->scrollAreaWidgetContents, m_editable);
|
||||
selector->init(_keys, _values, _current);
|
||||
ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1, selector);
|
||||
connect(selector, &AWAbstractSelector::selectionChanged, this, &AWAbstractPairConfig::updateUi);
|
||||
|
@ -90,7 +90,7 @@ void AWActions::showReadme()
|
||||
|
||||
void AWActions::showLegacyInfo()
|
||||
{
|
||||
auto *msgBox = new QMessageBox(nullptr);
|
||||
auto msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(i18n("Not supported"));
|
||||
|
@ -71,7 +71,7 @@ void AWBugReporter::sendBugReport(const QString &_title, const QString &_body)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Send bug report with title" << _title << "and body" << _body;
|
||||
|
||||
auto *manager = new QNetworkAccessManager(nullptr);
|
||||
auto manager = new QNetworkAccessManager(nullptr);
|
||||
connect(manager, &QNetworkAccessManager::finished, this, &AWBugReporter::issueReplyReceived);
|
||||
|
||||
auto request = QNetworkRequest(QUrl(BUGTRACKER_API));
|
||||
@ -121,7 +121,7 @@ void AWBugReporter::showInformation(const int _number, const QString &_url)
|
||||
// cache url first
|
||||
m_lastBugUrl = _url;
|
||||
|
||||
auto *msgBox = new QMessageBox(nullptr);
|
||||
auto msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(i18n("Issue created"));
|
||||
|
@ -72,7 +72,7 @@ bool AWConfigHelper::exportConfiguration(QObject *_nativeConfig, const QString &
|
||||
|
||||
QSettings settings(_fileName, QSettings::IniFormat);
|
||||
// plasmoid configuration
|
||||
const auto *configuration = dynamic_cast<const QQmlPropertyMap *>(_nativeConfig);
|
||||
auto configuration = dynamic_cast<const QQmlPropertyMap *>(_nativeConfig);
|
||||
settings.beginGroup("plasmoid");
|
||||
for (auto &key : configuration->keys()) {
|
||||
QVariant value = configuration->value(key);
|
||||
|
@ -210,11 +210,11 @@ QString AWKeyOperations::infoByKey(const QString &_key) const
|
||||
QString output;
|
||||
|
||||
if (_key.startsWith("bar")) {
|
||||
auto *item = m_graphicalItems->itemByTag(_key, stripped);
|
||||
auto item = m_graphicalItems->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (_key.startsWith("custom")) {
|
||||
auto *item = m_extScripts->itemByTag(_key, stripped);
|
||||
auto item = m_extScripts->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (_key.contains(QRegularExpression("^hdd[rw]"))) {
|
||||
@ -230,15 +230,15 @@ QString AWKeyOperations::infoByKey(const QString &_key) const
|
||||
index.remove(QRegularExpression("^(down|up)"));
|
||||
output = m_devices["net"][index.toInt()];
|
||||
} else if (_key.startsWith("pkgcount")) {
|
||||
auto *item = m_extUpgrade->itemByTag(_key, stripped);
|
||||
auto item = m_extUpgrade->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (_key.contains(QRegularExpression("(^|perc)(ask|bid|price)(chg|)"))) {
|
||||
auto *item = m_extQuotes->itemByTag(_key, stripped);
|
||||
auto item = m_extQuotes->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (_key.contains(QRegularExpression("(weather|weatherId|humidity|pressure|temperature)"))) {
|
||||
auto *item = m_extWeather->itemByTag(_key, stripped);
|
||||
auto item = m_extWeather->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (_key.startsWith("temp")) {
|
||||
@ -246,7 +246,7 @@ QString AWKeyOperations::infoByKey(const QString &_key) const
|
||||
index.remove("temp");
|
||||
output = m_devices["temp"][index.toInt()];
|
||||
} else if (_key.startsWith("response")) {
|
||||
auto *item = m_extNetRequest->itemByTag(_key, stripped);
|
||||
auto item = m_extNetRequest->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else {
|
||||
|
@ -37,7 +37,7 @@ AWPairConfigFactory::~AWPairConfigFactory()
|
||||
|
||||
void AWPairConfigFactory::showFormatterDialog(const QStringList &_keys)
|
||||
{
|
||||
auto *config = new AWFormatterConfig(nullptr, _keys);
|
||||
auto config = new AWFormatterConfig(nullptr, _keys);
|
||||
config->showDialog();
|
||||
config->deleteLater();
|
||||
}
|
||||
@ -45,7 +45,7 @@ void AWPairConfigFactory::showFormatterDialog(const QStringList &_keys)
|
||||
|
||||
void AWPairConfigFactory::showKeysDialog(const QStringList &_keys)
|
||||
{
|
||||
auto *config = new AWCustomKeysConfig(nullptr, _keys);
|
||||
auto config = new AWCustomKeysConfig(nullptr, _keys);
|
||||
config->showDialog();
|
||||
config->deleteLater();
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ void AWTelemetryHandler::uploadTelemetry(const QString &_group, const QString &_
|
||||
return;
|
||||
}
|
||||
|
||||
auto *manager = new QNetworkAccessManager(nullptr);
|
||||
auto manager = new QNetworkAccessManager(nullptr);
|
||||
connect(manager, &QNetworkAccessManager::finished, this, &AWTelemetryHandler::telemetryReplyReceived);
|
||||
|
||||
QUrl url(REMOTE_TELEMETRY_URL);
|
||||
|
@ -52,7 +52,7 @@ void AWUpdateHelper::checkUpdates(const bool _showAnyway)
|
||||
|
||||
// showAnyway options requires to show message if no updates found on direct
|
||||
// request. In case of automatic check no message will be shown
|
||||
auto *manager = new QNetworkAccessManager(nullptr);
|
||||
auto manager = new QNetworkAccessManager(nullptr);
|
||||
connect(manager, &QNetworkAccessManager::finished,
|
||||
[_showAnyway, this](QNetworkReply *reply) { return versionReplyReceived(reply, _showAnyway); });
|
||||
|
||||
@ -163,7 +163,7 @@ QMessageBox *AWUpdateHelper::genMessageBox(const QString &_title, const QString
|
||||
{
|
||||
qCDebug(LOG_AW) << "Construct message box with title" << _title << "and body" << _body;
|
||||
|
||||
auto *msgBox = new QMessageBox(nullptr);
|
||||
auto msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(_title);
|
||||
|
Reference in New Issue
Block a user