From 5735cf3764a77e326f09fecd66ceec57cab8b0f2 Mon Sep 17 00:00:00 2001 From: fsb4000 Date: Sat, 7 Feb 2015 17:56:24 +0600 Subject: [PATCH] =?utf8?q?=D0=90=D0=B2=D1=82=D0=BE=D0=BC=D0=B0=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=BE=D0=B5=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5=20novacoin.conf=20+=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D1=8F=20novacoin.conf=20=D0=B2=20Qt=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20=D0=BA=D0=BE=D1=88=D0=B5=D0=BB=D1=8C=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/qt/forms/rpcconsole.ui | 354 ++++++++++++++++++++++++------------------- src/qt/guiutil.cpp | 9 + src/qt/guiutil.h | 3 +- src/qt/locale/bitcoin_ru.ts | 12 ++ src/qt/rpcconsole.cpp | 6 + src/qt/rpcconsole.h | 2 + src/util.cpp | 34 ++++- 7 files changed, 259 insertions(+), 161 deletions(-) diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index afe3cd6..f5b50f6 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -23,12 +23,9 @@ &Information - - - 12 - - - + + + 75 @@ -36,19 +33,12 @@ - NovaCoin Core + Configuration file - - - - Client name - - - - - + + IBeamCursor @@ -63,15 +53,15 @@ - - + + - Client version + Current number of blocks - - + + IBeamCursor @@ -86,67 +76,106 @@ - - - - Using OpenSSL version + + + + + 75 + true + - - 10 + + Command-line options - - - - IBeamCursor + + + + Open the NovaCoin debug log file from the current data directory. This can take a few seconds for large log files. - N/A + &Open - - Qt::PlainText + + false - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + 75 + true + + + + Debug log file - - - - Using BerkeleyDB version - - - 10 - - + + + + Qt::Horizontal + + + + 404 + 20 + + + - - - - IBeamCursor - - - N/A - - - Qt::PlainText - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - + + + + Qt::Vertical + + + + 20 + 40 + + + - - + + + + Show the NovaCoin-Qt help message to get a list with possible NovaCoin command-line options. + - Build date + &Show + + + false - - + + + + Last block time + + + + + + + + 75 + true + + + + Network + + + + + IBeamCursor @@ -168,8 +197,15 @@ - - + + + + On testnet + + + + + IBeamCursor @@ -184,8 +220,15 @@ - - + + + + Number of connections + + + + + 75 @@ -193,19 +236,29 @@ - Network + Block chain - - + + + + false + - Number of connections + - - + + + + Estimated total blocks + + + + + IBeamCursor @@ -220,45 +273,44 @@ - - + + + + IBeamCursor + - On testnet + N/A - - - - - - false + + Qt::PlainText - - + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - 75 - true - - + + - Block chain + Using BerkeleyDB version + + + 10 - - + + - Current number of blocks + Using OpenSSL version + + + 10 - - + + IBeamCursor @@ -273,15 +325,8 @@ - - - - Estimated total blocks - - - - - + + IBeamCursor @@ -296,15 +341,15 @@ - - + + - Last block time + Build date - - + + IBeamCursor @@ -319,21 +364,15 @@ - - - - Qt::Vertical - - - - 20 - 20 - + + + + Client version - + - - + + 75 @@ -341,62 +380,59 @@ - Debug log file + NovaCoin Core - - - - Open the NovaCoin debug log file from the current data directory. This can take a few seconds for large log files. + + + + IBeamCursor - &Open - - - false + N/A - - - - - - - 75 - true - + + Qt::PlainText - - Command-line options + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - Show the NovaCoin-Qt help message to get a list with possible NovaCoin command-line options. - + + - &Show - - - false + Client name - - + + Qt::Vertical 20 - 40 + 20 + + + + Open the NovaCoin configuration file from the current data directory. + + + O&pen + + + false + + + diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index c244c2d..6fdc5c9 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -265,6 +265,15 @@ void openDebugLogfile() QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathDebug.string()))); } +void openConfigfile() +{ + boost::filesystem::path pathConfig = GetConfigFile(); + + /* Open novacoin.conf with the associated application */ + if (boost::filesystem::exists(pathConfig)) + QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathConfig.string()))); +} + ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) : QObject(parent), size_threshold(size_threshold) { diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 1ff4aba..fd72668 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -73,7 +73,8 @@ namespace GUIUtil // Open debug.log void openDebugLogfile(); - + // Open novacoin.conf + void openConfigfile(); /** 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. diff --git a/src/qt/locale/bitcoin_ru.ts b/src/qt/locale/bitcoin_ru.ts index 2c25060..fdf4d09 100644 --- a/src/qt/locale/bitcoin_ru.ts +++ b/src/qt/locale/bitcoin_ru.ts @@ -2237,6 +2237,10 @@ This label turns red, if the priority is smaller than "medium". &Открыть + O&pen + О&ткрыть + + Command-line options Параметры командной строки @@ -2277,11 +2281,19 @@ This label turns red, if the priority is smaller than "medium". Отладочный лог-файл + Configuration file + Конфигурационный файл + + Open the NovaCoin debug log file from the current data directory. This can take a few seconds for large log files. Открыть отладочный лог-файл NovaCoin из текущего каталога данных. Это может занять несколько секунд для больших лог-файлов. + Open the NovaCoin configuration file from the current data directory. + Открыть конфигурационный файл NovaCoin из текущего каталога данных. + + Clear console Очистить консоль diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 0b9e4a5..b61cecf 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -198,6 +198,7 @@ RPCConsole::RPCConsole(QWidget *parent) : #ifndef Q_OS_MAC ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export")); + ui->openConfigurationfileButton->setIcon(QIcon(":/icons/export")); ui->showCLOptionsButton->setIcon(QIcon(":/icons/options")); #endif @@ -441,6 +442,11 @@ void RPCConsole::on_openDebugLogfileButton_clicked() GUIUtil::openDebugLogfile(); } +void RPCConsole::on_openConfigurationfileButton_clicked() +{ + GUIUtil::openConfigfile(); +} + void RPCConsole::scrollToEnd() { QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar(); diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index b523f0f..aa8c8f3 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -36,6 +36,8 @@ private slots: void on_tabWidget_currentChanged(int index); /** open the debug.log from the current datadir */ void on_openDebugLogfileButton_clicked(); + /** open the novacoin.conf from the current datadir */ + void on_openConfigurationfileButton_clicked(); /** change the time range of the network traffic graph */ void on_sldGraphRange_valueChanged(int value); /** update traffic statistics */ diff --git a/src/util.cpp b/src/util.cpp index 197e562..a15fa67 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1142,6 +1142,33 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) return path; } +string randomStrGen(int length) { + static string charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + string result; + result.resize(length); + for (int32_t i = 0; i < length; i++) + result[i] = charset[rand() % charset.length()]; + + return result; +} + +void createConf() +{ + srand(time(NULL)); + + ofstream pConf; + pConf.open(GetConfigFile().generic_string().c_str()); + pConf << "rpcuser=user\nrpcpassword=" + + randomStrGen(15) + + "\nrpcport=8344" + + "\nport=7777" + + "\ndaemon=0 #(0=off, 1=on) Run in the background as a daemon and accept commands" + + "\nserver=0 #(0=off, 1=on) Accept command line and JSON-RPC commands" + + "\nrpcallowip=127.0.0.1" + + "\ntestnet=0"; + pConf.close(); +} + boost::filesystem::path GetConfigFile() { boost::filesystem::path pathConfigFile(GetArg("-conf", "novacoin.conf")); @@ -1154,7 +1181,12 @@ void ReadConfigFile(map& mapSettingsRet, { boost::filesystem::ifstream streamConfig(GetConfigFile()); if (!streamConfig.good()) - return; // No bitcoin.conf file is OK + { + createConf(); + new(&streamConfig) boost::filesystem::ifstream(GetConfigFile()); + if(!streamConfig.good()) + return; + } set setOptions; setOptions.insert("*"); -- 1.7.1