Skip to content

Commit

Permalink
Merge #283 [stable-3.13] nmc/0000-DarkMode_Disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
memurats committed Aug 26, 2024
2 parents b49f594 + 0e64d7d commit b471657
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
16 changes: 2 additions & 14 deletions src/libsync/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ QString Theme::aboutInfo() const
//: Example text: "<p>Nextcloud Desktop Client</p>" (%1 is the application name)
auto devString = QString(tr("<p>%1 Desktop Client</p><p>Version %1. For more information please click <a href='%2'>here</a>.</p>") + QStringLiteral(" (%3)"))
.arg(APPLICATION_NAME, QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION)), helpUrl(), osName);


devString += tr("<p><small>Using virtual files plugin: %1</small></p>").arg(Vfs::modeToString(bestAvailableVfsMode()));
devString += QStringLiteral("<br>%1").arg(QSysInfo::productType() % QLatin1Char('-') % QSysInfo::kernelVersion());
Expand Down Expand Up @@ -818,7 +817,8 @@ double Theme::getColorDarkness(const QColor &color)

bool Theme::isDarkColor(const QColor &color)
{
return getColorDarkness(color) > 0.5;
Q_UNUSED(color)
return false;
}

QColor Theme::getBackgroundAwareLinkColor(const QColor &backgroundColor)
Expand Down Expand Up @@ -942,19 +942,7 @@ QPalette Theme::systemPalette()

bool Theme::darkMode()
{
connectToPaletteSignal();
// Windows: Check registry for dark mode
#if defined(Q_OS_WIN)
const auto darkModeSubkey = QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
if (Utility::registryKeyExists(HKEY_CURRENT_USER, darkModeSubkey) &&
!Utility::registryGetKeyValue(HKEY_CURRENT_USER, darkModeSubkey, QStringLiteral("AppsUseLightTheme")).toBool()) {
return true;
}

return false;
#else
return Theme::isDarkColor(QGuiApplication::palette().window().color());
#endif
}

void Theme::setOverrideServerUrl(const QString &overrideServerUrl)
Expand Down
12 changes: 8 additions & 4 deletions test/testtheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ private slots:

const auto iconPath = OCC::Theme::hidpiFileName(iconName + ".png", backgroundColor, &paintDevice);

QCOMPARE(iconPath, ":/client/theme/white/" + iconName + ".png");
//QCOMPARE(iconPath, ":/client/theme/white/" + iconName + ".png");
Q_UNUSED(iconPath)
}

void testHidpiFileName_lightBackground_returnPathToBlackIcon()
Expand All @@ -61,7 +62,8 @@ private slots:

const auto iconPath = OCC::Theme::hidpiFileName(iconName + ".png", backgroundColor, &paintDevice);

QCOMPARE(iconPath, ":/client/theme/white/" + iconName + "@2x.png");
//QCOMPARE(iconPath, ":/client/theme/white/" + iconName + "@2x.png");
Q_UNUSED(iconPath)
}

void testIsDarkColor_nextcloudBlue_returnTrue()
Expand All @@ -70,7 +72,8 @@ private slots:

const auto result = OCC::Theme::isDarkColor(color);

QCOMPARE(result, true);
//QCOMPARE(result, true);
Q_UNUSED(result)
}

void testIsDarkColor_lightColor_returnFalse()
Expand All @@ -88,7 +91,8 @@ private slots:

const auto result = OCC::Theme::isDarkColor(color);

QCOMPARE(result, true);
//QCOMPARE(result, true);
Q_UNUSED(result)
}

void testIsHidpi_hidpi_returnTrue()
Expand Down

0 comments on commit b471657

Please sign in to comment.