aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qt/askpassphrasedialog.cpp3
-rw-r--r--src/qt/bitcoin.cpp4
-rw-r--r--src/qt/bitcoingui.cpp24
-rw-r--r--src/qt/bitcoingui.h5
-rw-r--r--src/qt/forms/askpassphrasedialog.ui13
-rw-r--r--src/qt/forms/messagepage.ui2
-rw-r--r--src/qt/forms/rpcconsole.ui36
-rw-r--r--src/qt/guiconstants.h5
-rw-r--r--src/qt/guiutil.cpp53
-rw-r--r--src/qt/guiutil.h21
-rw-r--r--src/qt/messagepage.cpp7
-rw-r--r--src/qt/optionsdialog.cpp24
-rw-r--r--src/qt/rpcconsole.cpp12
-rw-r--r--src/qt/rpcconsole.h2
14 files changed, 173 insertions, 38 deletions
diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp
index 31e4040d1d..0a8ace09df 100644
--- a/src/qt/askpassphrasedialog.cpp
+++ b/src/qt/askpassphrasedialog.cpp
@@ -24,7 +24,6 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :
ui->passEdit1->installEventFilter(this);
ui->passEdit2->installEventFilter(this);
ui->passEdit3->installEventFilter(this);
- ui->capsLabel->clear();
switch(mode)
{
@@ -215,7 +214,7 @@ bool AskPassphraseDialog::event(QEvent *event)
bool AskPassphraseDialog::eventFilter(QObject *, QEvent *event)
{
- /* Detect Caps Lock.
+ /* Detect Caps Lock.
* There is no good OS-independent way to check a key state in Qt, but we
* can detect Caps Lock by checking for the following condition:
* Shift key is down and the result is a lower case character, or
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 4a77bf9b70..91f6a56c82 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -6,6 +6,7 @@
#include "walletmodel.h"
#include "optionsmodel.h"
#include "guiutil.h"
+#include "guiconstants.h"
#include "init.h"
#include "ui_interface.h"
@@ -164,6 +165,9 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
+ // Install global event filter that makes sure that long tooltips can be word-wrapped
+ app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
+
// Command-line options take precedence:
ParseParameters(argc, argv);
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index c2fcc10b77..55672472ec 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -402,13 +402,14 @@ void BitcoinGUI::createTrayIcon()
// Configuration of the tray icon (or dock icon) icon menu
trayIconMenu->addAction(toggleHideAction);
+ trayIconMenu->addAction(openRPCConsoleAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(messageAction);
#ifndef FIRST_CLASS_MESSAGING
trayIconMenu->addSeparator();
#endif
- trayIconMenu->addAction(receiveCoinsAction);
trayIconMenu->addAction(sendCoinsAction);
+ trayIconMenu->addAction(receiveCoinsAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(optionsAction);
#ifndef Q_WS_MAC // This is built-in on Mac
@@ -562,22 +563,25 @@ void BitcoinGUI::setNumBlocks(int count)
// Set icon state: spinning if catching up, tick otherwise
if(secs < 90*60 && count >= nTotalBlocks)
{
- tooltip = tr("Up to date") + QString(".\n") + tooltip;
+ tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
}
else
{
- tooltip = tr("Catching up...") + QString("\n") + tooltip;
+ tooltip = tr("Catching up...") + QString("<br>") + tooltip;
labelBlocksIcon->setMovie(syncIconMovie);
syncIconMovie->start();
}
if(!text.isEmpty())
{
- tooltip += QString("\n");
+ tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1.").arg(text);
}
+ // Don't word-wrap this (fixed-width) tooltip
+ tooltip = QString("<nobr>") + tooltip + QString("</nobr>");
+
labelBlocksIcon->setToolTip(tooltip);
progressBarLabel->setToolTip(tooltip);
progressBar->setToolTip(tooltip);
@@ -724,8 +728,11 @@ void BitcoinGUI::gotoSendCoinsPage()
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
-void BitcoinGUI::gotoMessagePage()
+void BitcoinGUI::gotoMessagePage(QString addr)
{
+ if(!addr.isEmpty())
+ messagePage->setAddress(addr);
+
#ifdef FIRST_CLASS_MESSAGING
messageAction->setChecked(true);
centralWidget->setCurrentWidget(messagePage);
@@ -734,16 +741,9 @@ void BitcoinGUI::gotoMessagePage()
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
#else
messagePage->show();
- messagePage->setFocus();
#endif
}
-void BitcoinGUI::gotoMessagePage(QString addr)
-{
- gotoMessagePage();
- messagePage->setAddress(addr);
-}
-
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
// Accept only URIs
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index eb4f883496..bc3c9a1dfc 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -46,7 +46,7 @@ public:
functionality.
*/
void setWalletModel(WalletModel *walletModel);
-
+
protected:
void changeEvent(QEvent *e);
void closeEvent(QCloseEvent *event);
@@ -130,8 +130,7 @@ public slots:
void askFee(qint64 nFeeRequired, bool *payFee);
void handleURI(QString strURI);
- void gotoMessagePage();
- void gotoMessagePage(QString);
+ void gotoMessagePage(QString addr = "");
private slots:
/** Switch to overview (home) page */
diff --git a/src/qt/forms/askpassphrasedialog.ui b/src/qt/forms/askpassphrasedialog.ui
index 3f6b668e06..1383af7a70 100644
--- a/src/qt/forms/askpassphrasedialog.ui
+++ b/src/qt/forms/askpassphrasedialog.ui
@@ -23,7 +23,7 @@
</size>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Passphrase Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -88,13 +88,14 @@
</item>
<item row="4" column="1">
<widget class="QLabel" name="capsLabel">
- <property name="styleSheet">
- <string notr="true">#capsLabel {
- font: bold;
-}</string>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
</property>
<property name="text">
- <string>TextLabel</string>
+ <string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
diff --git a/src/qt/forms/messagepage.ui b/src/qt/forms/messagepage.ui
index 512e47ad6d..7c8f3b5ad6 100644
--- a/src/qt/forms/messagepage.ui
+++ b/src/qt/forms/messagepage.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Message</string>
+ <string>Sign Message Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui
index 7e496a5ce7..02164f76b5 100644
--- a/src/qt/forms/rpcconsole.ui
+++ b/src/qt/forms/rpcconsole.ui
@@ -204,6 +204,42 @@
</widget>
</item>
<item row="11" column="0">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="12" column="0">
+ <widget class="QLabel" name="labelDebugLogfile">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Debug logfile</string>
+ </property>
+ </widget>
+ </item>
+ <item row="13" column="0">
+ <widget class="QPushButton" name="openDebugLogfileButton">
+ <property name="toolTip">
+ <string>Open the Bitcoin debug logfile from the current data directory. This can take a few seconds for large logfiles.</string>
+ </property>
+ <property name="text">
+ <string>&amp;Open</string>
+ </property>
+ </widget>
+ </item>
+ <item row="14" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h
index 0cb507501a..54e9d644fe 100644
--- a/src/qt/guiconstants.h
+++ b/src/qt/guiconstants.h
@@ -20,4 +20,9 @@ static const int STATUSBAR_ICONSIZE = 16;
/* Transaction list -- bare address (without label) */
#define COLOR_BAREADDRESS QColor(140, 140, 140)
+/* Tooltips longer than this (in characters) are converted into rich text,
+ so that they can be word-wrapped.
+ */
+static const int TOOLTIP_WRAP_THRESHOLD = 80;
+
#endif // GUICONSTANTS_H
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index f1e8a5f1bc..fab97f91c4 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -17,6 +17,24 @@
#include <QDesktopServices>
#include <QThread>
+#include <boost/filesystem.hpp>
+
+#ifdef WIN32
+#ifdef _WIN32_WINNT
+#undef _WIN32_WINNT
+#endif
+#define _WIN32_WINNT 0x0501
+#ifdef _WIN32_IE
+#undef _WIN32_IE
+#endif
+#define _WIN32_IE 0x0501
+#define WIN32_LEAN_AND_MEAN 1
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#include "shlwapi.h"
+#endif
+
namespace GUIUtil {
QString dateTimeStr(const QDateTime &date)
@@ -214,5 +232,40 @@ bool isObscured(QWidget *w)
&& checkPoint(QPoint(w->width()/2, w->height()/2), w));
}
+void openDebugLogfile()
+{
+ boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
+
+#ifdef WIN32
+ if (boost::filesystem::exists(pathDebug))
+ /* Open debug.log with the associated application */
+ ShellExecuteA((HWND)0, (LPCSTR)"open", (LPCSTR)pathDebug.string().c_str(), NULL, NULL, SW_SHOWNORMAL);
+#endif
+}
+
+ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) :
+ QObject(parent), size_threshold(size_threshold)
+{
+
+}
+
+bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
+{
+ if(evt->type() == QEvent::ToolTipChange)
+ {
+ QWidget *widget = static_cast<QWidget*>(obj);
+ QString tooltip = widget->toolTip();
+ if(!Qt::mightBeRichText(tooltip) && tooltip.size() > size_threshold)
+ {
+ // Prefix <qt/> to make sure Qt detects this as rich text
+ // Escape the current message as HTML and replace \n by <br>
+ tooltip = "<qt/>" + HtmlEscape(tooltip, true);
+ widget->setToolTip(tooltip);
+ return true;
+ }
+ }
+ return QObject::eventFilter(obj, evt);
+}
+
} // namespace GUIUtil
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index ea1a4795c0..8d1a01e07e 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -2,6 +2,7 @@
#define GUIUTIL_H
#include <QString>
+#include <QObject>
QT_BEGIN_NAMESPACE
class QFont;
@@ -69,6 +70,26 @@ namespace GUIUtil
// Determine whether a widget is hidden behind other windows
bool isObscured(QWidget *w);
+ // Open debug.log
+ void openDebugLogfile();
+
+ /** Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text
+ representation if needed. This assures that Qt can word-wrap long tooltip messages.
+ Tooltips longer than the provided size threshold (in characters) are wrapped.
+ */
+ class ToolTipToRichTextFilter : public QObject
+ {
+ Q_OBJECT
+ public:
+ explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0);
+
+ protected:
+ bool eventFilter(QObject *obj, QEvent *evt);
+
+ private:
+ int size_threshold;
+ };
+
} // namespace GUIUtil
#endif // GUIUTIL_H
diff --git a/src/qt/messagepage.cpp b/src/qt/messagepage.cpp
index 236b67bf37..c04d8b2c78 100644
--- a/src/qt/messagepage.cpp
+++ b/src/qt/messagepage.cpp
@@ -24,14 +24,17 @@ MessagePage::MessagePage(QWidget *parent) :
ui(new Ui::MessagePage)
{
ui->setupUi(this);
-
+
#if (QT_VERSION >= 0x040700)
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
+ ui->signFrom->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"));
ui->signature->setPlaceholderText(tr("Click \"Sign Message\" to get signature"));
#endif
GUIUtil::setupAddressWidget(ui->signFrom, this);
ui->signature->installEventFilter(this);
+
+ ui->signFrom->setFocus();
}
MessagePage::~MessagePage()
@@ -117,6 +120,8 @@ void MessagePage::on_clearButton_clicked()
ui->signFrom->clear();
ui->message->clear();
ui->signature->clear();
+
+ ui->signFrom->setFocus();
}
bool MessagePage::eventFilter(QObject *object, QEvent *event)
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index 6b4e037cc5..c3260217bb 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -39,8 +39,9 @@ public:
virtual void setMapper(MonitoredDataMapper *mapper);
private:
- QCheckBox *detach_database;
BitcoinAmountField *fee_edit;
+ QCheckBox *bitcoin_at_startup;
+ QCheckBox *detach_database;
};
class WindowOptionsPage: public OptionsPage
@@ -51,11 +52,8 @@ public:
virtual void setMapper(MonitoredDataMapper *mapper);
private:
- QCheckBox *bitcoin_at_startup;
#ifndef Q_WS_MAC
QCheckBox *minimize_to_tray;
-#endif
-#ifndef Q_WS_MAC
QCheckBox *minimize_on_close;
#endif
};
@@ -88,7 +86,6 @@ private:
QCheckBox *connect_socks4;
QLineEdit *proxy_ip;
QLineEdit *proxy_port;
- BitcoinAmountField *fee_edit;
};
@@ -107,7 +104,10 @@ OptionsDialog::OptionsDialog(QWidget *parent):
pages.append(new MainOptionsPage(this));
pages.append(new NetworkOptionsPage(this));
+#ifndef Q_WS_MAC
+ /* Hide Window options on Mac as there are currently none available */
pages.append(new WindowOptionsPage(this));
+#endif
pages.append(new DisplayOptionsPage(this));
foreach(OptionsPage *page, pages)
@@ -219,7 +219,11 @@ MainOptionsPage::MainOptionsPage(QWidget *parent):
layout->addLayout(fee_hbox);
- detach_database = new QCheckBox(tr("Detach databases at shutdown"));
+ bitcoin_at_startup = new QCheckBox(tr("&Start Bitcoin on system login"));
+ bitcoin_at_startup->setToolTip(tr("Automatically start Bitcoin after logging in to the system"));
+ layout->addWidget(bitcoin_at_startup);
+
+ detach_database = new QCheckBox(tr("&Detach databases at shutdown"));
detach_database->setToolTip(tr("Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached."));
layout->addWidget(detach_database);
@@ -231,6 +235,7 @@ void MainOptionsPage::setMapper(MonitoredDataMapper *mapper)
{
// Map model to widgets
mapper->addMapping(fee_edit, OptionsModel::Fee);
+ mapper->addMapping(bitcoin_at_startup, OptionsModel::StartAtStartup);
mapper->addMapping(detach_database, OptionsModel::DetachDatabases);
}
@@ -249,7 +254,7 @@ DisplayOptionsPage::DisplayOptionsPage(QWidget *parent):
lang = new QValueComboBox(this);
// Make list of languages
QDir translations(":translations");
- lang->addItem("(default)", QVariant(""));
+ lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
foreach(const QString &langStr, translations.entryList())
{
lang->addItem(langStr, QVariant(langStr));
@@ -307,10 +312,6 @@ WindowOptionsPage::WindowOptionsPage(QWidget *parent):
QVBoxLayout *layout = new QVBoxLayout();
setWindowTitle(tr("Window"));
- bitcoin_at_startup = new QCheckBox(tr("&Start Bitcoin on window system startup"));
- bitcoin_at_startup->setToolTip(tr("Automatically start Bitcoin after the computer is turned on"));
- layout->addWidget(bitcoin_at_startup);
-
#ifndef Q_WS_MAC
minimize_to_tray = new QCheckBox(tr("&Minimize to the tray instead of the taskbar"));
minimize_to_tray->setToolTip(tr("Show only a tray icon after minimizing the window"));
@@ -328,7 +329,6 @@ WindowOptionsPage::WindowOptionsPage(QWidget *parent):
void WindowOptionsPage::setMapper(MonitoredDataMapper *mapper)
{
// Map model to widgets
- mapper->addMapping(bitcoin_at_startup, OptionsModel::StartAtStartup);
#ifndef Q_WS_MAC
mapper->addMapping(minimize_to_tray, OptionsModel::MinimizeToTray);
#endif
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 6d983989e9..85f79309f3 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -90,6 +90,12 @@ RPCConsole::RPCConsole(QWidget *parent) :
ui->messagesWidget->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);
ui->messagesWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+#ifndef WIN32
+ // Show Debug logfile label and Open button only for Windows
+ ui->labelDebugLogfile->setVisible(false);
+ ui->openDebugLogfileButton->setVisible(false);
+#endif
+
// Install event filter for up and down arrow
ui->lineEdit->installEventFilter(this);
@@ -101,6 +107,7 @@ RPCConsole::RPCConsole(QWidget *parent) :
ui->messagesWidget->addAction(copyMessageAction);
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
+ connect(ui->openDebugLogfileButton, SIGNAL(clicked()), this, SLOT(on_openDebugLogfileButton_clicked()));
startExecutor();
@@ -310,3 +317,8 @@ void RPCConsole::on_tabWidget_currentChanged(int index)
ui->lineEdit->setFocus();
}
}
+
+void RPCConsole::on_openDebugLogfileButton_clicked()
+{
+ GUIUtil::openDebugLogfile();
+}
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index 2ec47b0cf8..30948eaad2 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -32,8 +32,8 @@ protected:
private slots:
void on_lineEdit_returnPressed();
-
void on_tabWidget_currentChanged(int index);
+ void on_openDebugLogfileButton_clicked();
public slots:
void clear();