Skip to content

Commit

Permalink
[Qt] misc small Mac related changes/cleanups
Browse files Browse the repository at this point in the history
- cleanup Info.plist.in and specify high DPI mode enable command as per
  http://blog.qt.digia.com/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/
- move setting of QApplication::setAttribute() to bitcoin.cpp and add
  attribute for enabling use of high DPI pixmaps for Qt >= 5.1
- add missing setWindowTitle() on Mac
- cleanup Mac / non-Mac setup in bitcoingui.cpp
  • Loading branch information
Philip Kaufmann committed Dec 9, 2013
1 parent 7202d9d commit 84f8551
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
13 changes: 12 additions & 1 deletion share/qt/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@
<dict>
<key>CFBundleIconFile</key>
<string>bitcoin.icns</string>

<key>CFBundlePackageType</key>
<string>APPL</string>

<key>CFBundleGetInfoString</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@, Copyright © 2009-@COPYRIGHT_YEAR@ The Bitcoin developers</string>

<key>CFBundleShortVersionString</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@</string>

<key>CFBundleVersion</key>
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@</string>

<key>CFBundleSignature</key>
<string>????</string>

<key>CFBundleExecutable</key>
<string>Bitcoin-Qt</string>

<key>CFBundleIdentifier</key>
<string>org.bitcoinfoundation.Bitcoin-Qt</string>

Expand Down Expand Up @@ -69,7 +76,11 @@
<string>Owner</string>
</dict>
</array>

<key>NSPrincipalClass</key>
<string>NSApplication</string>

<key>NSHighResolutionCapable</key>
<true/>
<string>True</string>
</dict>
</plist>
7 changes: 7 additions & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ int main(int argc, char *argv[])

Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
#if QT_VERSION > 0x050100
// Generate high-dpi pixmaps
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
#ifdef Q_OS_MAC
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif

// Register meta types used for QMetaObject::invokeMethod
qRegisterMetaType< bool* >();
Expand Down
20 changes: 12 additions & 8 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,32 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
{
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);

#ifndef Q_OS_MAC
if (!fIsTestnet)
{
setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
setWindowIcon(QIcon(":icons/bitcoin"));
#else
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin"));
#endif
}
else
{
setWindowTitle(tr("Bitcoin") + " - " + tr("Wallet") + " " + tr("[testnet]"));
#ifndef Q_OS_MAC
QApplication::setWindowIcon(QIcon(":icons/bitcoin_testnet"));
setWindowIcon(QIcon(":icons/bitcoin_testnet"));
}
#else
setUnifiedTitleAndToolBarOnMac(true);
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);

if (!fIsTestnet)
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin"));
else
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#endif
}

#if defined(Q_OS_MAC) && QT_VERSION < 0x050000
// This property is not implemented in Qt 5. Setting it has no effect.
// A replacement API (QtMacUnifiedToolBar) is available in QtMacExtras.
setUnifiedTitleAndToolBarOnMac(true);
#endif

// Create wallet frame and make it the central widget
walletFrame = new WalletFrame(this);
Expand Down

0 comments on commit 84f8551

Please sign in to comment.