Skip to content

Commit

Permalink
Fixed warning on KDE emoticons loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Mar 16, 2024
1 parent 7e90f06 commit ff29a16
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
24 changes: 15 additions & 9 deletions src/psiiconset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class PsiIconset::Private {

Private(PsiIconset *_psi) { psi = _psi; }

QString iconsetPath(QString name, Iconset::Format format = Iconset::Format::Psi)
QString iconsetPath(QString name, Iconset::Format format = Iconset::Format::Psi, bool silent = false)
{
if (format == Iconset::Format::Psi) {
const auto &dataDirs = ApplicationInfo::dataDirs();
Expand All @@ -132,7 +132,9 @@ class PsiIconset::Private {
}
}

qWarning("PsiIconset::Private::iconsetPath(\"%s\"): not found", qPrintable(name));
if (!silent) {
qWarning("PsiIconset::Private::iconsetPath(\"%s\"): not found", qPrintable(name));
}
return QString();
}

Expand Down Expand Up @@ -326,14 +328,18 @@ class PsiIconset::Private {

const auto names = PsiOptions::instance()->getOption("options.iconsets.emoticons").toStringList();
for (const QString &name : names) {
Iconset *is = new Iconset;
if (is->load(iconsetPath("emoticons/" + name))) {
// PsiIconset::removeAnimation(is);
is->addToFactory();
emo.append(is);
continue;
auto isPath = iconsetPath("emoticons/" + name, Iconset::Format::Psi, true);
Iconset *is = nullptr;
if (!isPath.isEmpty()) {
is = new Iconset;
if (is->load(iconsetPath("emoticons/" + name))) {
is->addToFactory();
emo.append(is);
continue;
}
delete is;
}
delete is;

is = new Iconset;
if (is->load(iconsetPath(name, Iconset::Format::KdeEmoticons), Iconset::Format::KdeEmoticons)) {
is->addToFactory();
Expand Down
5 changes: 4 additions & 1 deletion src/translationmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ bool TranslationManager::loadQtTranslation(const QString &language)
return true;
}
}

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return loadQtTranslationHelper(language, QLibraryInfo::location(QLibraryInfo::TranslationsPath), qt_translator_);
#else
return loadQtTranslationHelper(language, QLibraryInfo::path(QLibraryInfo::TranslationsPath), qt_translator_);
#endif
}

void TranslationManager::loadTranslation(const QString &language)
Expand Down

0 comments on commit ff29a16

Please sign in to comment.