|
|
@ -8,9 +8,10 @@ |
|
|
|
#ifndef QBROWSERLIB_LOG |
|
|
|
#ifndef QBROWSERLIB_LOG |
|
|
|
#define QBROWSERLIB_LOG |
|
|
|
#define QBROWSERLIB_LOG |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef QT_GUI_LIB |
|
|
|
#include <qbrowserlib/ui_log.h> |
|
|
|
#include <qbrowserlib/ui_log.h> |
|
|
|
|
|
|
|
|
|
|
|
#include <QtGui/QDialog> |
|
|
|
#include <QtGui/QDialog> |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#include <sstream> |
|
|
|
#include <sstream> |
|
|
|
#include <iostream> |
|
|
|
#include <iostream> |
|
|
@ -82,15 +83,23 @@ namespace qbrowserlib { |
|
|
|
unsigned long _line; |
|
|
|
unsigned long _line; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class LogDialog: public QDialog, public Ui::LogDialog { |
|
|
|
class LogDialog: |
|
|
|
|
|
|
|
#ifdef QT_GUI_LIB |
|
|
|
|
|
|
|
public QDialog, public Ui::LogDialog |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
public QObject |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
Q_OBJECT; |
|
|
|
Q_OBJECT; |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
LogDialog(QWidget* p): QDialog(p) { |
|
|
|
#ifdef QT_GUI_LIB |
|
|
|
|
|
|
|
LogDialog(QWidget* p=0): QDialog(p) { |
|
|
|
setupUi(this); |
|
|
|
setupUi(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
template<typename TYPE> LogDialog& append(const Log& log, TYPE* arg) { |
|
|
|
template<typename TYPE> LogDialog& append(const Log& log, TYPE* arg) { |
|
|
|
std::ostringstream ss; |
|
|
|
std::ostringstream ss; |
|
|
@ -99,6 +108,7 @@ namespace qbrowserlib { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename TYPE> LogDialog& append(const Log& log, TYPE arg) { |
|
|
|
template<typename TYPE> LogDialog& append(const Log& log, TYPE arg) { |
|
|
|
|
|
|
|
#ifdef QT_GUI_LIB |
|
|
|
int pos(_logs->rowCount()); |
|
|
|
int pos(_logs->rowCount()); |
|
|
|
_logs->insertRow(pos); |
|
|
|
_logs->insertRow(pos); |
|
|
|
_logs->setItem |
|
|
|
_logs->setItem |
|
|
@ -116,11 +126,13 @@ namespace qbrowserlib { |
|
|
|
_logs->setItem |
|
|
|
_logs->setItem |
|
|
|
(pos, MESSAGE, |
|
|
|
(pos, MESSAGE, |
|
|
|
new QTableWidgetItem(QVariant(arg).toString())); |
|
|
|
new QTableWidgetItem(QVariant(arg).toString())); |
|
|
|
|
|
|
|
#endif |
|
|
|
return *this; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected Q_SLOTS: |
|
|
|
protected Q_SLOTS: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef QT_GUI_LIB |
|
|
|
void on__fileLine_toggled(bool checked) { |
|
|
|
void on__fileLine_toggled(bool checked) { |
|
|
|
if (checked) { |
|
|
|
if (checked) { |
|
|
|
_logs->showColumn(FILE); |
|
|
|
_logs->showColumn(FILE); |
|
|
@ -166,6 +178,7 @@ namespace qbrowserlib { |
|
|
|
if (!items.isEmpty()) _logs->scrollToItem(items[0]); |
|
|
|
if (!items.isEmpty()) _logs->scrollToItem(items[0]); |
|
|
|
unsetCursor(); |
|
|
|
unsetCursor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
|
|
|
|
|
|
|
@ -181,7 +194,7 @@ namespace qbrowserlib { |
|
|
|
init(ss); |
|
|
|
init(ss); |
|
|
|
indent(ss)<<" → "<<arg; |
|
|
|
indent(ss)<<" → "<<arg; |
|
|
|
std::clog<<close(ss).str()<<std::endl; |
|
|
|
std::clog<<close(ss).str()<<std::endl; |
|
|
|
if (!_dialog) _dialog = new LogDialog(0); |
|
|
|
if (!_dialog) _dialog = new LogDialog; |
|
|
|
_dialog->append(*this, arg); |
|
|
|
_dialog->append(*this, arg); |
|
|
|
return *this; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
} |
|
|
|