Skip to content

Commit 7b50bb2

Browse files
author
Philip Kaufmann
committed
[Qt] add utilitydialog.cpp/h and helpmessage class
- 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
1 parent 490d6a3 commit 7b50bb2

13 files changed

+343
-162
lines changed

contrib/bitcoin-qt.pro

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FORMS += \
44
../src/qt/forms/askpassphrasedialog.ui \
55
../src/qt/forms/coincontroldialog.ui \
66
../src/qt/forms/editaddressdialog.ui \
7+
../src/qt/forms/helpmessagedialog.ui \
78
../src/qt/forms/intro.ui \
89
../src/qt/forms/openuridialog.ui \
910
../src/qt/forms/optionsdialog.ui \

src/qt/Makefile.am

+5-4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ QT_FORMS_UI = \
8080
forms/askpassphrasedialog.ui \
8181
forms/coincontroldialog.ui \
8282
forms/editaddressdialog.ui \
83+
forms/helpmessagedialog.ui \
8384
forms/intro.ui \
8485
forms/openuridialog.ui \
8586
forms/optionsdialog.ui \
@@ -93,7 +94,6 @@ QT_FORMS_UI = \
9394
forms/transactiondescdialog.ui
9495

9596
QT_MOC_CPP = \
96-
moc_aboutdialog.cpp \
9797
moc_addressbookpage.cpp \
9898
moc_addresstablemodel.cpp \
9999
moc_askpassphrasedialog.cpp \
@@ -133,6 +133,7 @@ QT_MOC_CPP = \
133133
moc_transactionfilterproxy.cpp \
134134
moc_transactiontablemodel.cpp \
135135
moc_transactionview.cpp \
136+
moc_utilitydialog.cpp \
136137
moc_walletframe.cpp \
137138
moc_walletmodel.cpp \
138139
moc_walletview.cpp
@@ -155,7 +156,6 @@ PROTOBUF_H = paymentrequest.pb.h
155156
PROTOBUF_PROTO = paymentrequest.proto
156157

157158
BITCOIN_QT_H = \
158-
aboutdialog.h \
159159
addressbookpage.h \
160160
addresstablemodel.h \
161161
askpassphrasedialog.h \
@@ -198,6 +198,7 @@ BITCOIN_QT_H = \
198198
transactionrecord.h \
199199
transactiontablemodel.h \
200200
transactionview.h \
201+
utilitydialog.h \
201202
walletframe.h \
202203
walletmodel.h \
203204
walletmodeltransaction.h \
@@ -248,7 +249,6 @@ RES_ICONS = \
248249
res/icons/tx_mined.png
249250

250251
BITCOIN_QT_CPP = \
251-
aboutdialog.cpp \
252252
bitcoin.cpp \
253253
bitcoinaddressvalidator.cpp \
254254
bitcoinamountfield.cpp \
@@ -267,7 +267,8 @@ BITCOIN_QT_CPP = \
267267
rpcconsole.cpp \
268268
signverifymessagedialog.cpp \
269269
splashscreen.cpp \
270-
trafficgraphwidget.cpp
270+
trafficgraphwidget.cpp \
271+
utilitydialog.cpp
271272

272273
if ENABLE_WALLET
273274
BITCOIN_QT_CPP += \

src/qt/aboutdialog.cpp

-38
This file was deleted.

src/qt/aboutdialog.h

-34
This file was deleted.

src/qt/bitcoin.cpp

+3-14
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "intro.h"
1515
#include "optionsmodel.h"
1616
#include "splashscreen.h"
17+
#include "utilitydialog.h"
1718
#ifdef ENABLE_WALLET
1819
#include "paymentserver.h"
1920
#include "walletmodel.h"
@@ -36,8 +37,6 @@
3637
#include <QTimer>
3738
#include <QTranslator>
3839
#include <QThread>
39-
#include <QVBoxLayout>
40-
#include <QLabel>
4140

4241
#if defined(QT_STATICPLUGIN)
4342
#include <QtPlugin>
@@ -356,17 +355,7 @@ void BitcoinApplication::requestShutdown()
356355
clientModel = 0;
357356

358357
// Show a simple window indicating shutdown status
359-
QWidget *shutdownWindow = new QWidget();
360-
QVBoxLayout *layout = new QVBoxLayout();
361-
layout->addWidget(new QLabel(
362-
tr("Bitcoin Core is shutting down...") + "<br /><br />" +
363-
tr("Do not shut down the computer until this window disappears.")));
364-
shutdownWindow->setLayout(layout);
365-
366-
// Center shutdown window at where main window was
367-
const QPoint global = window->mapToGlobal(window->rect().center());
368-
shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
369-
shutdownWindow->show();
358+
ShutdownWindow::showShutdownWindow(window);
370359

371360
// Request shutdown from core thread
372361
emit requestedShutdown();
@@ -503,7 +492,7 @@ int main(int argc, char *argv[])
503492
// but before showing splash screen.
504493
if (mapArgs.count("-?") || mapArgs.count("--help"))
505494
{
506-
GUIUtil::HelpMessageBox help;
495+
HelpMessageDialog help(NULL);
507496
help.showOrPrint();
508497
return 1;
509498
}

src/qt/bitcoingui.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include "bitcoingui.h"
66

7-
#include "aboutdialog.h"
87
#include "bitcoinunits.h"
98
#include "clientmodel.h"
109
#include "guiconstants.h"
@@ -14,6 +13,7 @@
1413
#include "optionsdialog.h"
1514
#include "optionsmodel.h"
1615
#include "rpcconsole.h"
16+
#include "utilitydialog.h"
1717
#ifdef ENABLE_WALLET
1818
#include "walletframe.h"
1919
#include "walletmodel.h"

src/qt/forms/aboutdialog.ui

+8-8
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ This product includes software developed by the OpenSSL Project for use in the O
160160
<slot>accept()</slot>
161161
<hints>
162162
<hint type="sourcelabel">
163-
<x>360</x>
164-
<y>308</y>
163+
<x>20</x>
164+
<y>20</y>
165165
</hint>
166166
<hint type="destinationlabel">
167-
<x>157</x>
168-
<y>274</y>
167+
<x>20</x>
168+
<y>20</y>
169169
</hint>
170170
</hints>
171171
</connection>
@@ -176,12 +176,12 @@ This product includes software developed by the OpenSSL Project for use in the O
176176
<slot>reject()</slot>
177177
<hints>
178178
<hint type="sourcelabel">
179-
<x>428</x>
180-
<y>308</y>
179+
<x>20</x>
180+
<y>20</y>
181181
</hint>
182182
<hint type="destinationlabel">
183-
<x>286</x>
184-
<y>274</y>
183+
<x>20</x>
184+
<y>20</y>
185185
</hint>
186186
</hints>
187187
</connection>

src/qt/forms/helpmessagedialog.ui

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>HelpMessageDialog</class>
4+
<widget class="QDialog" name="HelpMessageDialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>800</width>
10+
<height>400</height>
11+
</rect>
12+
</property>
13+
<property name="font">
14+
<font>
15+
<pointsize>10</pointsize>
16+
</font>
17+
</property>
18+
<property name="windowTitle">
19+
<string>Bitcoin Core - Command-line options</string>
20+
</property>
21+
<layout class="QHBoxLayout" name="horizontalLayout_2">
22+
<item>
23+
<widget class="QLabel" name="graphic">
24+
<property name="sizePolicy">
25+
<sizepolicy hsizetype="Preferred" vsizetype="Ignored">
26+
<horstretch>0</horstretch>
27+
<verstretch>0</verstretch>
28+
</sizepolicy>
29+
</property>
30+
<property name="pixmap">
31+
<pixmap resource="../bitcoin.qrc">:/images/about</pixmap>
32+
</property>
33+
</widget>
34+
</item>
35+
<item>
36+
<layout class="QVBoxLayout" name="verticalLayout">
37+
<item>
38+
<widget class="QScrollArea" name="scrollArea">
39+
<property name="verticalScrollBarPolicy">
40+
<enum>Qt::ScrollBarAlwaysOn</enum>
41+
</property>
42+
<property name="widgetResizable">
43+
<bool>true</bool>
44+
</property>
45+
<widget class="QWidget" name="scrollAreaWidgetContents">
46+
<property name="geometry">
47+
<rect>
48+
<x>0</x>
49+
<y>0</y>
50+
<width>659</width>
51+
<height>348</height>
52+
</rect>
53+
</property>
54+
<layout class="QVBoxLayout" name="verticalLayout_2">
55+
<item>
56+
<widget class="QLabel" name="helpMessageLabel">
57+
<property name="font">
58+
<font>
59+
<family>Terminal</family>
60+
</font>
61+
</property>
62+
<property name="cursor">
63+
<cursorShape>IBeamCursor</cursorShape>
64+
</property>
65+
<property name="textFormat">
66+
<enum>Qt::PlainText</enum>
67+
</property>
68+
<property name="textInteractionFlags">
69+
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
70+
</property>
71+
</widget>
72+
</item>
73+
</layout>
74+
</widget>
75+
</widget>
76+
</item>
77+
<item>
78+
<widget class="QDialogButtonBox" name="okButton">
79+
<property name="orientation">
80+
<enum>Qt::Horizontal</enum>
81+
</property>
82+
<property name="standardButtons">
83+
<set>QDialogButtonBox::Ok</set>
84+
</property>
85+
</widget>
86+
</item>
87+
</layout>
88+
</item>
89+
</layout>
90+
</widget>
91+
<resources>
92+
<include location="../bitcoin.qrc"/>
93+
</resources>
94+
<connections>
95+
<connection>
96+
<sender>okButton</sender>
97+
<signal>accepted()</signal>
98+
<receiver>HelpMessageDialog</receiver>
99+
<slot>accept()</slot>
100+
<hints>
101+
<hint type="sourcelabel">
102+
<x>20</x>
103+
<y>20</y>
104+
</hint>
105+
<hint type="destinationlabel">
106+
<x>20</x>
107+
<y>20</y>
108+
</hint>
109+
</hints>
110+
</connection>
111+
<connection>
112+
<sender>okButton</sender>
113+
<signal>rejected()</signal>
114+
<receiver>HelpMessageDialog</receiver>
115+
<slot>reject()</slot>
116+
<hints>
117+
<hint type="sourcelabel">
118+
<x>20</x>
119+
<y>20</y>
120+
</hint>
121+
<hint type="destinationlabel">
122+
<x>20</x>
123+
<y>20</y>
124+
</hint>
125+
</hints>
126+
</connection>
127+
</connections>
128+
</ui>

0 commit comments

Comments
 (0)