Qt: include debug tool colors in stylesheet (#3527)

Qt: include debug tool colors in stylesheet
This commit is contained in:
Megamouse 2017-10-05 00:10:24 +02:00 committed by Ani
parent b338c81907
commit cf83b796e1
11 changed files with 99 additions and 34 deletions

View File

@ -291,3 +291,40 @@ QTextEdit#tty_frame {
QLabel#tty_text {
color: #ffffff; /* White */
}
/* RSX Debugger */
QLabel#rsx_debugger_display_buffer {
background-color: #323232;
}
/* Kernel Explorer */
QDialog#kernel_explorer {
background-color: #323232;
}
/* Memory Viewer */
QDialog#memory_viewer {
background-color: #323232;
}
QLabel#memory_viewer_address_panel {
color: #00cbff; /* Font Color: Blue */
background-color: #323232;
}
QLabel#memory_viewer_hex_panel {
color: #bdc3c7; /* Font Color: Grey */
background-color: #323232;
}
QLabel#memory_viewer_ascii_panel {
color: #bdc3c7; /* Font Color: Grey */
background-color: #323232;
}
/* Debugger colors */
QLabel#debugger_frame_breakpoint {
color: #000000; /* Font Color: Black */
background-color: #ffff00; /* Yellow */
}
QLabel#debugger_frame_pc {
color: #000000; /* Font Color: Black */
background-color: #00ff00; /* Green */
}

View File

@ -336,6 +336,14 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
QString style_rest = QString
(
"QWidget#header_section { background-color: #ffffff; }"
"QDialog#kernel_explorer { background-color: rgba(240, 240, 240, 255); }"
"QDialog#memory_viewer { background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_address_panel { color: rgba(75, 135, 150, 255); background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_hex_panel { color: #000000; background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_ascii_panel { color: #000000; background-color: rgba(240, 240, 240, 255); }"
"QLabel#debugger_frame_breakpoint { color: #000000; background-color: #ffff00; }"
"QLabel#debugger_frame_pc { color: #000000; background-color: #00ff00; }"
"QLabel#rsx_debugger_display_buffer { background-color: rgba(240, 240, 240, 255); }"
"QLabel#l_controller { color: #434343; }"
"QLabel#gamegrid_font { font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }"
);

View File

@ -40,6 +40,7 @@ debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *
m_btn_run = new QPushButton(Run, this);
EnableButtons(!Emu.IsStopped());
ChangeColors();
hbox_b_main->addWidget(m_go_to_addr);
hbox_b_main->addWidget(m_go_to_pc);
@ -125,6 +126,17 @@ void debugger_frame::SaveSettings()
xgui_settings->SetValue(GUI::d_splitterState, m_splitter->saveState());
}
void debugger_frame::ChangeColors()
{
if (m_list)
{
m_list->m_color_bp = GUI::get_Label_Color("debugger_frame_breakpoint", QPalette::Background);
m_list->m_color_pc = GUI::get_Label_Color("debugger_frame_pc", QPalette::Background);
m_list->m_text_color_bp = GUI::get_Label_Color("debugger_frame_breakpoint");;
m_list->m_text_color_pc = GUI::get_Label_Color("debugger_frame_pc");;
}
}
void debugger_frame::closeEvent(QCloseEvent *event)
{
QDockWidget::closeEvent(event);
@ -501,18 +513,21 @@ void debugger_list::ShowAddr(u32 addr)
item(i)->setText((IsBreakPoint(m_pc) ? ">>> " : " ") + qstr(m_debugFrame->m_disasm->last_opcode));
QColor colour;
if (test(cpu->state & cpu_state_pause) && m_pc == m_debugFrame->GetPc())
{
colour = QColor(Qt::green);
item(i)->setTextColor(m_text_color_pc);
item(i)->setBackgroundColor(m_color_pc);
}
else if (IsBreakPoint(m_pc))
{
item(i)->setTextColor(m_text_color_bp);
item(i)->setBackgroundColor(m_color_bp);
}
else
{
colour = QColor(IsBreakPoint(m_pc) ? Qt::yellow : Qt::white);
item(i)->setTextColor(palette().color(foregroundRole()));
item(i)->setBackgroundColor(palette().color(backgroundRole()));
}
item(i)->setBackgroundColor(colour);
}
}

View File

@ -68,6 +68,7 @@ public:
public:
explicit debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *parent = 0);
void SaveSettings();
void ChangeColors();
void UpdateUI();
void UpdateUnitList();
@ -108,6 +109,10 @@ public:
u32 m_pc;
u32 m_item_count;
bool m_no_thread_selected;
QColor m_color_bp;
QColor m_color_pc;
QColor m_text_color_bp;
QColor m_text_color_pc;
public:
debugger_list(debugger_frame* parent);

View File

@ -1,5 +1,6 @@
#include "game_list_grid.h"
#include "game_list_grid_delegate.h"
#include "gui_settings.h"
#include <QHeaderView>
#include <QLabel>
@ -18,11 +19,8 @@ game_list_grid::game_list_grid(const QSize& icon_size, const QColor& icon_color,
}
// font by stylesheet
QLabel font_dummy;
font_dummy.setObjectName("gamegrid_font");
font_dummy.ensurePolished();
QFont font = font_dummy.font();
QColor font_color = font_dummy.palette().color(QPalette::Foreground);
QFont font = GUI::get_Label_Font("gamegrid_font");
QColor font_color = GUI::get_Label_Color("gamegrid_font");
grid_item_delegate = new game_list_grid_delegate(item_size, m_margin_factor, m_text_factor, font, font_color, this);
setItemDelegate(grid_item_delegate);

View File

@ -63,6 +63,14 @@ namespace GUI
return dummy_color.palette().color(colorRole);
};
inline QFont get_Label_Font(const QString& objectName)
{
QLabel dummy_font;
dummy_font.setObjectName(objectName);
dummy_font.ensurePolished();
return dummy_font.font();
};
inline QString get_Single_Line(const QString& multi_line_string)
{
QString single_line_string = multi_line_string;

View File

@ -28,11 +28,9 @@
kernel_explorer::kernel_explorer(QWidget* parent) : QDialog(parent)
{
setWindowTitle(tr("Kernel Explorer"));
setObjectName("kernel_explorer");
setAttribute(Qt::WA_DeleteOnClose);
setMinimumSize(QSize(700, 450));
QPalette pal;
pal.setColor(QPalette::Background, QColor(240, 240, 240));
setPalette(pal); //This fix the ugly background color under Windows
QVBoxLayout* vbox_panel = new QVBoxLayout();
QHBoxLayout* hbox_buttons = new QHBoxLayout();

View File

@ -1081,6 +1081,11 @@ void main_window::RepaintGui()
m_logFrame->RepaintTextColors();
}
if (m_debuggerFrame)
{
m_debuggerFrame->ChangeColors();
}
RepaintToolbar();
RepaintToolBarIcons();
RepaintThumbnailIcons();

View File

@ -9,6 +9,7 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
: QDialog(parent)
{
setWindowTitle(tr("Memory Viewer"));
setObjectName("memory_viewer");
setAttribute(Qt::WA_DeleteOnClose);
exit = false;
m_addr = 0;
@ -16,13 +17,10 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
m_rowcount = 16;
int pSize = 10;
//Font and Colors
//Font
QFont mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
mono.setPointSize(pSize);
m_fontMetrics = new QFontMetrics(mono);
QPalette pal_bg;
pal_bg.setColor(QPalette::Background, QColor(240, 240, 240));
setPalette(pal_bg);
//Layout:
QVBoxLayout* vbox_panel = new QVBoxLayout();
@ -138,33 +136,27 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
//Memory Panel: Address Panel
m_mem_addr = new QLabel("");
m_mem_addr->setObjectName("memory_viewer_address_panel");
m_mem_addr->setFont(mono);
m_mem_addr->setAutoFillBackground(true);
m_mem_addr->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
QPalette palette_addr = m_mem_addr->palette();
palette_addr.setColor(m_mem_addr->backgroundRole(), QColor(240, 240, 240));
palette_addr.setColor(m_mem_addr->foregroundRole(), QColor(75, 135, 150));
m_mem_addr->setPalette(palette_addr);
m_mem_addr->ensurePolished();
//Memory Panel: Hex Panel
m_mem_hex = new QLabel("");
m_mem_hex->setObjectName("memory_viewer_hex_panel");
m_mem_hex->setFont(mono);
m_mem_hex->setAutoFillBackground(true);
m_mem_hex->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
QPalette palette_hex = m_mem_hex->palette();
palette_hex.setColor(m_mem_hex->backgroundRole(), QColor(240, 240, 240));
palette_hex.setColor(m_mem_hex->foregroundRole(), Qt::black);
m_mem_hex->setPalette(palette_hex);
m_mem_hex->ensurePolished();
//Memory Panel: ASCII Panel
m_mem_ascii = new QLabel("");
m_mem_ascii->setObjectName("memory_viewer_ascii_panel");
m_mem_ascii->setFont(mono);
m_mem_ascii->setAutoFillBackground(true);
m_mem_ascii->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
QPalette palette_ascii = m_mem_ascii->palette();
palette_ascii.setColor(m_mem_ascii->backgroundRole(), QColor(240, 240, 240));
palette_ascii.setColor(m_mem_ascii->foregroundRole(), Qt::black);
m_mem_ascii->setPalette(palette_ascii);
m_mem_ascii->ensurePolished();
//Merge Memory Panel:
hbox_mem_panel->setAlignment(Qt::AlignLeft);

View File

@ -387,11 +387,10 @@ namespace
if (img.isNull()) return;
//QString title = qstr(fmt::format("Raw Image @ 0x%x", addr));
QLabel* canvas = new QLabel();
QPalette pal_bg;
pal_bg.setColor(canvas->backgroundRole(), QColor(240, 240, 240));
canvas->setPalette(pal_bg); //This fix the ugly background color under Windows
canvas->setObjectName("rsx_debugger_display_buffer");
canvas->setPixmap(QPixmap::fromImage(img));
canvas->setFixedSize(img.size());
canvas->ensurePolished();
canvas->show();
}
}

View File

@ -12,6 +12,7 @@
#include "memory_viewer_panel.h"
#include "table_item_delegate.h"
#include "gui_settings.h"
#include <QDialog>
#include <QLabel>
@ -22,7 +23,6 @@
#include <QListWidget>
#include <QTableWidget>
#include <QHeaderView>
#include <QPalette>
#include <QFont>
#include <QSignalMapper>
#include <QPixmap>