Skip to content

Commit

Permalink
[Qt] add utilitydialog.cpp/h and helpmessage class
Browse files Browse the repository at this point in the history
- adds a nice and well formated dialog, which displays our -? help message
  (all options/paramaters)
- moves aboutdialog.cpp/h to the new utilitydialog
- move GUI shutdown window to utilitydialog
  • Loading branch information
Philip Kaufmann committed Jan 18, 2014
1 parent 490d6a3 commit 7b50bb2
Show file tree
Hide file tree
Showing 13 changed files with 343 additions and 162 deletions.
1 change: 1 addition & 0 deletions contrib/bitcoin-qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FORMS += \
../src/qt/forms/askpassphrasedialog.ui \
../src/qt/forms/coincontroldialog.ui \
../src/qt/forms/editaddressdialog.ui \
../src/qt/forms/helpmessagedialog.ui \
../src/qt/forms/intro.ui \
../src/qt/forms/openuridialog.ui \
../src/qt/forms/optionsdialog.ui \
Expand Down
9 changes: 5 additions & 4 deletions src/qt/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ QT_FORMS_UI = \
forms/askpassphrasedialog.ui \
forms/coincontroldialog.ui \
forms/editaddressdialog.ui \
forms/helpmessagedialog.ui \
forms/intro.ui \
forms/openuridialog.ui \
forms/optionsdialog.ui \
Expand All @@ -93,7 +94,6 @@ QT_FORMS_UI = \
forms/transactiondescdialog.ui

QT_MOC_CPP = \
moc_aboutdialog.cpp \
moc_addressbookpage.cpp \
moc_addresstablemodel.cpp \
moc_askpassphrasedialog.cpp \
Expand Down Expand Up @@ -133,6 +133,7 @@ QT_MOC_CPP = \
moc_transactionfilterproxy.cpp \
moc_transactiontablemodel.cpp \
moc_transactionview.cpp \
moc_utilitydialog.cpp \
moc_walletframe.cpp \
moc_walletmodel.cpp \
moc_walletview.cpp
Expand All @@ -155,7 +156,6 @@ PROTOBUF_H = paymentrequest.pb.h
PROTOBUF_PROTO = paymentrequest.proto

BITCOIN_QT_H = \
aboutdialog.h \
addressbookpage.h \
addresstablemodel.h \
askpassphrasedialog.h \
Expand Down Expand Up @@ -198,6 +198,7 @@ BITCOIN_QT_H = \
transactionrecord.h \
transactiontablemodel.h \
transactionview.h \
utilitydialog.h \
walletframe.h \
walletmodel.h \
walletmodeltransaction.h \
Expand Down Expand Up @@ -248,7 +249,6 @@ RES_ICONS = \
res/icons/tx_mined.png

BITCOIN_QT_CPP = \
aboutdialog.cpp \
bitcoin.cpp \
bitcoinaddressvalidator.cpp \
bitcoinamountfield.cpp \
Expand All @@ -267,7 +267,8 @@ BITCOIN_QT_CPP = \
rpcconsole.cpp \
signverifymessagedialog.cpp \
splashscreen.cpp \
trafficgraphwidget.cpp
trafficgraphwidget.cpp \
utilitydialog.cpp

if ENABLE_WALLET
BITCOIN_QT_CPP += \
Expand Down
38 changes: 0 additions & 38 deletions src/qt/aboutdialog.cpp

This file was deleted.

34 changes: 0 additions & 34 deletions src/qt/aboutdialog.h

This file was deleted.

17 changes: 3 additions & 14 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "intro.h"
#include "optionsmodel.h"
#include "splashscreen.h"
#include "utilitydialog.h"
#ifdef ENABLE_WALLET
#include "paymentserver.h"
#include "walletmodel.h"
Expand All @@ -36,8 +37,6 @@
#include <QTimer>
#include <QTranslator>
#include <QThread>
#include <QVBoxLayout>
#include <QLabel>

#if defined(QT_STATICPLUGIN)
#include <QtPlugin>
Expand Down Expand Up @@ -356,17 +355,7 @@ void BitcoinApplication::requestShutdown()
clientModel = 0;

// Show a simple window indicating shutdown status
QWidget *shutdownWindow = new QWidget();
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(new QLabel(
tr("Bitcoin Core is shutting down...") + "<br /><br />" +
tr("Do not shut down the computer until this window disappears.")));
shutdownWindow->setLayout(layout);

// Center shutdown window at where main window was
const QPoint global = window->mapToGlobal(window->rect().center());
shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
shutdownWindow->show();
ShutdownWindow::showShutdownWindow(window);

// Request shutdown from core thread
emit requestedShutdown();
Expand Down Expand Up @@ -503,7 +492,7 @@ int main(int argc, char *argv[])
// but before showing splash screen.
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
GUIUtil::HelpMessageBox help;
HelpMessageDialog help(NULL);
help.showOrPrint();
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "bitcoingui.h"

#include "aboutdialog.h"
#include "bitcoinunits.h"
#include "clientmodel.h"
#include "guiconstants.h"
Expand All @@ -14,6 +13,7 @@
#include "optionsdialog.h"
#include "optionsmodel.h"
#include "rpcconsole.h"
#include "utilitydialog.h"
#ifdef ENABLE_WALLET
#include "walletframe.h"
#include "walletmodel.h"
Expand Down
16 changes: 8 additions & 8 deletions src/qt/forms/aboutdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ This product includes software developed by the OpenSSL Project for use in the O
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>360</x>
<y>308</y>
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
Expand All @@ -176,12 +176,12 @@ This product includes software developed by the OpenSSL Project for use in the O
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>428</x>
<y>308</y>
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
Expand Down
128 changes: 128 additions & 0 deletions src/qt/forms/helpmessagedialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HelpMessageDialog</class>
<widget class="QDialog" name="HelpMessageDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>400</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Bitcoin Core - Command-line options</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="graphic">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="pixmap">
<pixmap resource="../bitcoin.qrc">:/images/about</pixmap>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>659</width>
<height>348</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="helpMessageLabel">
<property name="font">
<font>
<family>Terminal</family>
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="okButton">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../bitcoin.qrc"/>
</resources>
<connections>
<connection>
<sender>okButton</sender>
<signal>accepted()</signal>
<receiver>HelpMessageDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>okButton</sender>
<signal>rejected()</signal>
<receiver>HelpMessageDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Loading

0 comments on commit 7b50bb2

Please sign in to comment.