Use image sizeInBytes
Use Qt:endl
register qml with qml register anonymous type
Remplace QDrag start by QDarg exec
QModel acces, remove use of child
Use QFileinfo, use birthTime()
Use QRandomGenerator
wilder-5.24
Adrien Faveraux 5 years ago committed by David Edmundson
parent 4e2d47aeff
commit 5ba4387628
  1. 2
      dataengines/executable/executable.cpp
  2. 4
      kcms/cursortheme/kcmcursortheme.cpp
  3. 14
      kcms/cursortheme/plasma-apply-cursortheme.cpp
  4. 6
      kcms/fonts/fonts.cpp
  5. 2
      kcms/kfontinst/kcmfontinst/DuplicatesDialog.cpp
  6. 4
      kcms/kfontinst/kcmfontinst/FontList.cpp
  7. 14
      kcms/notifications/kcm.cpp
  8. 4
      ksmserver/client.cpp
  9. 2
      shell/containmentconfigview.cpp
  10. 2
      wallpapers/image/imageplugin.cpp
  11. 4
      xembed-sni-proxy/snidbus.cpp

@ -44,7 +44,7 @@ void ExecutableContainer::exec()
if (m_process->state() == QProcess::NotRunning) { if (m_process->state() == QProcess::NotRunning) {
m_process->start(); m_process->start();
} else { } else {
qDebug() << "Process" << objectName() << "already running. Pid:" << m_process->pid(); qDebug() << "Process" << objectName() << "already running. Pid:" << m_process->processId();
} }
} }

@ -56,8 +56,8 @@ CursorThemeConfig::CursorThemeConfig(QObject *parent, const QVariantList &args)
m_preferredSize = cursorThemeSettings()->cursorSize(); m_preferredSize = cursorThemeSettings()->cursorSize();
connect(cursorThemeSettings(), &CursorThemeSettings::cursorThemeChanged, this, &CursorThemeConfig::updateSizeComboBox); connect(cursorThemeSettings(), &CursorThemeSettings::cursorThemeChanged, this, &CursorThemeConfig::updateSizeComboBox);
qmlRegisterType<PreviewWidget>("org.kde.private.kcm_cursortheme", 1, 0, "PreviewWidget"); qmlRegisterType<PreviewWidget>("org.kde.private.kcm_cursortheme", 1, 0, "PreviewWidget");
qmlRegisterType<SortProxyModel>(); qmlRegisterAnonymousType<SortProxyModel>("SortProxyModel",1);
qmlRegisterType<CursorThemeSettings>(); qmlRegisterAnonymousType<CursorThemeSettings>("CursorThemeSettings",1);
KAboutData *aboutData = new KAboutData(QStringLiteral("kcm_cursortheme"), KAboutData *aboutData = new KAboutData(QStringLiteral("kcm_cursortheme"),
i18n("Cursors"), i18n("Cursors"),
QStringLiteral("1.0"), QStringLiteral("1.0"),

@ -59,7 +59,7 @@ int main(int argc, char **argv)
} }
if (settings->cursorTheme() == requestedTheme) { if (settings->cursorTheme() == requestedTheme) {
ts << i18n("The requested theme \"%1\" is already set as the theme for the current Plasma session.", requestedTheme) << endl; ts << i18n("The requested theme \"%1\" is already set as the theme for the current Plasma session.", requestedTheme) << Qt::endl;
// This is not an error condition, no reason to set an error code // This is not an error condition, no reason to set an error code
} else { } else {
auto results = model->findIndex(requestedTheme); auto results = model->findIndex(requestedTheme);
@ -70,9 +70,9 @@ int main(int argc, char **argv)
settings->setCursorTheme(theme->name()); settings->setCursorTheme(theme->name());
if (settings->save() && applyTheme(theme, theme->defaultCursorSize())) { if (settings->save() && applyTheme(theme, theme->defaultCursorSize())) {
notifyKcmChange(GlobalChangeType::CursorChanged); notifyKcmChange(GlobalChangeType::CursorChanged);
ts << i18n("Successfully applied the mouse cursor theme %1 to your current Plasma session", theme->title()) << endl; ts << i18n("Successfully applied the mouse cursor theme %1 to your current Plasma session", theme->title()) << Qt::endl;
} else { } else {
ts << i18n("You have to restart the Plasma session for your newly applied mouse cursor theme to display correctly.") << endl; ts << i18n("You have to restart the Plasma session for your newly applied mouse cursor theme to display correctly.") << Qt::endl;
// A bit of an odd one, more a warning than an error, but this means we can forward it // A bit of an odd one, more a warning than an error, but this means we can forward it
errorCode = -1; errorCode = -1;
} }
@ -85,18 +85,18 @@ int main(int argc, char **argv)
ts << i18n("Could not find theme \"%1\". The theme should be one of the following options: %2", ts << i18n("Could not find theme \"%1\". The theme should be one of the following options: %2",
requestedTheme, requestedTheme,
availableThemes.join(QLatin1String{", "})) availableThemes.join(QLatin1String{", "}))
<< endl; << Qt::endl;
errorCode = -1; errorCode = -1;
} }
} }
} else if (parser->isSet(QStringLiteral("list-themes"))) { } else if (parser->isSet(QStringLiteral("list-themes"))) {
ts << i18n("You have the following mouse cursor themes on your system:") << endl; ts << i18n("You have the following mouse cursor themes on your system:") << Qt::endl;
for (int i = 0; i < model->rowCount(); ++i) { for (int i = 0; i < model->rowCount(); ++i) {
const CursorTheme *theme = model->theme(model->index(i, 0)); const CursorTheme *theme = model->theme(model->index(i, 0));
if (settings->cursorTheme() == theme->name()) { if (settings->cursorTheme() == theme->name()) {
ts << QString(" * %1 (%2 - current theme for this Plasma session)").arg(theme->title()).arg(theme->name()) << endl; ts << QString(" * %1 (%2 - current theme for this Plasma session)").arg(theme->title()).arg(theme->name()) << Qt::endl;
} else { } else {
ts << QString(" * %1 (%2)").arg(theme->title()).arg(theme->name()) << endl; ts << QString(" * %1 (%2)").arg(theme->title()).arg(theme->name()) << Qt::endl;
} }
} }
} else { } else {

@ -56,9 +56,9 @@ KFonts::KFonts(QObject *parent, const QVariantList &args)
KAboutData *about = new KAboutData("kcm_fonts", i18n("Fonts"), "0.1", QString(), KAboutLicense::LGPL); KAboutData *about = new KAboutData("kcm_fonts", i18n("Fonts"), "0.1", QString(), KAboutLicense::LGPL);
about->addAuthor(i18n("Antonis Tsiapaliokas"), QString(), "antonis.tsiapaliokas@kde.org"); about->addAuthor(i18n("Antonis Tsiapaliokas"), QString(), "antonis.tsiapaliokas@kde.org");
setAboutData(about); setAboutData(about);
qmlRegisterType<QStandardItemModel>(); qmlRegisterAnonymousType<QStandardItemModel>("QStandardItemModel",1);
qmlRegisterType<FontsSettings>(); qmlRegisterAnonymousType<FontsSettings>("FontsSettings",1);
qmlRegisterType<FontsAASettings>(); qmlRegisterAnonymousType<FontsAASettings>("FontsAASettings",1);
setButtons(Apply | Default | Help); setButtons(Apply | Default | Help);

@ -126,7 +126,7 @@ void CDuplicatesDialog::scanFinished()
details.append(*fit); details.append(*fit);
details.append(""); details.append("");
details.append(KFormat().formatByteSize(info.size())); details.append(KFormat().formatByteSize(info.size()));
details.append(QLocale().toString(info.created())); details.append(QLocale().toString(info.birthTime()));
if (info.isSymLink()) { if (info.isSymLink()) {
details.append(info.symLinkTarget()); details.append(info.symLinkTarget());
} }

@ -1337,7 +1337,7 @@ void CFontListView::getFonts(CJobRunner::ItemList &urls, QStringList &fontNames,
CFamilyItem *fam = static_cast<CFamilyItem *>(realIndex.internalPointer()); CFamilyItem *fam = static_cast<CFamilyItem *>(realIndex.internalPointer());
for (int ch = 0; ch < fam->fontCount(); ++ch) { for (int ch = 0; ch < fam->fontCount(); ++ch) {
QModelIndex child(itsProxy->mapToSource(index.child(ch, 0))); QModelIndex child(itsProxy->mapToSource(index.model()->index(ch, 0, index)));
if (child.isValid() && (static_cast<CFontModelItem *>(child.internalPointer()))->isFont()) { if (child.isValid() && (static_cast<CFontModelItem *>(child.internalPointer()))->isFont()) {
CFontItem *font = static_cast<CFontItem *>(child.internalPointer()); CFontItem *font = static_cast<CFontItem *>(child.internalPointer());
@ -1804,7 +1804,7 @@ void CFontListView::startDrag(Qt::DropActions supportedActions)
drag->setPixmap(pix); drag->setPixmap(pix);
drag->setMimeData(data); drag->setMimeData(data);
drag->setHotSpot(hotspot); drag->setHotSpot(hotspot);
drag->start(supportedActions); drag->exec(supportedActions);
} }
} }

@ -49,13 +49,13 @@ KCMNotifications::KCMNotifications(QObject *parent, const QVariantList &args)
const char uri[] = "org.kde.private.kcms.notifications"; const char uri[] = "org.kde.private.kcms.notifications";
qmlRegisterUncreatableType<SourcesModel>(uri, 1, 0, "SourcesModel", QStringLiteral("Cannot create instances of SourcesModel")); qmlRegisterUncreatableType<SourcesModel>(uri, 1, 0, "SourcesModel", QStringLiteral("Cannot create instances of SourcesModel"));
qmlRegisterType<FilterProxyModel>(); qmlRegisterAnonymousType<FilterProxyModel>("FilterProxyModel",1);
qmlRegisterType<QKeySequence>(); qmlRegisterAnonymousType<QKeySequence>("QKeySequence",1);
qmlRegisterType<NotificationManager::DoNotDisturbSettings>(); qmlRegisterAnonymousType<NotificationManager::DoNotDisturbSettings>("DoNotDisturbSettings",1);
qmlRegisterType<NotificationManager::NotificationSettings>(); qmlRegisterAnonymousType<NotificationManager::NotificationSettings>("NotificationSettings",1);
qmlRegisterType<NotificationManager::JobSettings>(); qmlRegisterAnonymousType<NotificationManager::JobSettings>("JobSettings",1);
qmlRegisterType<NotificationManager::BadgeSettings>(); qmlRegisterAnonymousType<NotificationManager::BadgeSettings>("BadgeSettings",1);
qmlRegisterType<NotificationManager::BehaviorSettings>(); qmlRegisterAnonymousType<NotificationManager::BehaviorSettings>("BehaviorSettings",1);
qmlProtectModule(uri, 1); qmlProtectModule(uri, 1);
KAboutData *about = new KAboutData(QStringLiteral("kcm_notifications"), i18n("Notifications"), QStringLiteral("5.0"), QString(), KAboutLicense::GPL); KAboutData *about = new KAboutData(QStringLiteral("kcm_notifications"), i18n("Notifications"), QStringLiteral("5.0"), QString(), KAboutLicense::GPL);

@ -24,7 +24,7 @@
#endif #endif
#include <time.h> #include <time.h>
#include <krandom.h> #include <QRandomGenerator>
extern KSMServer *the_server; extern KSMServer *the_server;
@ -79,7 +79,7 @@ char *safeSmsGenerateClientID(SmsConn /*c*/)
(1 would be IP, 2 would be DEC-NET format) */ (1 would be IP, 2 would be DEC-NET format) */
char hostname[256]; char hostname[256];
if (gethostname(hostname, 255) != 0) if (gethostname(hostname, 255) != 0)
*my_addr = QStringLiteral("0%1").arg(KRandom::random(), 8, 16); *my_addr = QStringLiteral("0%1").arg(QRandomGenerator::global()->generate(), 8, 16);
else { else {
// create some kind of hash for the hostname // create some kind of hash for the hostname
int addr[4] = {0, 0, 0, 0}; int addr[4] = {0, 0, 0, 0};

@ -42,7 +42,7 @@ ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow
: ConfigView(cont, parent) : ConfigView(cont, parent)
, m_containment(cont) , m_containment(cont)
{ {
qmlRegisterType<QAbstractItemModel>(); qmlRegisterAnonymousType<QAbstractItemModel>("QAbstractItemModel",1);
rootContext()->setContextProperty(QStringLiteral("configDialog"), this); rootContext()->setContextProperty(QStringLiteral("configDialog"), this);
setCurrentWallpaper(cont->containment()->wallpaper()); setCurrentWallpaper(cont->containment()->wallpaper());

@ -13,5 +13,5 @@ void ImagePlugin::registerTypes(const char *uri)
Q_ASSERT(uri == QLatin1String("org.kde.plasma.wallpapers.image")); Q_ASSERT(uri == QLatin1String("org.kde.plasma.wallpapers.image"));
qmlRegisterType<Image>(uri, 2, 0, "Image"); qmlRegisterType<Image>(uri, 2, 0, "Image");
qmlRegisterType<QAbstractItemModel>(); qmlRegisterAnonymousType<QAbstractItemModel>("QAbstractItemModel",1);
} }

@ -22,10 +22,10 @@ KDbusImageStruct::KDbusImageStruct(const QImage &image)
width = image.size().width(); width = image.size().width();
height = image.size().height(); height = image.size().height();
if (image.format() == QImage::Format_ARGB32) { if (image.format() == QImage::Format_ARGB32) {
data = QByteArray((char *)image.bits(), image.byteCount()); data = QByteArray((char *)image.bits(), image.sizeInBytes());
} else { } else {
QImage image32 = image.convertToFormat(QImage::Format_ARGB32); QImage image32 = image.convertToFormat(QImage::Format_ARGB32);
data = QByteArray((char *)image32.bits(), image32.byteCount()); data = QByteArray((char *)image32.bits(), image32.sizeInBytes());
} }
// swap to network byte order if we are little endian // swap to network byte order if we are little endian

Loading…
Cancel
Save