Reverted qss stuff and added more comments

This commit is contained in:
David Skoland 2018-02-12 01:43:25 +01:00 committed by oldmud0
parent 34a4519d1e
commit 4eba53ebb2
4 changed files with 71 additions and 31 deletions

View File

@ -89,8 +89,7 @@ public:
//reads the theme from config.ini and sets it accordingly //reads the theme from config.ini and sets it accordingly
void reload_theme(); void reload_theme();
//QString get_theme() {return current_theme;} //Returns the character the player has currently selected
QString get_current_char(); QString get_current_char();
//implementation in path_functions.cpp //implementation in path_functions.cpp
@ -106,42 +105,109 @@ public:
QString get_default_background_path(); QString get_default_background_path();
QString get_evidence_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); QString read_config(QString searchline);
//Reads the theme from config.ini and loads it into the current_theme variable
QString read_theme(); QString read_theme();
//Returns the blip rate from config.ini
int read_blip_rate(); int read_blip_rate();
//Returns true if blank blips is enabled in config.ini and false otherwise
bool get_blank_blip(); bool get_blank_blip();
//Returns the value of default_music in config.ini
int get_default_music(); int get_default_music();
//Returns the value of default_sfx in config.ini
int get_default_sfx(); int get_default_sfx();
//Returns the value of default_blip in config.ini
int get_default_blip(); int get_default_blip();
//Returns the list of words in callwords.ini
QStringList get_call_words(); QStringList get_call_words();
//Appends the argument string to serverlist.txt
void write_to_serverlist_txt(QString p_line); void write_to_serverlist_txt(QString p_line);
//Returns the contents of serverlist.txt
QVector<server_type> read_serverlist_txt(); QVector<server_type> 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); 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); 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); 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); 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); 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); 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); 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); QString get_char_side(QString p_char);
//Returns the showname from the ini of p_char
QString get_showname(QString 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); 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); 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); 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); int get_ao2_preanim_duration(QString p_char, QString p_emote);
//Not in use
int get_text_delay(QString p_char, QString p_emote); int get_text_delay(QString p_char, QString p_emote);
//Returns the name of p_char
QString get_char_name(QString 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); 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); 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); 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); 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); QString get_sfx_name(QString p_char, int p_emote);
//Not in use
int get_sfx_delay(QString p_char, int p_emote); 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); 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); int get_desk_mod(QString p_char, int p_emote);
//Returns p_char's gender
QString get_gender(QString p_char); QString get_gender(QString p_char);
private: private:

View File

@ -4,7 +4,6 @@
#include "aoapplication.h" #include "aoapplication.h"
#include "networkmanager.h" #include "networkmanager.h"
#include "aosfxplayer.h" #include "aosfxplayer.h"
#include "file_functions.h"
#include <QDebug> #include <QDebug>
#include <QScrollBar> #include <QScrollBar>
@ -52,22 +51,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed())); connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed()));
connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled())); connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
//set_widgets(); 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"));
} }
//sets images, position and size //sets images, position and size

View File

@ -23,7 +23,6 @@ class Lobby : public QMainWindow
public: public:
Lobby(AOApplication *p_ao_app); Lobby(AOApplication *p_ao_app);
void set_theme();
void set_widgets(); void set_widgets();
void list_servers(); void list_servers();
void list_favorites(); void list_favorites();

View File

@ -8,15 +8,6 @@
#include <QDebug> #include <QDebug>
#include <QColor> #include <QColor>
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 AOApplication::read_config(QString searchline)
{ {
QString return_value = ""; QString return_value = "";