Skip to content

Commit 29266b6

Browse files
committed
Bugfix: Default -uiplatform is not actually the platform this build was compiled on
Also hides the option for non-GUI builds.
1 parent 851b6e0 commit 29266b6

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,8 @@ std::string HelpMessage(HelpMessageMode mode)
494494
strUsage += HelpMessageOpt("-min", _("Start minimized"));
495495
strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)"));
496496
strUsage += HelpMessageOpt("-splash", strprintf(_("Show splash screen on startup (default: %u)"), DEFAULT_SPLASHSCREEN));
497-
if (showDebug) {
498-
strUsage += HelpMessageOpt("-uiplatform", "Select platform to customize UI for (one of windows, macosx, other; default: platform compiled on)");
497+
if (showDebug && !uiInterface.DefaultUIPlatform.empty()) {
498+
strUsage += HelpMessageOpt("-uiplatform", strprintf("Select platform to customize UI for (one of windows, macosx, other; default: %s)", uiInterface.DefaultUIPlatform));
499499
}
500500
}
501501

src/qt/bitcoin.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,8 @@ BitcoinApplication::BitcoinApplication(int &argc, char **argv):
309309
// UI per-platform customization
310310
// This must be done inside the BitcoinApplication constructor, or after it, because
311311
// PlatformStyle::instantiate requires a QApplication
312-
#if defined(Q_OS_MAC)
313-
std::string platformName = "macosx";
314-
#elif defined(Q_OS_WIN)
315-
std::string platformName = "windows";
316-
#else
317-
std::string platformName = "other";
318-
#endif
319-
platformName = GetArg("-uiplatform", platformName);
312+
std::string platformName;
313+
platformName = GetArg("-uiplatform", uiInterface.DefaultUIPlatform);
320314
platformStyle = PlatformStyle::instantiate(QString::fromStdString(platformName));
321315
if (!platformStyle) // Fall back to "other" if specified name not found
322316
platformStyle = PlatformStyle::instantiate("other");
@@ -509,6 +503,16 @@ int main(int argc, char *argv[])
509503
{
510504
SetupEnvironment();
511505

506+
uiInterface.DefaultUIPlatform =
507+
#if defined(Q_OS_MAC)
508+
"macosx"
509+
#elif defined(Q_OS_WIN)
510+
"windows"
511+
#else
512+
"other"
513+
#endif
514+
;
515+
512516
/// 1. Parse command-line options. These take precedence over anything else.
513517
// Command-line options take precedence:
514518
ParseParameters(argc, argv);

src/ui_interface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ class CClientUIInterface
9898

9999
/** Banlist did change. */
100100
boost::signals2::signal<void (void)> BannedListChanged;
101+
102+
/** Default UI interface */
103+
std::string DefaultUIPlatform;
101104
};
102105

103106
extern CClientUIInterface uiInterface;

0 commit comments

Comments
 (0)