[Qt][CONFIG] Keep font metrics and window size of debugger and log viewer.Save to foo.ini file.
}
// Extra UI
config.cursor_as_ten_key = CONFIG_CURSOR_AS_CURSOR;
+ memset(config.debugwindow_font, 0x00, sizeof(config.debugwindow_font));
+ memset(config.logwindow_font, 0x00, sizeof(config.logwindow_font));
+
#if defined(_FM7) || defined(_FMNEW7) || defined(_FM8) \
|| defined(_FM77_VARIANTS) || defined(_FM77AV_VARIANTS)
config.numpad_enter_as_fullkey = false;
config.cursor_as_ten_key = MyGetPrivateProfileInt(_T("Qt"), _T("CursorAsTenKey"), config.cursor_as_ten_key, config_path);
config.numpad_enter_as_fullkey = MyGetPrivateProfileBool(_T("Qt"), _T("NumpadEnterAsFullKey"), config.numpad_enter_as_fullkey, config_path);
config.host_keyboard_type = MyGetPrivateProfileInt(_T("Qt"), _T("HostKeyboardType"), config.host_keyboard_type, config_path);
+ MyGetPrivateProfileString(_T("Qt"), _T("DebugWindowFont"), _T("Sans"), config.debugwindow_font, sizeof(config.debugwindow_font) - 1, config_path);
+ config.debugwindow_width = MyGetPrivateProfileInt(_T("Qt"), _T("DebugWindowWidth"), 800, config_path);
+ config.debugwindow_height = MyGetPrivateProfileInt(_T("Qt"), _T("DebugWindowHeight"), 500, config_path);
+ MyGetPrivateProfileString(_T("Qt"), _T("LogWindowFont"), _T("Sans"), config.logwindow_font, sizeof(config.logwindow_font) - 1, config_path);
+ config.logwindow_width = MyGetPrivateProfileInt(_T("Qt"), _T("LogWindowWidth"), 800, config_path);
+ config.logwindow_height = MyGetPrivateProfileInt(_T("Qt"), _T("LogWindowHeight"), 500, config_path);
// Movie load/save.
MyWritePrivateProfileInt(_T("Qt"), _T("CursorAsTenKey"), config.cursor_as_ten_key, config_path);
MyWritePrivateProfileBool(_T("Qt"), _T("NumpadEnterAsFullKey"), config.numpad_enter_as_fullkey, config_path);
MyWritePrivateProfileInt(_T("Qt"), _T("HostKeyboardType"), config.host_keyboard_type, config_path);
+ MyWritePrivateProfileString(_T("Qt"), _T("DebugWindowFont"), config.debugwindow_font, config_path);
+ MyWritePrivateProfileInt(_T("Qt"), _T("DebugWindowWidth"), config.debugwindow_width, config_path);
+ MyWritePrivateProfileInt(_T("Qt"), _T("DebugWindowHeight"), config.debugwindow_height, config_path);
+ MyWritePrivateProfileString(_T("Qt"), _T("LogWindowFont"), config.logwindow_font, config_path);
+ MyWritePrivateProfileInt(_T("Qt"), _T("LogWindowWidth"), config.logwindow_width, config_path);
+ MyWritePrivateProfileInt(_T("Qt"), _T("LogWindowHeight"), config.logwindow_height, config_path);
for(i = 0; i < 16; i++) {
_TCHAR name[256];
int render_major_version;
int render_minor_version;
bool disk_count_immediate[16]; // Hack for MB8877, FLEX for FM-7.
+ _TCHAR debugwindow_font[1024];
+ _TCHAR logwindow_font[1024];
+ int debugwindow_width;
+ int debugwindow_height;
+ int logwindow_width;
+ int logwindow_height;
+
#endif
// sound
message("* qt/emuutils")
-SET(THIS_LIB_VERSION 2.16.2)
+SET(THIS_LIB_VERSION 2.16.3)
set(s_qt_emuutils_headers
../gui/csp_logger.h
message("* qt/gui")
-set(THIS_LIB_VERSION 2.19.4)
+set(THIS_LIB_VERSION 2.19.5)
#include(cotire)
#include(PrecompiledHeader)
#include <QIODevice>
#include <QUrl>
#include <QStringList>
+#include <QApplication>
#include <QTextBrowser>
#include <QLabel>
#include <QVBoxLayout>
#include <QFont>
#include <QGridLayout>
+#include <QFontDialog>
+#include <QPushButton>
#include <QTimer>
#include <QMutexLocker>
+#include <QResizeEvent>
+#include <QSize>
#include "mainwidget_base.h"
#include "display_log.h"
emit sig_throw_desc(str, bind_int);
}
+void Dlg_LogViewer::set_font(const QFont &font)
+{
+ TextBox->setFont(font);
+ if(!(font.toString().isEmpty())) {
+ memset(config.logwindow_font, 0x00, sizeof(config.logwindow_font));
+ snprintf(config.logwindow_font, sizeof(config.logwindow_font) - 1, "%s", font.toString().toLocal8Bit().constData());
+ }
+}
+
+void Dlg_LogViewer::rise_font_dialog(void)
+{
+ QFontDialog *dlg = new QFontDialog(TextBox->font(), this);
+ connect(dlg, SIGNAL(fontSelected(const QFont)), this, SLOT(set_font(const QFont)));
+ dlg->show();
+}
+
+void Dlg_LogViewer::resizeEvent(QResizeEvent *event)
+{
+ QSize s = event->size();
+ int width = s.width();
+ int height = s.height();
+ if(width < 320) width = 320;
+ if(height < 200) height = 200;
+ config.logwindow_height = height;
+ config.logwindow_width = width;
+}
+
+
Dlg_LogViewer::Dlg_LogViewer(USING_FLAGS *p, CSP_Logger *logger, QWidget *parent, QString _domain, uint32_t level) : QWidget(parent)
{
lock_mutex = new QMutex(QMutex::Recursive);
using_flags = p;
csp_logger = logger;
TextBox = new QTextBrowser();
- TextBox->setStyleSheet("font: 12pt \"Sans\";");
+// TextBox->setStyleSheet("font: 12pt \"Sans\";");
TextBox->setMinimumSize(800, 470);
TextBox->setOpenExternalLinks(true);
if(csp_logger != NULL) {
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);
+ FontDlgButton = new QPushButton(QApplication::translate("LogWindow", "Set Font", 0),this);
+ if(strlen(config.logwindow_font) > 0) {
+ QFont font;
+ font.fromString(QString::fromLocal8Bit(config.logwindow_font));
+ TextBox->setFont(font);
+ }
+ connect(FontDlgButton, SIGNAL(pressed()), this, SLOT(rise_font_dialog()));
+ MasterLayout->addWidget(FontDlgButton, 0, 3, Qt::AlignRight);
+ MasterLayout->addWidget(TextBox, 1, 0, 4, 4);
UpdateTimer = new QTimer(this);
UpdateTimer->setInterval(500); // 500ms
connect(UpdateTimer, SIGNAL(timeout()), this, SLOT(do_update()));
UpdateTimer->start();
this->setLayout(MasterLayout);
+
+ int w = config.logwindow_width;
+ int h = config.logwindow_height;
+ if(w < 320) w = 320;
+ if(h < 200) h = 200;
+ this->resize(w, h);
}
Dlg_LogViewer::~Dlg_LogViewer()
#include <QUrl>
#include <QStringList>
#include <QWidget>
+#include <QFont>
#include "common.h"
class QVBoxLayout;
class QGridLayout;
class QGroupBox;
+class QFontDialog;
+class QPushButton;
+class QResizeEvent;
class QTimer;
class QMutex;
class USING_FLAGS;
QTextBrowser *TextBox;
QGridLayout *MasterLayout;
QTimer *UpdateTimer;
+ QPushButton *FontDlgButton;
+
USING_FLAGS *using_flags;
QMutex *lock_mutex;
public:
Dlg_LogViewer(USING_FLAGS *p, CSP_Logger * logger, QWidget *parent, QString _domain = QString::fromUtf8(""), uint32_t _level = 0xffffffff);
~Dlg_LogViewer();
+ virtual void resizeEvent(QResizeEvent *event);
public slots:
void do_search_by_domain(QString _domain_name, uint32_t _level);
void do_update(void);
void do_refresh(void);
+ void set_font(const QFont &font);
+ void rise_font_dialog(void);
+
signals:
int sig_text_clear();
int sig_text_update(QString);
#include <fcntl.h>
#include <QObject>
#include <QMetaObject>
+#include <QPlainTextEdit>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QFontDialog>
+#include <QFont>
+#include <QApplication>
+#include <QResizeEvent>
+#include <QSize>
#include "qt_debugger_tmpl.h"
#include "qt_lineeditplus.h"
#include "osd_base.h"
+#include "../../config.h"
void CSP_Debugger_Tmpl::set_string_attr(QString color, bool is_strong)
{
connect(parent_object, SIGNAL(quit_debugger_thread()), this, SLOT(close()));
}
+void CSP_Debugger_Tmpl::set_font(const QFont &font)
+{
+ text_command->setFont(font);
+ text->setFont(font);
+ if(!(font.toString().isEmpty())) {
+ memset(config.debugwindow_font, 0x00, sizeof(config.debugwindow_font));
+ snprintf(config.debugwindow_font, sizeof(config.debugwindow_font) - 1, "%s", font.toString().toLocal8Bit().constData());
+ }
+}
+
+void CSP_Debugger_Tmpl::rise_font_dialog(void)
+{
+ QFontDialog *dlg = new QFontDialog(text->font(), this);
+ connect(dlg, SIGNAL(fontSelected(const QFont)), this, SLOT(set_font(const QFont)));
+ dlg->show();
+}
+
+
+void CSP_Debugger_Tmpl::resizeEvent(QResizeEvent *event)
+{
+ QSize s = event->size();
+ int width = s.width();
+ int height = s.height();
+ if(width < 320) width = 320;
+ if(height < 200) height = 200;
+ config.debugwindow_height = height;
+ config.debugwindow_width = width;
+}
CSP_Debugger_Tmpl::CSP_Debugger_Tmpl(OSD_BASE* p_osd, QWidget *parent) : QWidget(parent, Qt::Window)
{
text_command->setReadOnly(false);
text_command->setEnabled(true);
text_command->clear();
-
+ call_font_dialog = new QPushButton(QApplication::translate("Debugger", "Set Font", 0),this);
+ if(strlen(config.debugwindow_font) > 0) {
+ QFont font;
+ font.fromString(QString::fromLocal8Bit(config.debugwindow_font));
+ text->setFont(font);
+ text_command->setFont(font);
+ }
complete_list.clear();
connect(this, SIGNAL(sig_apply_complete_list(QStringList)), text_command, SLOT(setCompleteList(QStringList)));
+ connect(call_font_dialog, SIGNAL(pressed()), this, SLOT(rise_font_dialog()));
connect(p_osd, SIGNAL(sig_apply_dbg_completion_list()), this, SLOT(apply_complete_list()));
connect(p_osd, SIGNAL(sig_clear_dbg_completion_list()), this, SLOT(clear_complete_list()));
connect(p_osd, SIGNAL(sig_add_dbg_completion_list(_TCHAR *)), this, SLOT(add_complete_list(_TCHAR *)));
-
- VBoxWindow = new QVBoxLayout;
+ VBoxWindow = new QVBoxLayout;
+ TailButtons = new QHBoxLayout;
+
+ TailButtons->setAlignment(Qt::AlignRight);
+ TailButtons->addStretch();
+ TailButtons->addWidget(call_font_dialog);
+ VBoxWindow->addLayout(TailButtons);
VBoxWindow->addWidget(text);
VBoxWindow->addWidget(text_command);
+
+ int w = config.debugwindow_width;
+ int h = config.debugwindow_height;
+ if(w < 320) w = 320;
+ if(h < 200) h = 200;
+
this->setLayout(VBoxWindow);
- this->resize(640, 500);
+ this->resize(w, h);
}
#include <QMetaObject>
#include <QThread>
#include <QWidget>
-#include <QPlainTextEdit>
#include <QString>
#include <QStringList>
-#include <QVBoxLayout>
-#include <QTimer>
-#include <QCloseEvent>
#include <list>
#include <string>
QT_BEGIN_NAMESPACE
+class QTextEdit;
+class QVBoxLayout;
+class QHBoxLayout;
+class QPushButton;
+class QFontDialog;
+class QResizeEvent;
+
class CSP_DebuggerThread;
class QLineEditPlus;
class OSD_BASE;
QWidget *widget;
QTextEdit *text;
QLineEditPlus *text_command;
+ QPushButton *call_font_dialog;
+ QFontDialog *font_dialog;
QVBoxLayout *VBoxWindow;
+ QHBoxLayout *TailButtons;
bool string_is_strong;
QString text_color;
~CSP_Debugger_Tmpl();
//virtual void closeEvent(QCloseEvent *event);
QStringList &get_complete_list();
+ virtual void resizeEvent(QResizeEvent *event);
public slots:
void stop_polling();
void put_string(QString);
void clear_complete_list();
void apply_complete_list();
-
+ void set_font(const QFont &font);
+ void rise_font_dialog();
signals:
void sig_put_string(QString);
void sig_run_command(QString);