${s_qt_osd_srcs}
${s_qt_osd_headers_MOC}
)
+#set_property(TARGET qt_osd PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
#include (GenerateExportHeader)
# add_library(CSPosd SHARED
# ${s_qt_osd_srcs}
dialog_set_key.h
dialog_set_key_combo.h
dialog_movie.h
-
+ display_log.h
+
tab_movie_general.h
tab_movie_h264.h
tab_movie_mpeg4.h
dialog_set_key.cpp
dialog_set_key_combo.cpp
dialog_movie.cpp
+ display_log.cpp
tab_movie_general.cpp
tab_movie_h264.cpp
)
set_target_properties(CSPgui PROPERTIES
- SOVERSION 2.1.5
- VERSION 2.1.5
+ SOVERSION 2.2.0
+ VERSION 2.2.0
)
INSTALL(TARGETS CSPgui DESTINATION ${LIBCSP_INSTALL_DIR})
endif()
va_end(ap);
}
-int64_t CSP_Logger::get_console_list(char *buffer, int64_t buf_size, bool utf8, char *domainname, bool forget, int64_t start, int64_t end)
+int64_t CSP_Logger::get_console_list(char *buffer, int64_t buf_size, bool utf8, char *domainname, bool forget, int64_t start, int64_t end, int64_t *end_line)
{
if((buffer == NULL) || (buf_size <= 0)) return (int64_t)-1;
t = squeue.at(i);
}
if(t != NULL) {
+ int64_t n_line = t->get_line_num();
+ if(end_line != NULL) *end_line = n_line;
if(check_line) {
- int64_t n_line = t->get_line_num();
if((n_line < start) || (n_line >= end)) {
if(forget) {
QMutexLocker locker(lock_mutex);
return n_len;
}
-int64_t CSP_Logger::copy_log(char *buffer, int64_t buf_size, int64_t *lines, char *domainname, bool utf8, bool forget, int64_t start, int64_t start_size)
+int64_t CSP_Logger::copy_log(char *buffer, int64_t buf_size, int64_t *lines, char *domainname, bool utf8, bool forget, int64_t start, int64_t start_size, int64_t *end_line)
{
if((buffer == NULL) || (buf_size <= 0)) return (int64_t)-1;
int64_t line = start;
nlines = squeue.size();
}
for(; (buf_left > 0) && (nlines > 0);) {
- size = get_console_list(buffer, buf_left, utf8, domainname, forget, line, line + 1);
+ size = get_console_list(buffer, buf_left, utf8, domainname, forget, line, line + 1, end_line);
if(size <= 0) break;
buf_left -= size;
ssize += size;
return ssize;
}
+void *CSP_Logger::get_raw_data(bool forget, int64_t start, int64_t *end_line)
+{
+ QMutexLocker locker(lock_mutex);
+ CSP_LoggerLine *t;
+ int i;
+ int64_t n = squeue.size();
+
+ if(start < 0) return (void *)NULL;
+ if(start >= n) return (void *)NULL;
+ if(forget) {
+ t = squeue.dequeue();
+ } else {
+ t = squeue.at(start);
+ }
+ if(t != NULL) {
+ if(end_line != NULL) *end_line = t->get_line_num();
+ return (void *)t;
+ }
+ return (void *)NULL;
+}
}
return s;
};
+ bool check_level(QString _domain, int _level) {
+ bool f = true;
+ if(!_domain.isEmpty()) {
+ if(_domain != domain) f = false;
+ }
+ if(_level >= 0) {
+ if(_level != level) {
+ f = false;
+ }
+ }
+ return f;
+ }
};
class QMutex;
void set_device_node_log(int to_output, int type, bool* flags, int start, int devices);
void set_device_node_log(int to_output, int type, int *flags, int start, int devices);
void output_event_log(int device_id, int level, const char *fmt, ...);
- int64_t get_console_list(char *buffer, int64_t buf_size, bool utf8, char *domainname, bool forget, int64_t start = -1, int64_t end = -1);
+ int64_t get_console_list(char *buffer, int64_t buf_size, bool utf8, char *domainname, bool forget, int64_t start = -1, int64_t end = -1, int64_t *end_line = 0);
void clear_log(void);
int64_t write_log(const _TCHAR *name, const char *domain_name = NULL, bool utf8 = true, bool forget = false);
- int64_t copy_log(char *buffer, int64_t buf_size, int64_t *lines = NULL, char *domainname = NULL, bool utf8 = true, bool forget = false, int64_t start = 0, int64_t start_size = 0);
+ int64_t copy_log(char *buffer, int64_t buf_size, int64_t *lines = NULL, char *domainname = NULL, bool utf8 = true, bool forget = false, int64_t start = 0, int64_t start_size = 0, int64_t *end_line = 0);
+ void *get_raw_data(bool forget = false, int64_t start = 0, int64_t *end_line = NULL);
};
QT_END_NAMESPACE
--- /dev/null
+/*
+ */
+
+
+#include <QFile>
+#include <QTextBrowser>
+#include <QLabel>
+#include <QIODevice>
+#include <QUrl>
+#include <QStringList>
+
+#include <QTextBrowser>
+#include <QLabel>
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QFont>
+#include <QGridLayout>
+#include <QTimer>
+
+#include "mainwidget_base.h"
+#include "display_log.h"
+#include "menu_flags.h"
+#include "csp_logger.h"
+
+Dlg_LogViewerBind::Dlg_LogViewerBind(QObject *parent, QString _str, int _bind_int) : QObject(parent)
+{
+ bind_int =_bind_int;
+ str = _str;
+}
+
+Dlg_LogViewerBind::~Dlg_LogViewerBind()
+{
+}
+
+int32_t Dlg_LogViewerBind::get_int(void)
+{
+ return bind_int;
+}
+
+QString Dlg_LogViewerBind::get_domain(void)
+{
+ return str;
+}
+
+void Dlg_LogViewerBind::do_set_domain(QString _str)
+{
+ str = _str;
+}
+
+void Dlg_LogViewerBind::do_set_bind_val(uint32_t n)
+{
+ bind_int = n;
+}
+
+void Dlg_LogViewerBind::do_reset_int(int n)
+{
+ if(n < 0) {
+ bind_int = 0x00000000;
+ emit sig_throw_desc(str, bind_int);
+ return;
+ }
+ bind_int = bind_int & (~(1 << n));
+ emit sig_throw_desc(str, bind_int);
+}
+
+void Dlg_LogViewerBind::do_set_int(int n)
+{
+ if(n < 0) {
+ bind_int = 0xffffffff;
+ emit sig_throw_desc(str, bind_int);
+ return;
+ }
+ bind_int = bind_int | (1 << n);
+ emit sig_throw_desc(str, bind_int);
+}
+
+void Dlg_LogViewerBind::do_update(void)
+{
+ emit sig_throw_desc(str, bind_int);
+}
+
+Dlg_LogViewer::Dlg_LogViewer(USING_FLAGS *p, QWidget *parent, QString _domain, uint32_t level) : QWidget(parent)
+{
+ log_str.clear();
+ domain_name = _domain;
+ level_map = level;
+ now_end_line = 0;
+ using_flags = p;
+
+ TextBox = new QTextBrowser();
+ TextBox->setStyleSheet("font: 12pt \"Sans\";");
+ TextBox->setMinimumSize(800, 470);
+ TextBox->setOpenExternalLinks(true);
+ if(csp_logger != NULL) {
+ CSP_LoggerLine *p;
+ QString tmpstr;
+ QString beforestr;
+ bool first = true;
+ do {
+ p = (CSP_LoggerLine *)(csp_logger->get_raw_data(false, now_end_line, NULL));
+ if(p == NULL) break;
+ if(p->check_level(_domain, -1)) {
+ tmpstr = p->get_element_console();
+ if(!beforestr.endsWith("\n") && !first) log_str.append("\n");
+ log_str.append(tmpstr);
+ beforestr = tmpstr;
+ first = false;
+ }
+ now_end_line = now_end_line + 1;
+ } while(1);
+ //if(!tmpstr.endsWith("\n")) log_str.append("\n");
+ }
+ TextBox->setText(log_str.toUtf8());
+
+ QString title;
+ title = QString::fromUtf8("Log (emu");
+ title.append(using_flags->get_config_name());
+ title.append(QString::fromUtf8(")"));
+ if(parent == NULL) this->setWindowTitle(title);
+
+ connect(this, SIGNAL(sig_text_clear()), TextBox, SLOT(clear()));
+ connect(this, SIGNAL(sig_text_update(QString)), TextBox, SLOT(setText(QString)));
+ connect(this, SIGNAL(sig_text_append(QString)), TextBox, SLOT(append(QString)));
+ MasterLayout = new QGridLayout;
+ MasterLayout->addWidget(TextBox, 0, 0, 4, 4);
+
+ UpdateTimer = new QTimer(this);
+ UpdateTimer->setInterval(500); // 500ms
+ UpdateTimer->setSingleShot(false);
+ connect(UpdateTimer, SIGNAL(timeout()), this, SLOT(do_update()));
+ UpdateTimer->start();
+ this->setLayout(MasterLayout);
+}
+
+Dlg_LogViewer::~Dlg_LogViewer()
+{
+}
+
+void Dlg_LogViewer::do_search_by_domain(QString _domain_name, uint32_t _level)
+{
+ domain_name = _domain_name;
+ level_map = _level;
+ do_refresh();
+}
+
+void Dlg_LogViewer::do_update(void)
+{
+ //log_str.clear();
+ CSP_LoggerLine *p;
+ QString strlist;
+ int64_t line = now_end_line;
+ QString tmpstr;
+ QString beforestr;
+ bool first = true;
+ do {
+ p = (CSP_LoggerLine *)(csp_logger->get_raw_data(false, line, NULL));
+ if(p == NULL) break;
+ bool f = false;
+ for(int i = 0; i < 8; i++) {
+ if((level_map & (1 << i)) != 0) {
+ if(p->check_level(domain_name, i)) {
+ if(!beforestr.endsWith("\n") && !first) strlist.append("\n");
+ tmpstr = p->get_element_console();
+ beforestr = tmpstr;
+ strlist.append(tmpstr);
+ first = false;
+ break;
+ }
+ }
+ }
+ line++;
+ } while(1);
+ if((line >= now_end_line) && !strlist.isEmpty()){
+ now_end_line = line;
+ log_str.append(strlist);
+ if(!strlist.endsWith("\n")) log_str.append("\n");
+ emit sig_text_append(strlist);
+ }
+}
+
+void Dlg_LogViewer::do_refresh(void)
+{
+ CSP_LoggerLine *p;
+ QString tmpstr;
+ QString beforestr;
+ bool first = true;
+ log_str.clear();
+ now_end_line = 0;
+ do {
+ p = (CSP_LoggerLine *)(csp_logger->get_raw_data(false, now_end_line, NULL));
+ if(p == NULL) break;
+ bool f = false;
+ for(int i = 0; i < 8; i++) {
+ if((level_map & (1 << i)) != 0) {
+ if(p->check_level(domain_name, 1 << i)) {
+ tmpstr = p->get_element_console();
+ if(!beforestr.endsWith("\n") && !first) log_str.append("\n");
+ beforestr = tmpstr;
+ log_str.append(tmpstr);
+ first = false;
+ break;
+ }
+ }
+ }
+ now_end_line++;
+ } while(1);
+ //emit sig_text_clear();
+ //if(!tmpstr.endsWith("\n")) log_str.append("\n");
+ emit sig_text_update(log_str);
+}
--- /dev/null
+/*
+ * Common Source code project
+ */
+
+#ifndef _CSP_QT_DISPLAY_LOG_H
+#define _CSP_QT_DISPLAY_LOG_H
+
+#include <QString>
+#include <QByteArray>
+#include <QUrl>
+#include <QStringList>
+#include <QWidget>
+
+#include "common.h"
+
+QT_BEGIN_NAMESPACE
+
+class QTextBrowser;
+class QLabel;
+class QFont;
+class QVBoxLayout;
+class QGridLayout;
+class QGroupBox;
+class QTimer;
+class USING_FLAGS;
+
+class DLL_PREFIX Dlg_LogViewerBind : public QObject
+{
+ Q_OBJECT
+protected:
+ uint32_t bind_int;
+ QString str;
+public:
+ Dlg_LogViewerBind(QObject *parent, QString _str, int32_t _bind_int = 0xffffffff);
+ ~Dlg_LogViewerBind();
+ int32_t get_int(void);
+ QString get_domain(void);
+public slots:
+ void do_set_int(int n);
+ void do_reset_int(int n);
+ void do_set_bind_val(uint32_t n);
+ void do_set_domain(QString);
+ void do_update(void);
+signals:
+ int sig_throw_int(int);
+ int sig_throw_desc(QString, uint32_t);
+};
+
+class DLL_PREFIX Dlg_LogViewer : public QWidget
+{
+ Q_OBJECT
+
+protected:
+ QString log_str;
+
+ QString domain_name;
+ uint32_t level_map;
+ int64_t now_end_line;
+
+ QTextBrowser *TextBox;
+ QGridLayout *MasterLayout;
+ QTimer *UpdateTimer;
+ USING_FLAGS *using_flags;
+public:
+ Dlg_LogViewer(USING_FLAGS *p, QWidget *parent, QString _domain = QString::fromUtf8(""), uint32_t _level = 0xffffffff);
+ ~Dlg_LogViewer();
+
+public slots:
+ void do_search_by_domain(QString _domain_name, uint32_t _level);
+ void do_update(void);
+ void do_refresh(void);
+signals:
+ int sig_text_clear();
+ int sig_text_update(QString);
+ int sig_text_append(QString);
+};
+
+QT_END_NAMESPACE
+#endif
// Emulator
class Action_Control *action_SetupJoystick;
class Action_Control *action_SetupKeyboard;
-
+ class Action_Control *action_LogView;
+
QMenu *menuLogToConsole;
QMenu *menuLogToSyslog;
QMenu *menuDevLogToConsole;
void do_set_sound_device(int);
void do_emu_update_volume_balance(int num, int level);
void do_emu_update_volume_level(int num, int level);
+ void rise_log_viewer(void);
void rise_volume_dialog(void);
void do_set_state_saving_movie(bool state);
void OnLoadState(void);
void OnSaveState(void);
+
+
virtual void OnOpenDebugger(int n);
virtual void OnCloseDebugger(void);
do_update_device_node_name(i, p);
}
menuDevLogToConsole->setTitle(QApplication::translate("MainWindow", "Per Device", 0));
+
+ action_LogView->setText(QApplication::translate("MainWindow", "View Log", 0));
+
}
void Ui_MainWindowBase::CreateEmulatorMenu(void)
menuEmulator->addSeparator();
menuEmulator->addAction(action_LogToSyslog);
menuEmulator->addSeparator();
+ menuEmulator->addAction(action_LogView);
+ menuEmulator->addSeparator();
if(using_flags->is_use_joystick()) {
menuEmulator->addAction(action_SetupJoystick);
}
action_DevLogToConsole[i], SLOT(do_set_dev_log_to_console(bool)));
connect(action_DevLogToConsole[i], SIGNAL(sig_set_dev_log_to_console(int, bool)),
this, SLOT(do_set_dev_log_to_console(int, bool)));
- }
+ }
+ action_LogView = new Action_Control(this, using_flags);
+ connect(action_LogView, SIGNAL(triggered()),
+ this, SLOT(rise_log_viewer()));
+
//action_LogRecord = new Action_Control(this, using_flags);
//action_LogRecord->setCheckable(true);
//action_LogRecord->setEnabled(true);
}
+#include "display_log.h"
+
+void Ui_MainWindowBase::rise_log_viewer(void)
+{
+ Dlg_LogViewer *dlg = new Dlg_LogViewer(using_flags, NULL);
+ dlg->show();
+}
+
void Ui_MainWindowBase::rise_joystick_dialog(void)
{
if(graphicsView != NULL) {