Fixup for e2e3b72723
This commit is contained in:
parent
be045a2bdd
commit
609b5c54cf
|
@ -17,7 +17,7 @@ public:
|
|||
{
|
||||
SnoreCore &instance = SnoreCore::instance();
|
||||
instance.loadPlugins(SnorePlugin::Backend);
|
||||
instance.setSettingsValue(QStringLiteral("Timeout"), 5, LocalSetting);
|
||||
instance.setSettingsValue(QStringLiteral("Timeout"), 10, LocalSetting);
|
||||
SnoreCore::instance().registerApplication(app);
|
||||
}
|
||||
|
||||
|
@ -28,25 +28,30 @@ private Q_SLOTS:
|
|||
void displayTestPlain();
|
||||
|
||||
private:
|
||||
void testString(const QString &message)
|
||||
void testString(const QStringList &messages)
|
||||
{
|
||||
qDebug() << Utils::normalizeMarkup(message, Utils::NoMarkup);
|
||||
SnoreCore &snore = SnoreCore::instance();
|
||||
#if 0
|
||||
qDebug() << snore.pluginNames(SnorePlugin::Backend);
|
||||
QStringList backends({QStringLiteral("Snore")});
|
||||
#else
|
||||
QStringList backends = snore.pluginNames(SnorePlugin::Backend);
|
||||
auto notify = [&backends, &snore, &message, this](Notification n) {
|
||||
#endif
|
||||
auto notify = [&backends, &snore, &messages, this](Notification n) {
|
||||
qDebug() << n << "closed";
|
||||
qDebug() << backends.size();
|
||||
if (backends.empty()) {
|
||||
return;
|
||||
}
|
||||
QString old = snore.primaryNotificationBackend();
|
||||
while (snore.primaryNotificationBackend() == old) {
|
||||
while (!backends.empty() && snore.primaryNotificationBackend() == old) {
|
||||
QString p = backends.takeLast();
|
||||
snore.setSettingsValue(QStringLiteral("PrimaryBackend"), p, LocalSetting);
|
||||
SnoreCorePrivate::instance()->syncSettings();
|
||||
if (snore.primaryNotificationBackend() == p) {
|
||||
qDebug() << p;
|
||||
snore.broadcastNotification(Notification(app, app.defaultAlert(), QStringLiteral("Title"), message, app.icon()));
|
||||
for (const auto &message : messages) {
|
||||
snore.broadcastNotification(Notification(app, app.defaultAlert(), QStringLiteral("Title"), message, app.icon()));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -55,7 +60,7 @@ private:
|
|||
while (!backends.empty()) {
|
||||
QTest::qWait(100);
|
||||
}
|
||||
QTest::qWait(100);
|
||||
QTest::qWait(10000);
|
||||
disconnect(con);
|
||||
}
|
||||
};
|
||||
|
@ -63,13 +68,15 @@ private:
|
|||
void DisplayTest::displayTest()
|
||||
{
|
||||
app.hints().setValue("use-markup", true);
|
||||
testString(QStringLiteral("<b>TestΩ</b>💩😀"));
|
||||
}
|
||||
testString({QStringLiteral("<b>TestΩ</b>💩😀"),
|
||||
QString::fromUtf8("😀<b>💩TestΩ</b>💩😀")});
|
||||
}
|
||||
|
||||
void DisplayTest::displayTestPlain()
|
||||
{
|
||||
app.hints().setValue("use-markup", false);
|
||||
testString(QString::fromWCharArray(L"Test\u03A9\U0001F4A9\U0001F600"));
|
||||
testString({QString::fromWCharArray(L"Test\u03A9\U0001F4A9\U0001F600"),
|
||||
QString::fromUtf8("TestΩ💩😀")});
|
||||
}
|
||||
|
||||
QTEST_MAIN(DisplayTest)
|
||||
|
|
|
@ -35,18 +35,17 @@ NotifyWidget::NotifyWidget(int id, const ::SnorePlugin::Snore *parent) :
|
|||
{
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
//#if QT_VERSION < QT_VERSION_CHECK(5,7,0)// Qt 5.7+ is broken and can only display it in black and white.
|
||||
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) {
|
||||
m_fontFamily = QStringLiteral("Segoe UI Symbol");
|
||||
emit fontFamilyChanged();
|
||||
}
|
||||
//#if QT_VERSION >= QT_VERSION_CHECK(5,5,0)
|
||||
// if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10) {
|
||||
// m_fontFamily = QStringLiteral("Segoe UI Emoji");
|
||||
// emit fontFamilyChanged();
|
||||
// }
|
||||
//#endif
|
||||
//#endif
|
||||
// Qt 5.7+ is broken and can only display it in black and white for Segoe UI Emoji.
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,5,0) && QT_VERSION < QT_VERSION_CHECK(5,7,0)
|
||||
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10) {
|
||||
m_fontFamily = QStringLiteral("Segoe UI Emoji");
|
||||
emit fontFamilyChanged();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
QQmlApplicationEngine *engine = new QQmlApplicationEngine(this);
|
||||
engine->rootContext()->setContextProperty(QStringLiteral("notifyWidget"), this);
|
||||
|
|
Loading…
Reference in New Issue