mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-19 19:48:07 +00:00
Fixup for e2e3b72723d5cc15cd58fcc5f4288d8cf38afc3b
This commit is contained in:
parent
be045a2bdd
commit
609b5c54cf
@ -17,7 +17,7 @@ public:
|
|||||||
{
|
{
|
||||||
SnoreCore &instance = SnoreCore::instance();
|
SnoreCore &instance = SnoreCore::instance();
|
||||||
instance.loadPlugins(SnorePlugin::Backend);
|
instance.loadPlugins(SnorePlugin::Backend);
|
||||||
instance.setSettingsValue(QStringLiteral("Timeout"), 5, LocalSetting);
|
instance.setSettingsValue(QStringLiteral("Timeout"), 10, LocalSetting);
|
||||||
SnoreCore::instance().registerApplication(app);
|
SnoreCore::instance().registerApplication(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,34 +28,39 @@ private Q_SLOTS:
|
|||||||
void displayTestPlain();
|
void displayTestPlain();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void testString(const QString &message)
|
void testString(const QStringList &messages)
|
||||||
{
|
{
|
||||||
qDebug() << Utils::normalizeMarkup(message, Utils::NoMarkup);
|
|
||||||
SnoreCore &snore = SnoreCore::instance();
|
SnoreCore &snore = SnoreCore::instance();
|
||||||
|
#if 0
|
||||||
|
qDebug() << snore.pluginNames(SnorePlugin::Backend);
|
||||||
|
QStringList backends({QStringLiteral("Snore")});
|
||||||
|
#else
|
||||||
QStringList backends = snore.pluginNames(SnorePlugin::Backend);
|
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() << n << "closed";
|
||||||
qDebug() << backends.size();
|
qDebug() << backends.size();
|
||||||
if (backends.empty()) {
|
if (backends.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString old = snore.primaryNotificationBackend();
|
QString old = snore.primaryNotificationBackend();
|
||||||
while (snore.primaryNotificationBackend() == old) {
|
while (!backends.empty() && snore.primaryNotificationBackend() == old) {
|
||||||
QString p = backends.takeLast();
|
QString p = backends.takeLast();
|
||||||
snore.setSettingsValue(QStringLiteral("PrimaryBackend"), p, LocalSetting);
|
snore.setSettingsValue(QStringLiteral("PrimaryBackend"), p, LocalSetting);
|
||||||
SnoreCorePrivate::instance()->syncSettings();
|
SnoreCorePrivate::instance()->syncSettings();
|
||||||
if (snore.primaryNotificationBackend() == p) {
|
if (snore.primaryNotificationBackend() == p) {
|
||||||
qDebug() << p;
|
for (const auto &message : messages) {
|
||||||
snore.broadcastNotification(Notification(app, app.defaultAlert(), QStringLiteral("Title"), message, app.icon()));
|
snore.broadcastNotification(Notification(app, app.defaultAlert(), QStringLiteral("Title"), message, app.icon()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
auto con = connect(&snore, &SnoreCore::notificationClosed, notify);
|
auto con = connect(&snore, &SnoreCore::notificationClosed, notify);
|
||||||
notify(Notification());
|
notify(Notification());
|
||||||
while (!backends.empty()) {
|
while (!backends.empty()) {
|
||||||
QTest::qWait(100);
|
QTest::qWait(100);
|
||||||
}
|
}
|
||||||
QTest::qWait(100);
|
QTest::qWait(10000);
|
||||||
disconnect(con);
|
disconnect(con);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -63,13 +68,15 @@ private:
|
|||||||
void DisplayTest::displayTest()
|
void DisplayTest::displayTest()
|
||||||
{
|
{
|
||||||
app.hints().setValue("use-markup", true);
|
app.hints().setValue("use-markup", true);
|
||||||
testString(QStringLiteral("<b>TestΩ</b>💩😀"));
|
testString({QStringLiteral("<b>TestΩ</b>💩😀"),
|
||||||
|
QString::fromUtf8("😀<b>💩TestΩ</b>💩😀")});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayTest::displayTestPlain()
|
void DisplayTest::displayTestPlain()
|
||||||
{
|
{
|
||||||
app.hints().setValue("use-markup", false);
|
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)
|
QTEST_MAIN(DisplayTest)
|
||||||
|
@ -35,18 +35,17 @@ NotifyWidget::NotifyWidget(int id, const ::SnorePlugin::Snore *parent) :
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#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) {
|
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) {
|
||||||
m_fontFamily = QStringLiteral("Segoe UI Symbol");
|
m_fontFamily = QStringLiteral("Segoe UI Symbol");
|
||||||
emit fontFamilyChanged();
|
emit fontFamilyChanged();
|
||||||
}
|
}
|
||||||
//#if QT_VERSION >= QT_VERSION_CHECK(5,5,0)
|
// Qt 5.7+ is broken and can only display it in black and white for Segoe UI Emoji.
|
||||||
// if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10) {
|
#if QT_VERSION >= QT_VERSION_CHECK(5,5,0) && QT_VERSION < QT_VERSION_CHECK(5,7,0)
|
||||||
// m_fontFamily = QStringLiteral("Segoe UI Emoji");
|
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10) {
|
||||||
// emit fontFamilyChanged();
|
m_fontFamily = QStringLiteral("Segoe UI Emoji");
|
||||||
// }
|
emit fontFamilyChanged();
|
||||||
//#endif
|
}
|
||||||
//#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
QQmlApplicationEngine *engine = new QQmlApplicationEngine(this);
|
QQmlApplicationEngine *engine = new QQmlApplicationEngine(this);
|
||||||
engine->rootContext()->setContextProperty(QStringLiteral("notifyWidget"), this);
|
engine->rootContext()->setContextProperty(QStringLiteral("notifyWidget"), this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user