use timer to check filesystem; refs #155
This commit is contained in:
@@ -8,9 +8,10 @@
|
||||
#ifndef QBROWSERLIB_LOG
|
||||
#define QBROWSERLIB_LOG
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
#include <qbrowserlib/ui_log.h>
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
@@ -82,15 +83,23 @@ namespace qbrowserlib {
|
||||
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;
|
||||
|
||||
public:
|
||||
|
||||
LogDialog(QWidget* p): QDialog(p) {
|
||||
#ifdef QT_GUI_LIB
|
||||
LogDialog(QWidget* p=0): QDialog(p) {
|
||||
setupUi(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename TYPE> LogDialog& append(const Log& log, TYPE* arg) {
|
||||
std::ostringstream ss;
|
||||
@@ -99,6 +108,7 @@ namespace qbrowserlib {
|
||||
}
|
||||
|
||||
template<typename TYPE> LogDialog& append(const Log& log, TYPE arg) {
|
||||
#ifdef QT_GUI_LIB
|
||||
int pos(_logs->rowCount());
|
||||
_logs->insertRow(pos);
|
||||
_logs->setItem
|
||||
@@ -116,11 +126,13 @@ namespace qbrowserlib {
|
||||
_logs->setItem
|
||||
(pos, MESSAGE,
|
||||
new QTableWidgetItem(QVariant(arg).toString()));
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
protected Q_SLOTS:
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
void on__fileLine_toggled(bool checked) {
|
||||
if (checked) {
|
||||
_logs->showColumn(FILE);
|
||||
@@ -166,6 +178,7 @@ namespace qbrowserlib {
|
||||
if (!items.isEmpty()) _logs->scrollToItem(items[0]);
|
||||
unsetCursor();
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
@@ -181,7 +194,7 @@ namespace qbrowserlib {
|
||||
init(ss);
|
||||
indent(ss)<<" → "<<arg;
|
||||
std::clog<<close(ss).str()<<std::endl;
|
||||
if (!_dialog) _dialog = new LogDialog(0);
|
||||
if (!_dialog) _dialog = new LogDialog;
|
||||
_dialog->append(*this, arg);
|
||||
return *this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user