From 4eba53ebb2ca83c61af750d18e34de22ae3b5a2d Mon Sep 17 00:00:00 2001 From: David Skoland Date: Mon, 12 Feb 2018 01:43:25 +0100 Subject: [PATCH] Reverted qss stuff and added more comments --- aoapplication.h | 74 ++++++++++++++++++++++++++++++++++++++--- lobby.cpp | 18 +--------- lobby.h | 1 - text_file_functions.cpp | 9 ----- 4 files changed, 71 insertions(+), 31 deletions(-) diff --git a/aoapplication.h b/aoapplication.h index e124560..2a5c436 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -89,8 +89,7 @@ public: //reads the theme from config.ini and sets it accordingly void reload_theme(); - //QString get_theme() {return current_theme;} - + //Returns the character the player has currently selected QString get_current_char(); //implementation in path_functions.cpp @@ -106,42 +105,109 @@ public: QString get_default_background_path(); QString get_evidence_path(); - //implementation in text_file_functions.cpp + ////// Functions for reading and writing files ////// + // Implementations file_functions.cpp - QString read_file(QString p_path); + //Returns the config value for the passed searchline from a properly formatted config ini file QString read_config(QString searchline); + + //Reads the theme from config.ini and loads it into the current_theme variable QString read_theme(); + + //Returns the blip rate from config.ini int read_blip_rate(); + + //Returns true if blank blips is enabled in config.ini and false otherwise bool get_blank_blip(); + + //Returns the value of default_music in config.ini int get_default_music(); + + //Returns the value of default_sfx in config.ini int get_default_sfx(); + + //Returns the value of default_blip in config.ini int get_default_blip(); + + //Returns the list of words in callwords.ini QStringList get_call_words(); + + //Appends the argument string to serverlist.txt void write_to_serverlist_txt(QString p_line); + + //Returns the contents of serverlist.txt QVector read_serverlist_txt(); + + //Returns the value of p_identifier in the design.ini file in p_design_path QString read_design_ini(QString p_identifier, QString p_design_path); + + //Returns the coordinates of widget with p_identifier from p_file QPoint get_button_spacing(QString p_identifier, QString p_file); + + //Returns the dimensions of widget with specified identifier from p_file pos_size_type get_element_dimensions(QString p_identifier, QString p_file); + + //Returns the value of font_size with p_identifier from p_file int get_font_size(QString p_identifier, QString p_file); + + //Returns the color with p_identifier from p_file QColor get_color(QString p_identifier, QString p_file); + + //Returns the sfx with p_identifier from sounds.ini in the current theme path QString get_sfx(QString p_identifier); + + //Returns the value of p_search_line within target_tag and terminator_tag QString read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag); + + //Returns the side of the p_char character from that characters ini file QString get_char_side(QString p_char); + + //Returns the showname from the ini of p_char QString get_showname(QString p_char); + + //Returns the value of chat from the specific p_char's ini file QString get_chat(QString p_char); + + //Returns the value of shouts from the specified p_char's ini file QString get_char_shouts(QString p_char); + + //Returns the preanim duration of p_char's p_emote int get_preanim_duration(QString p_char, QString p_emote); + + //Same as above, but only returns if it has a % in front(refer to Preanims section in the manual) int get_ao2_preanim_duration(QString p_char, QString p_emote); + + //Not in use int get_text_delay(QString p_char, QString p_emote); + + //Returns the name of p_char QString get_char_name(QString p_char); + + //Returns the total amount of emotes of p_char int get_emote_number(QString p_char); + + //Returns the emote comment of p_char's p_emote QString get_emote_comment(QString p_char, int p_emote); + + //Returns the base name of p_char's p_emote QString get_emote(QString p_char, int p_emote); + + //Returns the preanimation name of p_char's p_emote QString get_pre_emote(QString p_char, int p_emote); + + //Returns the sfx of p_char's p_emote QString get_sfx_name(QString p_char, int p_emote); + + //Not in use int get_sfx_delay(QString p_char, int p_emote); + + //Returns the modifier for p_char's p_emote int get_emote_mod(QString p_char, int p_emote); + + //Returns the desk modifier for p_char's p_emote int get_desk_mod(QString p_char, int p_emote); + + //Returns p_char's gender QString get_gender(QString p_char); private: diff --git a/lobby.cpp b/lobby.cpp index 3a10439..9596939 100644 --- a/lobby.cpp +++ b/lobby.cpp @@ -4,7 +4,6 @@ #include "aoapplication.h" #include "networkmanager.h" #include "aosfxplayer.h" -#include "file_functions.h" #include #include @@ -52,22 +51,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed())); connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled())); - //set_widgets(); - set_theme(); -} - -void Lobby::set_theme() -{ - ao_app->reload_theme(); - - //check if our current theme is a valid qss theme - if (!file_exists(ao_app->get_theme_path() + "lobby.qss")) - { - set_widgets(); - return; - } - - this->setStyleSheet(ao_app->read_file(ao_app->get_theme_path() + "lobby.qss")); + set_widgets(); } //sets images, position and size diff --git a/lobby.h b/lobby.h index 20b3734..2d3aee5 100644 --- a/lobby.h +++ b/lobby.h @@ -23,7 +23,6 @@ class Lobby : public QMainWindow public: Lobby(AOApplication *p_ao_app); - void set_theme(); void set_widgets(); void list_servers(); void list_favorites(); diff --git a/text_file_functions.cpp b/text_file_functions.cpp index 2bc8903..90b10f5 100644 --- a/text_file_functions.cpp +++ b/text_file_functions.cpp @@ -8,15 +8,6 @@ #include #include -QString AOApplication::read_file(QString p_path) -{ - QFile file(p_path); - if (!file.open(QFile::ReadOnly)) - return ""; - - return file.readAll(); -} - QString AOApplication::read_config(QString searchline) { QString return_value = "";