[Qt] small notificator and style changes

- remove default arguments for notificator
- re-order some calls to use same ordering in Qt files
- style police changes (spaces, comments and such)
This commit is contained in:
Philip Kaufmann 2013-12-03 09:25:24 +01:00
parent cf74e8cb5e
commit ccd1372dd0
9 changed files with 14 additions and 13 deletions

View file

@ -53,7 +53,6 @@ static SplashScreen *splashref;
static bool ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style) static bool ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
{ {
// Message from network thread
if(guiref) if(guiref)
{ {
bool modal = (style & CClientUIInterface::MODAL); bool modal = (style & CClientUIInterface::MODAL);
@ -160,7 +159,7 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans
/* qDebug() message handler --> debug.log */ /* qDebug() message handler --> debug.log */
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
void DebugMessageHandler(QtMsgType type, const char * msg) void DebugMessageHandler(QtMsgType type, const char *msg)
{ {
Q_UNUSED(type); Q_UNUSED(type);
LogPrint("qt", "Bitcoin-Qt: %s\n", msg); LogPrint("qt", "Bitcoin-Qt: %s\n", msg);
@ -313,11 +312,12 @@ int main(int argc, char *argv[])
splash.finish(&window); splash.finish(&window);
ClientModel clientModel(&optionsModel); ClientModel clientModel(&optionsModel);
window.setClientModel(&clientModel);
WalletModel *walletModel = 0; WalletModel *walletModel = 0;
if(pwalletMain) if(pwalletMain)
walletModel = new WalletModel(pwalletMain, &optionsModel); walletModel = new WalletModel(pwalletMain, &optionsModel);
window.setClientModel(&clientModel);
if(walletModel) if(walletModel)
{ {
window.addWallet("~Default", walletModel); window.addWallet("~Default", walletModel);

View file

@ -405,7 +405,7 @@ void BitcoinGUI::createTrayIcon(bool fIsTestnet)
trayIcon->show(); trayIcon->show();
#endif #endif
notificator = new Notificator(QApplication::applicationName(), trayIcon); notificator = new Notificator(QApplication::applicationName(), trayIcon, this);
} }
void BitcoinGUI::createTrayIconMenu() void BitcoinGUI::createTrayIconMenu()

View file

@ -84,7 +84,7 @@ signals:
void alertsChanged(const QString &warnings); void alertsChanged(const QString &warnings);
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut); void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
//! Asynchronous message notification //! Fired when a message should be reported to the user
void message(const QString &title, const QString &message, unsigned int style); void message(const QString &title, const QString &message, unsigned int style);
public slots: public slots:

View file

@ -32,6 +32,7 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
#include <QAbstractItemView> #include <QAbstractItemView>
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>

View file

@ -4,7 +4,6 @@
#include "notificator.h" #include "notificator.h"
#include <QApplication> #include <QApplication>
#include <QByteArray> #include <QByteArray>
#include <QIcon> #include <QIcon>
@ -32,7 +31,7 @@
// https://wiki.ubuntu.com/NotificationDevelopmentGuidelines recommends at least 128 // https://wiki.ubuntu.com/NotificationDevelopmentGuidelines recommends at least 128
const int FREEDESKTOP_NOTIFICATION_ICON_SIZE = 128; const int FREEDESKTOP_NOTIFICATION_ICON_SIZE = 128;
Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon, QWidget *parent): Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon, QWidget *parent) :
QObject(parent), QObject(parent),
parent(parent), parent(parent),
programName(programName), programName(programName),
@ -48,7 +47,7 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon,
} }
#ifdef USE_DBUS #ifdef USE_DBUS
interface = new QDBusInterface("org.freedesktop.Notifications", interface = new QDBusInterface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications", "org.freedesktop.Notifications"); "/org/freedesktop/Notifications", "org.freedesktop.Notifications");
if(interface->isValid()) if(interface->isValid())
{ {
mode = Freedesktop; mode = Freedesktop;

View file

@ -29,7 +29,7 @@ public:
/** Create a new notificator. /** Create a new notificator.
@note Ownership of trayIcon is not transferred to this object. @note Ownership of trayIcon is not transferred to this object.
*/ */
Notificator(const QString &programName=QString(), QSystemTrayIcon *trayIcon=0, QWidget *parent=0); Notificator(const QString &programName, QSystemTrayIcon *trayIcon, QWidget *parent);
~Notificator(); ~Notificator();
// Message class // Message class

View file

@ -101,11 +101,11 @@ void ReceiveCoinsDialog::on_receiveButton_clicked()
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, ""); address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "");
} }
SendCoinsRecipient info(address, label, SendCoinsRecipient info(address, label,
ui->reqAmount->value(), ui->reqMessage->text()); ui->reqAmount->value(), ui->reqMessage->text());
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this); ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModel(model->getOptionsModel()); dialog->setModel(model->getOptionsModel());
dialog->setInfo(info); dialog->setInfo(info);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show(); dialog->show();
clear(); clear();
} }

View file

@ -263,8 +263,8 @@ void WalletView::usedSendingAddresses()
if(!walletModel) if(!walletModel)
return; return;
AddressBookPage *dlg = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab, this); AddressBookPage *dlg = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
dlg->setModel(walletModel->getAddressTableModel());
dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setModel(walletModel->getAddressTableModel());
dlg->show(); dlg->show();
} }
@ -273,7 +273,7 @@ void WalletView::usedReceivingAddresses()
if(!walletModel) if(!walletModel)
return; return;
AddressBookPage *dlg = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this); AddressBookPage *dlg = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);
dlg->setModel(walletModel->getAddressTableModel());
dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setModel(walletModel->getAddressTableModel());
dlg->show(); dlg->show();
} }

View file

@ -96,6 +96,7 @@ public slots:
/** Re-emit encryption status signal */ /** Re-emit encryption status signal */
void updateEncryptionStatus(); void updateEncryptionStatus();
signals: signals:
/** Signal that we want to show the main window */ /** Signal that we want to show the main window */
void showNormalIfMinimized(); void showNormalIfMinimized();