Browse Source

[Qt, OSX] move QProgressBarMac to guiutil.h

0.10
Jonas Schnelli 10 years ago
parent
commit
0ceab00d16
  1. 20
      src/qt/bitcoingui.cpp
  2. 17
      src/qt/guiutil.h

20
src/qt/bitcoingui.cpp

@ -58,20 +58,6 @@
#include <QUrlQuery> #include <QUrlQuery>
#endif #endif
#ifdef Q_OS_MAC
#include <QEvent>
// workaround for Qt OSX Bug:
// https://bugreports.qt-project.org/browse/QTBUG-15631
// QProgressBar uses around 10% CPU even when app is in background
class QProgressBarMac : public QProgressBar
{
bool event(QEvent *e) {
return (e->type() != QEvent::StyleAnimationUpdate) ? QProgressBar::event(e) : false;
}
};
#endif
const QString BitcoinGUI::DEFAULT_WALLET = "~Default"; const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) : BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
@ -204,11 +190,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
// Progress bar and label for blocks download // Progress bar and label for blocks download
progressBarLabel = new QLabel(); progressBarLabel = new QLabel();
progressBarLabel->setVisible(false); progressBarLabel->setVisible(false);
#ifdef Q_OS_MAC progressBar = new GUIUtil::ProgressBar();
progressBar = new QProgressBarMac();
#else
progressBar = new QProgressBar();
#endif
progressBar->setAlignment(Qt::AlignCenter); progressBar->setAlignment(Qt::AlignCenter);
progressBar->setVisible(false); progressBar->setVisible(false);

17
src/qt/guiutil.h

@ -7,9 +7,11 @@
#include "amount.h" #include "amount.h"
#include <QEvent>
#include <QHeaderView> #include <QHeaderView>
#include <QMessageBox> #include <QMessageBox>
#include <QObject> #include <QObject>
#include <QProgressBar>
#include <QString> #include <QString>
#include <QTableView> #include <QTableView>
@ -186,6 +188,21 @@ namespace GUIUtil
/* Format a CNodeCombinedStats.dPingTime into a user-readable string or display N/A, if 0*/ /* Format a CNodeCombinedStats.dPingTime into a user-readable string or display N/A, if 0*/
QString formatPingTime(double dPingTime); QString formatPingTime(double dPingTime);
#ifdef Q_OS_MAC
// workaround for Qt OSX Bug:
// https://bugreports.qt-project.org/browse/QTBUG-15631
// QProgressBar uses around 10% CPU even when app is in background
class ProgressBar : public QProgressBar
{
bool event(QEvent *e) {
return (e->type() != QEvent::StyleAnimationUpdate) ? QProgressBar::event(e) : false;
}
};
#else
typedef QProgressBar ProgressBar;
#endif
} // namespace GUIUtil } // namespace GUIUtil
#endif // BITCOIN_QT_GUIUTIL_H #endif // BITCOIN_QT_GUIUTIL_H

Loading…
Cancel
Save