mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Merge pull request #1247 from Diapolo/Win_open_debug_logfile
Windows: open debug.log file via Bitcoin-Qt
This commit is contained in:
commit
508471bbc0
@ -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>&Open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -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,6 +232,17 @@ 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):
|
||||
size_threshold(size_threshold), QObject(parent)
|
||||
{
|
||||
|
@ -70,6 +70,9 @@ 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.
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user