stylesheets: make toolbar styles more accessible

This commit is contained in:
Megamouse 2017-08-15 22:59:40 +02:00 committed by Ani
parent a18fddb831
commit a0176775ff
7 changed files with 26 additions and 64 deletions

View File

@ -287,7 +287,11 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
QFile file(sheetFilePath);
if (sheetFilePath == "")
{
setStyleSheet("QWidget#header_section {background-color: #ffffff}");
setStyleSheet(
"QWidget#header_section { background-color: #ffffff; }"
"QLineEdit#mw_searchbar { margin-left:14px; }"
"QLineEdit#tb_searchbar { background: transparent; }"
);
}
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{

View File

@ -112,9 +112,6 @@
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>RPCS3 PlayStation 3 Emulator</string>
</property>
@ -131,9 +128,6 @@
<kerning>true</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;RPCS3 is an open-source Sony PlayStation 3 emulator and debugger.&lt;br/&gt;It is written in C++ for Windows and Linux funded with &lt;a href=&quot;https://www.patreon.com/Nekotekina&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Patreon&lt;/span&gt;&lt;/a&gt;.&lt;br/&gt;Our developers and contributors are always working hard to ensure this project can be the best that it can be.&lt;br/&gt;There are still plenty of implementations to be made and optimizations to be done.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -159,9 +153,6 @@
<kerning>true</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>

View File

@ -104,11 +104,10 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, const R
// Search Bar
m_Search_Bar = new QLineEdit(m_Tool_Bar);
m_Search_Bar->setObjectName("tb_searchbar");
m_Search_Bar->setObjectName("tb_searchbar"); // used in default stylesheet
m_Search_Bar->setPlaceholderText(tr("Search games ..."));
m_Search_Bar->setMinimumWidth(m_Tool_Bar->height() * 5);
m_Search_Bar->setFrame(false);
m_Search_Bar->setStyleSheet("QLineEdit#tb_searchbar { background: transparent }");
connect(m_Search_Bar, &QLineEdit::textChanged, [this](const QString& text) {
m_searchText = text;
Refresh();
@ -842,7 +841,7 @@ void game_list_frame::RepaintToolBarIcons()
m_modeActGrid.colored = gui_settings::colorizedIcon(QIcon(":/Icons/grid_blue.png"), GUI::gl_tool_icon_color, newColor);
m_modeActGrid.action->setIcon(m_isListLayout ? m_modeActGrid.gray : m_modeActGrid.colored);
m_Slider_Size->setStyleSheet(QString("QSlider::handle:horizontal{ background: rgba(%1, %2, %3, %4); }")
m_Slider_Size->setStyleSheet(m_Slider_Size->styleSheet().append("QSlider::handle:horizontal{ background: rgba(%1, %2, %3, %4); }")
.arg(newColor.red()).arg(newColor.green()).arg(newColor.blue()).arg(newColor.alpha()));
}

View File

@ -79,7 +79,7 @@ void main_window::Init()
ui->sizeSlider->setSliderPosition(guiSettings->GetValue(GUI::gl_iconSize).toInt());
ui->toolBar->addWidget(ui->sizeSliderContainer);
ui->toolBar->addSeparator();
ui->toolBar->addWidget(ui->searchBar);
ui->toolBar->addWidget(ui->mw_searchbar);
// for highdpi resize toolbar icons and height dynamically
// choose factors to mimic Gui-Design in main_window.ui
@ -735,7 +735,7 @@ void main_window::RepaintToolBarIcons()
ui->toolbar_fullscreen->setIcon(icon_fullscreen_off);
}
ui->sizeSlider->setStyleSheet(QString("QSlider::handle:horizontal{ background: rgba(%1, %2, %3, %4); }")
ui->sizeSlider->setStyleSheet(ui->sizeSlider->styleSheet().append("QSlider::handle:horizontal{ background: rgba(%1, %2, %3, %4); }")
.arg(newColor.red()).arg(newColor.green()).arg(newColor.blue()).arg(newColor.alpha()));
}
@ -1024,6 +1024,18 @@ void main_window::AddRecentAction(const q_string_pair& entry)
guiSettings->SetValue(GUI::rg_entries, guiSettings->List2Var(m_rg_entries));
}
void main_window::RepaintToolbar()
{
QColor tbc = guiSettings->GetValue(GUI::mw_toolBarColor).value<QColor>();
ui->toolBar->setStyleSheet(styleSheet().append(
"QToolBar { background-color: rgba(%1, %2, %3, %4); }"
"QToolBar::separator {background-color: rgba(%5, %6, %7, %8); width: 1px; margin-top: 2px; margin-bottom: 2px;}"
"QSlider { background-color: rgba(%1, %2, %3, %4); }"
"QLineEdit { background-color: rgba(%1, %2, %3, %4); }")
.arg(tbc.red()).arg(tbc.green()).arg(tbc.blue()).arg(tbc.alpha())
.arg(tbc.red() - 20).arg(tbc.green() - 20).arg(tbc.blue() - 20).arg(tbc.alpha() - 20));
}
void main_window::CreateActions()
{
ui->exitAct->setShortcuts(QKeySequence::Quit);
@ -1105,14 +1117,7 @@ void main_window::CreateConnects()
connect(&dlg, &settings_dialog::ToolBarRepaintRequest, gameListFrame, &game_list_frame::RepaintToolBarIcons);
connect(&dlg, &settings_dialog::accepted, [this](){
gameListFrame->RepaintIcons(guiSettings->GetValue(GUI::gl_iconColor).value<QColor>());
QColor tbc = guiSettings->GetValue(GUI::mw_toolBarColor).value<QColor>();
ui->toolBar->setStyleSheet(QString(
"QToolBar { background-color: rgba(%1, %2, %3, %4); }"
"QToolBar::separator {background-color: rgba(%5, %6, %7, %8); width: 1px; margin-top: 2px; margin-bottom: 2px;}"
"QSlider { background-color: rgba(%1, %2, %3, %4); }"
"QLineEdit { background-color: rgba(%1, %2, %3, %4); }")
.arg(tbc.red()).arg(tbc.green()).arg(tbc.blue()).arg(tbc.alpha())
.arg(tbc.red() - 20).arg(tbc.green() - 20).arg(tbc.blue() - 20).arg(tbc.alpha() - 20));
RepaintToolbar();
});
dlg.exec();
};
@ -1287,7 +1292,7 @@ void main_window::CreateConnects()
m_save_slider_pos = true; // actionTriggered happens before the value was changed
}
});
connect(ui->searchBar, &QLineEdit::textChanged, gameListFrame, &game_list_frame::SetSearchText);
connect(ui->mw_searchbar, &QLineEdit::textChanged, gameListFrame, &game_list_frame::SetSearchText);
}
void main_window::CreateDockWindows()
@ -1400,14 +1405,7 @@ void main_window::ConfigureGuiFromSettings(bool configureAll)
gameListFrame->SetToolBarVisible(ui->showGameToolBarAct->isChecked());
ui->toolBar->setVisible(ui->showToolBarAct->isChecked());
QColor tbc = guiSettings->GetValue(GUI::mw_toolBarColor).value<QColor>();
ui->toolBar->setStyleSheet(QString(
"QToolBar { background-color: rgba(%1, %2, %3, %4); }"
"QToolBar::separator {background-color: rgba(%5, %6, %7, %8); width: 1px; margin-top: 2px; margin-bottom: 2px;}"
"QSlider { background-color: rgba(%1, %2, %3, %4); }"
"QLineEdit { background-color: rgba(%1, %2, %3, %4); }")
.arg(tbc.red()).arg(tbc.green()).arg(tbc.blue()).arg(tbc.alpha())
.arg(tbc.red() - 20).arg(tbc.green() - 20).arg(tbc.blue() - 20).arg(tbc.alpha() - 20));
RepaintToolbar();
ui->showCatHDDGameAct->setChecked(guiSettings->GetCategoryVisibility(Category::Non_Disc_Game));
ui->showCatDiscGameAct->setChecked(guiSettings->GetCategoryVisibility(Category::Disc_Game));

View File

@ -87,6 +87,7 @@ protected:
void mouseDoubleClickEvent(QMouseEvent *event) override;
void SetAppIconFromPath(const std::string path);
private:
void RepaintToolbar();
void CreateActions();
void CreateConnects();
void CreateDockWindows();

View File

@ -44,7 +44,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLineEdit" name="searchBar">
<widget class="QLineEdit" name="mw_searchbar">
<property name="geometry">
<rect>
<x>480</x>
@ -69,10 +69,6 @@
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="styleSheet">
<string notr="true">color:#5e5e5e;
margin-left:14px;</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
@ -295,12 +291,6 @@ margin-left:14px;</string>
<property name="windowTitle">
<string>Show tool bar</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar { background-color: rgba(227, 227, 227, 255); }
QToolBar::separator {background-color: #D1D1D1; width: 1px; margin-top: 2px; margin-bottom: 2px;}
QSlider { background-color: rgba(227, 227, 227, 255); }
QLineEdit { background-color: rgba(227, 227, 227, 255); }</string>
</property>
<property name="movable">
<bool>false</bool>
</property>

View File

@ -23,12 +23,6 @@
<iconset resource="../resources.qrc">
<normaloff>:/rpcs3.ico</normaloff>:/rpcs3.ico</iconset>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
@ -120,9 +114,6 @@
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>RPCS3 PlayStation 3 Emulator</string>
</property>
@ -185,9 +176,6 @@
<kerning>true</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;To get started, you must first install the &lt;span style=&quot; font-weight:600;&quot;&gt;PlayStation 3 firmware&lt;/span&gt;.&lt;br/&gt;Please refer to the &lt;a href=&quot;https://rpcs3.net/quickstart&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Quickstart&lt;/span&gt;&lt;/a&gt; guide found on the official website for further information.&lt;br/&gt;If you have any further questions, please refer to the &lt;a href=&quot;https://rpcs3.net/faq&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;FAQ&lt;/span&gt;&lt;/a&gt;.&lt;br/&gt;Otherwise, further discussion and support can be found on the &lt;a href=&quot;http://www.emunewz.net/forum/forumdisplay.php?fid=172&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Forums&lt;/span&gt;&lt;/a&gt; or on our &lt;a href=&quot;https://discord.me/RPCS3&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Discord&lt;/span&gt;&lt;/a&gt; server.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -215,9 +203,6 @@
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;RPCS3 does not condone piracy. You must dump your own games.&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -265,9 +250,6 @@
</item>
<item alignment="Qt::AlignLeft">
<widget class="QCheckBox" name="i_have_read">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>I have read the Quickstart guide</string>
</property>
@ -288,9 +270,6 @@
</item>
<item alignment="Qt::AlignLeft">
<widget class="QCheckBox" name="do_not_show">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Do not show again</string>
</property>