Commit d01c7480 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 56875e50
Pipeline #39765 failed with stage
in 9 minutes and 21 seconds
......@@ -23,10 +23,10 @@ GravatarConfigureSettingsDialogTest::~GravatarConfigureSettingsDialogTest()
void GravatarConfigureSettingsDialogTest::shouldHaveDefaultValue()
{
Gravatar::GravatarConfigureSettingsDialog dlg;
Gravatar::GravatarConfigureSettingsWidget *configurewidget = dlg.findChild<Gravatar::GravatarConfigureSettingsWidget *>(QStringLiteral("gravatarconfiguresettings"));
auto *configurewidget = dlg.findChild<Gravatar::GravatarConfigureSettingsWidget *>(QStringLiteral("gravatarconfiguresettings"));
QVERIFY(configurewidget);
QVBoxLayout *topLayout = dlg.findChild<QVBoxLayout *>(QStringLiteral("toplayout"));
auto *topLayout = dlg.findChild<QVBoxLayout *>(QStringLiteral("toplayout"));
QVERIFY(topLayout);
}
......
......@@ -26,25 +26,25 @@ void GravatarConfigureSettingsWidgetTest::shouldHaveDefaultValues()
{
Gravatar::GravatarConfigureSettingsWidget w;
QVBoxLayout *topLayout = w.findChild<QVBoxLayout* >(QStringLiteral("mainlayout"));
auto *topLayout = w.findChild<QVBoxLayout* >(QStringLiteral("mainlayout"));
QVERIFY(topLayout);
QCOMPARE(topLayout->contentsMargins(), QMargins(0, 0, 0, 0));
QCheckBox *useDefaultImage = w.findChild<QCheckBox *>(QStringLiteral("usedefaultimage"));
auto *useDefaultImage = w.findChild<QCheckBox *>(QStringLiteral("usedefaultimage"));
QVERIFY(useDefaultImage);
QPushButton *clearGravatarCache = w.findChild<QPushButton *>(QStringLiteral("cleargravatarcachebutton"));
auto *clearGravatarCache = w.findChild<QPushButton *>(QStringLiteral("cleargravatarcachebutton"));
QVERIFY(clearGravatarCache);
QLabel *lab = w.findChild<QLabel *>(QStringLiteral("gravatarcachesizelabel"));
auto *lab = w.findChild<QLabel *>(QStringLiteral("gravatarcachesizelabel"));
QVERIFY(lab);
KPluralHandlingSpinBox *gravatarCacheSize = w.findChild<KPluralHandlingSpinBox *>(QStringLiteral("gravatarcachesize"));
auto *gravatarCacheSize = w.findChild<KPluralHandlingSpinBox *>(QStringLiteral("gravatarcachesize"));
QVERIFY(gravatarCacheSize);
KSeparator *separator = w.findChild<KSeparator *>(QStringLiteral("separator"));
auto *separator = w.findChild<KSeparator *>(QStringLiteral("separator"));
QVERIFY(separator);
KSeparator *separator2 = w.findChild<KSeparator *>(QStringLiteral("separator2"));
auto *separator2 = w.findChild<KSeparator *>(QStringLiteral("separator2"));
QVERIFY(separator2);
}
......@@ -24,10 +24,10 @@ GravatarConfigWidgetTest::~GravatarConfigWidgetTest()
void GravatarConfigWidgetTest::shouldHaveDefaultValue()
{
Gravatar::GravatarConfigWidget w;
QCheckBox *enableGravatar = w.findChild<QCheckBox *>(QStringLiteral("gravatarcheckbox"));
auto *enableGravatar = w.findChild<QCheckBox *>(QStringLiteral("gravatarcheckbox"));
QVERIFY(enableGravatar);
QPushButton *configure = w.findChild<QPushButton *>(QStringLiteral("configure"));
auto *configure = w.findChild<QPushButton *>(QStringLiteral("configure"));
QVERIFY(configure);
}
......@@ -35,9 +35,9 @@ void GravatarConfigWidgetTest::shouldChangeState()
{
Gravatar::GravatarConfigWidget w;
w.show();
QCheckBox *enableGravatar = w.findChild<QCheckBox *>(QStringLiteral("gravatarcheckbox"));
auto *enableGravatar = w.findChild<QCheckBox *>(QStringLiteral("gravatarcheckbox"));
QPushButton *configure = w.findChild<QPushButton *>(QStringLiteral("configure"));
auto *configure = w.findChild<QPushButton *>(QStringLiteral("configure"));
QVERIFY(!configure->isEnabled());
enableGravatar->toggle();
QVERIFY(configure->isEnabled());
......@@ -47,7 +47,7 @@ void GravatarConfigWidgetTest::shoulEmitConfigChangedSignal()
{
Gravatar::GravatarConfigWidget w;
w.show();
QCheckBox *enableGravatar = w.findChild<QCheckBox *>(QStringLiteral("gravatarcheckbox"));
auto *enableGravatar = w.findChild<QCheckBox *>(QStringLiteral("gravatarcheckbox"));
QSignalSpy spy(&w, &Gravatar::GravatarConfigWidget::configChanged);
QTest::mouseClick(enableGravatar, Qt::LeftButton);
......
......@@ -29,10 +29,10 @@ void GravatarDownloadPixmapDialogTest::initTestCase()
void GravatarDownloadPixmapDialogTest::shouldHaveDefaultValue()
{
Gravatar::GravatarDownloadPixmapDialog dlg;
Gravatar::GravatarDownloadPixmapWidget *widget = dlg.findChild<Gravatar::GravatarDownloadPixmapWidget *>(QStringLiteral("gravatarwidget"));
auto *widget = dlg.findChild<Gravatar::GravatarDownloadPixmapWidget *>(QStringLiteral("gravatarwidget"));
QVERIFY(widget);
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
auto *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
QVERIFY(buttonBox);
}
......
......@@ -24,24 +24,24 @@ GravatarDownloadPixmapWidgetTest::~GravatarDownloadPixmapWidgetTest()
void GravatarDownloadPixmapWidgetTest::shouldHaveDefaultValue()
{
Gravatar::GravatarDownloadPixmapWidget w;
QLabel *lab = w.findChild<QLabel *>(QStringLiteral("labemail"));
auto *lab = w.findChild<QLabel *>(QStringLiteral("labemail"));
QVERIFY(lab);
QLineEdit *lineEdit = w.findChild<QLineEdit *>(QStringLiteral("email"));
auto *lineEdit = w.findChild<QLineEdit *>(QStringLiteral("email"));
QVERIFY(lineEdit);
QPushButton *getPixmapButton = w.findChild<QPushButton *>(QStringLiteral("searchbutton"));
auto *getPixmapButton = w.findChild<QPushButton *>(QStringLiteral("searchbutton"));
QVERIFY(getPixmapButton);
QVERIFY(!getPixmapButton->isEnabled());
QLabel *resultLabel = w.findChild<QLabel *>(QStringLiteral("resultlabel"));
auto *resultLabel = w.findChild<QLabel *>(QStringLiteral("resultlabel"));
QVERIFY(resultLabel);
QCheckBox *useLibravatar = w.findChild<QCheckBox *>(QStringLiteral("uselibravatar"));
auto *useLibravatar = w.findChild<QCheckBox *>(QStringLiteral("uselibravatar"));
QVERIFY(useLibravatar);
QVERIFY(!useLibravatar->isChecked());
QCheckBox *fallBackGravatar = w.findChild<QCheckBox *>(QStringLiteral("fallbackgravatar"));
auto *fallBackGravatar = w.findChild<QCheckBox *>(QStringLiteral("fallbackgravatar"));
QVERIFY(fallBackGravatar);
QVERIFY(!fallBackGravatar->isChecked());
}
......@@ -49,9 +49,9 @@ void GravatarDownloadPixmapWidgetTest::shouldHaveDefaultValue()
void GravatarDownloadPixmapWidgetTest::shouldChangeButtonEnableState()
{
Gravatar::GravatarDownloadPixmapWidget w;
QLineEdit *lineEdit = w.findChild<QLineEdit *>(QStringLiteral("email"));
auto *lineEdit = w.findChild<QLineEdit *>(QStringLiteral("email"));
QPushButton *getPixmapButton = w.findChild<QPushButton *>(QStringLiteral("searchbutton"));
auto *getPixmapButton = w.findChild<QPushButton *>(QStringLiteral("searchbutton"));
QVERIFY(!getPixmapButton->isEnabled());
lineEdit->setText(QStringLiteral("foo"));
......
......@@ -24,7 +24,7 @@ GravatarConfigureSettingsDialog::GravatarConfigureSettingsDialog(QWidget *parent
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Configure Gravatar"));
QVBoxLayout *topLayout = new QVBoxLayout(this);
auto *topLayout = new QVBoxLayout(this);
topLayout->setObjectName(QStringLiteral("toplayout"));
mGravatarConfigureSettings = new GravatarConfigureSettingsWidget(this);
......
......@@ -23,7 +23,7 @@ using namespace PimCommon::ConfigureImmutableWidgetUtils;
GravatarConfigureSettingsWidget::GravatarConfigureSettingsWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
auto *topLayout = new QVBoxLayout(this);
topLayout->setObjectName(QStringLiteral("mainlayout"));
topLayout->setContentsMargins(0, 0, 0, 0);
mUseDefaultPixmap = new QCheckBox(i18n("Use Default Image"), this);
......@@ -41,7 +41,7 @@ GravatarConfigureSettingsWidget::GravatarConfigureSettingsWidget(QWidget *parent
mFallbackGravatar->setEnabled(false);
QHBoxLayout *cacheSizeLayout = new QHBoxLayout;
auto *cacheSizeLayout = new QHBoxLayout;
topLayout->addLayout(cacheSizeLayout);
QLabel *lab = new QLabel(i18n("Gravatar Cache Size:"), this);
lab->setObjectName(QStringLiteral("gravatarcachesizelabel"));
......@@ -59,7 +59,7 @@ GravatarConfigureSettingsWidget::GravatarConfigureSettingsWidget(QWidget *parent
separator->setObjectName(QStringLiteral("separator"));
topLayout->addWidget(separator);
QHBoxLayout *buttonLayout = new QHBoxLayout;
auto *buttonLayout = new QHBoxLayout;
topLayout->addLayout(buttonLayout);
mClearGravatarCache = new QPushButton(i18n("Clear Gravatar Cache"), this);
mClearGravatarCache->setObjectName(QStringLiteral("cleargravatarcachebutton"));
......
......@@ -33,7 +33,7 @@ GravatarConfigWidget::GravatarConfigWidget(QWidget *parent)
: QWidget(parent)
, d(new Gravatar::GravatarConfigWidgetPrivate)
{
QHBoxLayout *mainLayout = new QHBoxLayout(this);
auto *mainLayout = new QHBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
d->mEnableGravatarSupport = new QCheckBox(i18n("Enable Gravatar Support"));
......
......@@ -14,7 +14,7 @@ using namespace Gravatar;
GravatarDownloadPixmapDialog::GravatarDownloadPixmapDialog(QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
mGravatarDownloadPixmapWidget = new Gravatar::GravatarDownloadPixmapWidget(this);
mGravatarDownloadPixmapWidget->setObjectName(QStringLiteral("gravatarwidget"));
mainLayout->addWidget(mGravatarDownloadPixmapWidget);
......
......@@ -18,8 +18,8 @@ using namespace Gravatar;
GravatarDownloadPixmapWidget::GravatarDownloadPixmapWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QHBoxLayout *hbox = new QHBoxLayout;
auto *mainLayout = new QVBoxLayout(this);
auto *hbox = new QHBoxLayout;
mainLayout->addLayout(hbox);
QLabel *lab = new QLabel(i18n("Email:"));
lab->setObjectName(QStringLiteral("labemail"));
......@@ -77,7 +77,7 @@ void GravatarDownloadPixmapWidget::slotResolvUrlFinish(Gravatar::GravatarResolvU
void GravatarDownloadPixmapWidget::slotSearchButton()
{
mResultLabel->setText(QString());
Gravatar::GravatarResolvUrlJob *job = new Gravatar::GravatarResolvUrlJob(this);
auto *job = new Gravatar::GravatarResolvUrlJob(this);
job->setEmail(mLineEdit->text());
//For testing
//job->setUseDefaultPixmap(true);
......
......@@ -18,7 +18,7 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.process(app);
Gravatar::GravatarDownloadPixmapWidget *w = new Gravatar::GravatarDownloadPixmapWidget;
auto *w = new Gravatar::GravatarDownloadPixmapWidget;
w->show();
int ret = app.exec();
delete w;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment