Master Core  v0.0.9 - 49a5c0d97abf09ef2911ddfe8d9551df59f9efd3-dirty
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
utilitydialog.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include "utilitydialog.h"
6 
7 #include "ui_aboutdialog.h"
8 #include "ui_helpmessagedialog.h"
9 
10 #include "bitcoingui.h"
11 #include "clientmodel.h"
12 #include "guiutil.h"
13 
14 #include "clientversion.h"
15 #include "init.h"
16 #include "util.h"
17 
18 #include <QLabel>
19 #include <QVBoxLayout>
20 #include <boost/lexical_cast.hpp>
21 #include "mastercore_version.h"
22 
25  QDialog(parent),
26  ui(new Ui::AboutDialog)
27 {
28  ui->setupUi(this);
29 
30  // Set current copyright year
31  ui->copyrightLabel->setText(tr("Copyright") + QString(" (C) 2009-%1 ").arg(COPYRIGHT_YEAR) + tr("The Bitcoin Core developers"));
32  ui->copyrightLabel_MC->setText(tr("Copyright") + QString(" (C) 2013-%1 ").arg(COPYRIGHT_YEAR) + tr("The Master Core developers"));
33 }
34 
36 {
37  if(model)
38  {
39  QString version = QString::fromStdString("0.0." + boost::lexical_cast<std::string>((double)OMNICORE_VERSION_BASE/10) + OMNICORE_VERSION_TYPE);
40  /* On x86 add a bit specifier to the version so that users can distinguish between
41  * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambigious.
42  */
43 #if defined(__x86_64__)
44  version += " " + tr("(%1-bit)").arg(64);
45 #elif defined(__i386__ )
46  version += " " + tr("(%1-bit)").arg(32);
47 #endif
48  ui->versionLabel->setText(version);
49  }
50 }
51 
53 {
54  delete ui;
55 }
56 
58 {
59  close();
60 }
61 
64  QDialog(parent),
65  ui(new Ui::HelpMessageDialog)
66 {
67  ui->setupUi(this);
68  GUIUtil::restoreWindowGeometry("nHelpMessageDialogWindow", this->size(), this);
69 
70  header = tr("Master Core") + " " + tr("version") + " " +
71  QString::fromStdString(FormatFullVersion()) + "\n\n" +
72  tr("Usage:") + "\n" +
73  " bitcoin-qt [" + tr("command-line options") + "] " + "\n";
74 
75  coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT));
76 
77  uiOptions = tr("UI options") + ":\n" +
78  " -choosedatadir " + tr("Choose data directory on startup (default: 0)") + "\n" +
79  " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
80  " -min " + tr("Start minimized") + "\n" +
81  " -rootcertificates=<file> " + tr("Set SSL root certificates for payment request (default: -system-)") + "\n" +
82  " -splash " + tr("Show splash screen on startup (default: 1)");
83 
85 
86  // Set help message text
87  ui->helpMessageLabel->setText(header + "\n" + coreOptions + "\n" + uiOptions);
88 }
89 
91 {
92  GUIUtil::saveWindowGeometry("nHelpMessageDialogWindow", this);
93  delete ui;
94 }
95 
97 {
98  // On other operating systems, the expected action is to print the message to the console.
99  QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions + "\n";
100  fprintf(stdout, "%s", strUsage.toStdString().c_str());
101 }
102 
104 {
105 #if defined(WIN32)
106  // On Windows, show a message box, as there is no stderr/stdout in windowed applications
107  exec();
108 #else
109  // On other operating systems, print help text to console
110  printToConsole();
111 #endif
112 }
113 
115 {
116  close();
117 }
118 
119 
122 {
123  if (!window)
124  return;
125 
126  // Show a simple window indicating shutdown status
127  QWidget *shutdownWindow = new QWidget();
128  QVBoxLayout *layout = new QVBoxLayout();
129  layout->addWidget(new QLabel(
130  tr("Master Core is shutting down...") + "<br /><br />" +
131  tr("Do not shut down the computer until this window disappears.")));
132  shutdownWindow->setLayout(layout);
133 
134  // Center shutdown window at where main window was
135  const QPoint global = window->mapToGlobal(window->rect().center());
136  shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
137  shutdownWindow->show();
138 }
#define COPYRIGHT_YEAR
#define OMNICORE_VERSION_TYPE
#define OMNICORE_VERSION_BASE
void on_buttonBox_accepted()
Bitcoin GUI main class.
Definition: bitcoingui.h:35
QLabel * copyrightLabel_MC
static void showShutdownWindow(BitcoinGUI *window)
"Shutdown" window
std::string HelpMessage(HelpMessageMode hmm)
Definition: init.cpp:194
HelpMessageDialog(QWidget *parent)
"Help message" dialog box
void setupUi(QDialog *HelpMessageDialog)
void saveWindowGeometry(const QString &strSetting, QWidget *parent)
Save window size and position.
Definition: guiutil.cpp:732
Ui::AboutDialog * ui
Definition: utilitydialog.h:31
"About" dialog box
Definition: utilitydialog.h:20
void restoreWindowGeometry(const QString &strSetting, const QSize &defaultSize, QWidget *parent)
Restore window size and position.
Definition: guiutil.cpp:739
Model for Bitcoin network client.
Definition: clientmodel.h:36
Ui::HelpMessageDialog * ui
Definition: utilitydialog.h:50
QLabel * versionLabel
QLabel * copyrightLabel
string FormatFullVersion()
Definition: util.cpp:1325
"Help message" dialog box
Definition: utilitydialog.h:38
AboutDialog(QWidget *parent)
"About" dialog box
QFont bitcoinAddressFont()
Definition: guiutil.cpp:83
void setupUi(QDialog *AboutDialog)
void setModel(ClientModel *model)