Skip to content

Commit 679dcca

Browse files
Remove hardcoded stylesheets from lobby
Stop doing the "tagget stylesheets" monstrosity
1 parent 354fbd2 commit 679dcca

2 files changed

Lines changed: 4 additions & 28 deletions

File tree

include/lobby.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Lobby : public QMainWindow {
3333
void append_chatmessage(QString f_name, QString f_message);
3434
void append_error(QString f_message);
3535
void set_player_count(int players_online, int max_players);
36-
void set_stylesheet(QWidget *widget, QString target_tag);
36+
void set_stylesheet(QWidget *widget);
3737
void set_stylesheets();
3838
void set_fonts();
3939
void set_font(QWidget *widget, QString p_identifier);

src/lobby.cpp

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -142,36 +142,21 @@ void Lobby::set_widgets()
142142
tr("Allows you to change various aspects of the client."));
143143

144144
set_size_and_pos(ui_server_list, "server_list");
145-
ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
146-
"font: bold;");
147145

148146
set_size_and_pos(ui_server_search, "server_search");
149-
ui_server_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
150147

151148
set_size_and_pos(ui_player_count, "player_count");
152149
ui_player_count->setText(tr("Offline"));
153-
ui_player_count->setStyleSheet("font: bold;"
154-
"color: white;"
155-
"qproperty-alignment: AlignCenter;");
156150

157151
set_size_and_pos(ui_description, "description");
158152
ui_description->setReadOnly(true);
159-
ui_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
160-
"color: white;");
161153

162154
set_size_and_pos(ui_chatbox, "chatbox");
163155
ui_chatbox->setReadOnly(true);
164-
ui_chatbox->setStyleSheet(
165-
"QTextBrowser{background-color: rgba(0, 0, 0, 0);}");
166156

167157
set_size_and_pos(ui_chatname, "chatname");
168-
ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
169-
"selection-background-color: rgba(0, 0, 0, 0);");
170158

171159
set_size_and_pos(ui_chatmessage, "chatmessage");
172-
ui_chatmessage->setStyleSheet(
173-
"background-color: rgba(0, 0, 0, 0);"
174-
"selection-background-color: rgba(0, 0, 0, 0);");
175160

176161
ui_loading_background->resize(this->width(), this->height());
177162
ui_loading_background->set_image("loadingbackground");
@@ -181,8 +166,6 @@ void Lobby::set_widgets()
181166
ui_loading_text->setReadOnly(true);
182167
ui_loading_text->setAlignment(Qt::AlignCenter);
183168
ui_loading_text->setFrameStyle(QFrame::NoFrame);
184-
ui_loading_text->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
185-
"color: rgba(255, 128, 0, 255);");
186169
ui_loading_text->append(tr("Loading"));
187170

188171
set_size_and_pos(ui_progress_bar, "progress_bar");
@@ -223,24 +206,17 @@ void Lobby::set_fonts()
223206
set_font(ui_server_list, "server_list");
224207
}
225208

226-
void Lobby::set_stylesheet(QWidget *widget, QString target_tag)
209+
void Lobby::set_stylesheet(QWidget *widget)
227210
{
228211
QString f_file = "lobby_stylesheets.css";
229-
QString style_sheet_string =
230-
ao_app->get_tagged_stylesheet(target_tag, f_file);
212+
QString style_sheet_string = ao_app->get_stylesheet(f_file);
231213
if (style_sheet_string != "")
232214
widget->setStyleSheet(style_sheet_string);
233215
}
234216

235217
void Lobby::set_stylesheets()
236218
{
237-
set_stylesheet(ui_player_count, "[PLAYER COUNT]");
238-
set_stylesheet(ui_description, "[DESCRIPTION]");
239-
set_stylesheet(ui_chatbox, "[CHAT BOX]");
240-
set_stylesheet(ui_chatname, "[CHAT NAME]");
241-
set_stylesheet(ui_chatmessage, "[CHAT MESSAGE]");
242-
set_stylesheet(ui_loading_text, "[LOADING TEXT]");
243-
set_stylesheet(ui_server_list, "[SERVER LIST]");
219+
set_stylesheet(this);
244220
}
245221

246222
void Lobby::set_font(QWidget *widget, QString p_identifier)

0 commit comments

Comments
 (0)