Refactored logging
FossilOrigin-Name: 9c198b023e2df1b5cfe64dd745d070732b5ab843
This commit is contained in:
parent
f261fbaa66
commit
39745ab55a
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
|||||||
C Ported\suiRunning
|
C Refactored\slogging\n
|
||||||
D 2015-04-26T10:41:44.338
|
D 2015-04-26T10:58:36.776
|
||||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||||
@ -185,7 +185,7 @@ F rsrc/icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038
|
|||||||
F rsrc/icons/fuel.png 40daf53b7f6bdcdd0d6aa5ef433d078ec5ea4342
|
F rsrc/icons/fuel.png 40daf53b7f6bdcdd0d6aa5ef433d078ec5ea4342
|
||||||
F rsrc/resources.qrc 4098be128fd6c045db933d041fe8844b14643a6f
|
F rsrc/resources.qrc 4098be128fd6c045db933d041fe8844b14643a6f
|
||||||
F src/Bridge.cpp b34f14d8d887c9db6b27a84b6423931bf262e7a0
|
F src/Bridge.cpp b34f14d8d887c9db6b27a84b6423931bf262e7a0
|
||||||
F src/Bridge.h a2167ed1bb8d1d80eb2ff0fda157eb4c8d176b16
|
F src/Bridge.h 7c6c314b45d1010e17af5aa6975469fd3a4ba2aa
|
||||||
F src/BrowserWidget.cpp 8b8f545cdff4a4188edc698a1b4777f5df46f056
|
F src/BrowserWidget.cpp 8b8f545cdff4a4188edc698a1b4777f5df46f056
|
||||||
F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597
|
F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597
|
||||||
F src/CloneDialog.cpp 812ef7d361c16da21540b7047c9d4d5e74f18539
|
F src/CloneDialog.cpp 812ef7d361c16da21540b7047c9d4d5e74f18539
|
||||||
@ -200,8 +200,8 @@ F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
|||||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||||
F src/MainWindow.cpp 16c97083d455983f1c7d21c8d21a16d7d0676ba4
|
F src/MainWindow.cpp 0400011fea2e3b83008fb00a95199de6d63aa391
|
||||||
F src/MainWindow.h 8336643bbdca5c294f9fafc91ae78303fb7c063e
|
F src/MainWindow.h 60b5a13bec9fa43c5ec37aa1f748005c9add19d5
|
||||||
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
|
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
|
||||||
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
|
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
|
||||||
F src/Utils.cpp 9aff456712e4276b49083426301b3b96d3819c77
|
F src/Utils.cpp 9aff456712e4276b49083426301b3b96d3819c77
|
||||||
@ -215,7 +215,7 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f
|
|||||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||||
F ui/MainWindow.ui 8677f5c8bca5bf7561d5f64bfdd0cef5157c6ac7
|
F ui/MainWindow.ui 8677f5c8bca5bf7561d5f64bfdd0cef5157c6ac7
|
||||||
F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b
|
F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b
|
||||||
P 7a4ea959c64034b6e20dec41a4a8c16a09397bfa
|
P bc822e7b940bf0e3eceaf99d6a47921af1a361f0
|
||||||
R d99dba3c5888b6181bf266039eef3548
|
R c580610965f2587fc6a5ff80b6dd2555
|
||||||
U kostas
|
U kostas
|
||||||
Z 8b104a9799f52bcdd97acb20bb55d2d7
|
Z e9a9d3506fa9e7637aeb7a955de583a9
|
||||||
|
@ -1 +1 @@
|
|||||||
bc822e7b940bf0e3eceaf99d6a47921af1a361f0
|
9c198b023e2df1b5cfe64dd745d070732b5ab843
|
13
src/Bridge.h
13
src/Bridge.h
@ -5,6 +5,7 @@ class QStringList;
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QTextBrowser>
|
||||||
|
|
||||||
|
|
||||||
class Bridge : public QObject
|
class Bridge : public QObject
|
||||||
@ -14,7 +15,7 @@ public:
|
|||||||
: QObject(0)
|
: QObject(0)
|
||||||
, parentWidget(0)
|
, parentWidget(0)
|
||||||
, abortOperation(false)
|
, abortOperation(false)
|
||||||
, logCallbackObject(0)
|
, logTextBrowser(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,14 +32,14 @@ public:
|
|||||||
RUNFLAGS_DETACHED = 1<<2
|
RUNFLAGS_DETACHED = 1<<2
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void(*log_callback_t)(const QString &text, bool isHTML, QObject *object);
|
typedef void(*log_callback_t)(QTextBrowser *textBrowser, const QString &text, bool isHTML);
|
||||||
|
|
||||||
|
|
||||||
void Init(QWidget *parent, log_callback_t callback, QObject *callbackObject, const QString &fossPath, const QString &workspace)
|
void Init(QWidget *parent, log_callback_t callback, QTextBrowser *textBrowser, const QString &fossPath, const QString &workspace)
|
||||||
{
|
{
|
||||||
parentWidget = parent;
|
parentWidget = parent;
|
||||||
logCallback = callback;
|
logCallback = callback;
|
||||||
logCallbackObject = callbackObject;
|
logTextBrowser = textBrowser;
|
||||||
|
|
||||||
fossilPath = fossPath;
|
fossilPath = fossPath;
|
||||||
currentWorkspace = workspace;
|
currentWorkspace = workspace;
|
||||||
@ -68,7 +69,7 @@ private:
|
|||||||
void log(const QString &text, bool isHTML=false)
|
void log(const QString &text, bool isHTML=false)
|
||||||
{
|
{
|
||||||
if(logCallback)
|
if(logCallback)
|
||||||
(*logCallback)(text, isHTML, logCallbackObject);
|
(*logCallback)(logTextBrowser, text, isHTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &getCurrentWorkspace()
|
const QString &getCurrentWorkspace()
|
||||||
@ -82,7 +83,7 @@ private:
|
|||||||
bool abortOperation; // FIXME: No GUI for it yet
|
bool abortOperation; // FIXME: No GUI for it yet
|
||||||
|
|
||||||
log_callback_t logCallback;
|
log_callback_t logCallback;
|
||||||
QObject *logCallbackObject;
|
QTextBrowser *logTextBrowser;
|
||||||
QString currentWorkspace;
|
QString currentWorkspace;
|
||||||
QString fossilPath; // The value from the settings
|
QString fossilPath; // The value from the settings
|
||||||
|
|
||||||
|
@ -34,8 +34,6 @@ static const unsigned char UTF8_BOM[] = { 0xEF, 0xBB, 0xBF };
|
|||||||
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
|
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
|
||||||
static const QRegExp REGEX_STASH("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
|
static const QRegExp REGEX_STASH("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
|
||||||
|
|
||||||
//#define BRIDGE_DISABLED
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -236,7 +234,9 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
|||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
|
|
||||||
bridge.Init(this, 0, 0, "", "");
|
#ifdef BRIDGE_ENABLED
|
||||||
|
bridge.Init(this, &log, ui->textBrowser, "", "");
|
||||||
|
#endif
|
||||||
|
|
||||||
// Apply any explicit workspace path if available
|
// Apply any explicit workspace path if available
|
||||||
if(workspacePath && !workspacePath->isEmpty())
|
if(workspacePath && !workspacePath->isEmpty())
|
||||||
@ -983,7 +983,7 @@ void MainWindow::updateFileView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#ifdef BRIDGE_DISABLED
|
#ifndef BRIDGE_ENABLED
|
||||||
MainWindow::RepoStatus MainWindow::getRepoStatus()
|
MainWindow::RepoStatus MainWindow::getRepoStatus()
|
||||||
{
|
{
|
||||||
QStringList res;
|
QStringList res;
|
||||||
@ -1050,16 +1050,22 @@ void MainWindow::updateStashView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::log(const QString &text, bool isHTML)
|
void MainWindow::log(QTextBrowser *textBrowser, const QString &text, bool isHTML)
|
||||||
{
|
{
|
||||||
QTextCursor c = ui->textBrowser->textCursor();
|
QTextCursor c = textBrowser->textCursor();
|
||||||
c.movePosition(QTextCursor::End);
|
c.movePosition(QTextCursor::End);
|
||||||
ui->textBrowser->setTextCursor(c);
|
textBrowser->setTextCursor(c);
|
||||||
|
|
||||||
if(isHTML)
|
if(isHTML)
|
||||||
ui->textBrowser->insertHtml(text);
|
textBrowser->insertHtml(text);
|
||||||
else
|
else
|
||||||
ui->textBrowser->insertPlainText(text);
|
textBrowser->insertPlainText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void MainWindow::log(const QString &text, bool isHTML)
|
||||||
|
{
|
||||||
|
log(ui->textBrowser, text, isHTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1075,7 +1081,7 @@ void MainWindow::on_actionClearLog_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef BRIDGE_DISABLED
|
#ifndef BRIDGE_ENABLED
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool MainWindow::runFossil(const QStringList &args, QStringList *output, int runFlags)
|
bool MainWindow::runFossil(const QStringList &args, QStringList *output, int runFlags)
|
||||||
{
|
{
|
||||||
@ -1722,7 +1728,7 @@ void MainWindow::on_actionDiff_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#ifdef BRIDGE_DISABLED
|
#ifndef BRIDGE_ENABLED
|
||||||
bool MainWindow::startUI()
|
bool MainWindow::startUI()
|
||||||
{
|
{
|
||||||
if(uiRunning())
|
if(uiRunning())
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include "SettingsDialog.h"
|
#include "SettingsDialog.h"
|
||||||
#include "Bridge.h"
|
#include "Bridge.h"
|
||||||
|
|
||||||
|
#define BRIDGE_ENABLED
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
@ -143,6 +145,7 @@ private:
|
|||||||
void updateSettings();
|
void updateSettings();
|
||||||
const QString &getCurrentWorkspace();
|
const QString &getCurrentWorkspace();
|
||||||
void setCurrentWorkspace(const QString &workspace);
|
void setCurrentWorkspace(const QString &workspace);
|
||||||
|
static void log(QTextBrowser *textBrowser, const QString &text, bool isHTML);
|
||||||
void log(const QString &text, bool isHTML=false);
|
void log(const QString &text, bool isHTML=false);
|
||||||
void setStatus(const QString &text);
|
void setStatus(const QString &text);
|
||||||
bool uiRunning() const;
|
bool uiRunning() const;
|
||||||
@ -262,7 +265,9 @@ private:
|
|||||||
ViewMode viewMode;
|
ViewMode viewMode;
|
||||||
stringset_t selectedDirs; // The directory selected in the tree
|
stringset_t selectedDirs; // The directory selected in the tree
|
||||||
|
|
||||||
|
#ifdef BRIDGE_ENABLED
|
||||||
Bridge bridge;
|
Bridge bridge;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Repository State
|
// Repository State
|
||||||
typedef QList<RepoFile*> filelist_t;
|
typedef QList<RepoFile*> filelist_t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user