aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-01-24 14:30:18 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-01-24 14:30:18 +0100
commita6b39c1d4f0ee0c9d6ffae14de20188d1dedb2ea (patch)
tree99e67be3e1c04f05af11b362a0c61c01c3883826
parent6b85266e869630fd642476dfd05627109b2cc7e3 (diff)
added hdid implementation for linux and did more work on courtroom
-rw-r--r--aoapplication.h4
-rw-r--r--aoimage.cpp1
-rw-r--r--courtroom.cpp58
-rw-r--r--courtroom.h3
-rw-r--r--hardware_functions.cpp40
-rw-r--r--hardware_functions.h10
-rw-r--r--lobby.cpp1
-rw-r--r--path_functions.cpp1
8 files changed, 90 insertions, 28 deletions
diff --git a/aoapplication.h b/aoapplication.h
index 77d7af01..3dfd8136 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -64,14 +64,14 @@ public:
void set_user_theme();
QString get_user_theme() {return user_theme;}
- //path functions
+ //implementation in path_functions.cpp
QString get_base_path();
QString get_theme_path();
QString get_default_theme_path();
QString get_character_path(QString p_character);
QString get_demothings_path();
- //text file functions
+ //implementation in text_file_functions.cpp
QString read_user_theme();
void write_to_serverlist_txt(QString p_line);
QVector<server_type> read_serverlist_txt();
diff --git a/aoimage.cpp b/aoimage.cpp
index 2e09f6a0..bfe11420 100644
--- a/aoimage.cpp
+++ b/aoimage.cpp
@@ -1,6 +1,5 @@
#include "file_functions.h"
#include "path_functions.h"
-#include "global_variables.h"
#include "aoimage.h"
diff --git a/courtroom.cpp b/courtroom.cpp
index f0ad216e..49a1b238 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -1,9 +1,9 @@
#include "courtroom.h"
#include "aoapplication.h"
+#include "lobby.h"
#include "text_file_functions.h"
#include "path_functions.h"
-#include "global_variables.h"
#include <QDebug>
@@ -73,9 +73,17 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_text_color = new QComboBox(this);
- ui_music_slider = new QSlider(this);
- ui_sfx_slider = new QSlider(this);
- ui_blip_slider = new QSlider(this);
+ ui_music_slider = new QSlider(Qt::Horizontal, this);
+ ui_music_slider->setRange(0, 100);
+ ui_music_slider->setValue(50);
+
+ ui_sfx_slider = new QSlider(Qt::Horizontal, this);
+ ui_sfx_slider->setRange(0, 100);
+ ui_music_slider->setValue(50);
+
+ ui_blip_slider = new QSlider(Qt::Horizontal, this);
+ ui_blip_slider->setRange(0, 100);
+ ui_music_slider->setValue(50);
ui_muted = new AOImage(this, ao_app);
@@ -98,8 +106,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_char_button_list.append(new AOCharButton(ui_char_select_background, ao_app));
}
- ui_char_select_background->hide();
-
ui_selector = new AOImage(ui_char_select_background, ao_app);
ui_back_to_lobby = new AOButton(ui_char_select_background, ao_app);
@@ -108,10 +114,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_spectator = new AOButton(ui_char_select_background, ao_app);
+ connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked()));
+
connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked()));
connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
+ connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked()));
+
set_widgets();
}
@@ -148,7 +158,10 @@ void Courtroom::set_widgets()
//emote buttons
set_size_and_pos(ui_emote_left, "emote_left");
+ ui_emote_left->set_image("arrow_left.png");
+
set_size_and_pos(ui_emote_right, "emote_right");
+ ui_emote_right->set_image("arrow_right.png");
set_size_and_pos(ui_defense_bar, "defense_bar");
set_size_and_pos(ui_prosecution_bar, "prosecution_bar");
@@ -167,25 +180,43 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_cross_examination, "cross_examination");
set_size_and_pos(ui_change_character, "change_character");
+ ui_change_character->setText("Change character");
set_size_and_pos(ui_reload_theme, "reload_theme");
ui_reload_theme->setText("Reload theme");
set_size_and_pos(ui_call_mod, "call_mod");
+ ui_call_mod->setText("Call mod");
set_size_and_pos(ui_pre, "pre");
+ ui_pre->setText("Pre");
+
set_size_and_pos(ui_flip, "flip");
+ ui_flip->setText("Flip");
+
set_size_and_pos(ui_guard, "guard");
+ ui_guard->setText("Guard");
set_size_and_pos(ui_custom_objection, "custom_objection");
+ ui_custom_objection->set_image("custom.png");
+
set_size_and_pos(ui_realization, "realization");
- set_size_and_pos(ui_mute, "mute");
+ ui_realization->set_image("realization.png");
+
+ set_size_and_pos(ui_mute, "mute_button");
+ ui_mute->set_image("mute.png");
set_size_and_pos(ui_defense_plus, "defense_plus");
+ ui_defense_plus->set_image("defplus.png");
+
set_size_and_pos(ui_defense_minus, "defense_minus");
+ ui_defense_minus->set_image("defminus.png");
set_size_and_pos(ui_prosecution_plus, "prosecution_plus");
+ ui_prosecution_plus->set_image("proplus.png");
+
set_size_and_pos(ui_prosecution_minus, "prosecution_minus");
+ ui_prosecution_minus->set_image("prominus.png");
set_size_and_pos(ui_text_color, "text_color");
@@ -213,7 +244,7 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_char_password, "char_password");
- ui_spectator->setText("spectator");
+ ui_spectator->setText("Spectator");
set_size_and_pos(ui_spectator, "spectator");
}
@@ -242,6 +273,11 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
p_widget->resize(design_ini_result.width, design_ini_result.height);
}
+void Courtroom::on_change_character_clicked()
+{
+ ui_char_select_background->show();
+}
+
void Courtroom::on_reload_theme_clicked()
{
ao_app->set_user_theme();
@@ -252,9 +288,15 @@ void Courtroom::on_reload_theme_clicked()
void Courtroom::on_back_to_lobby_clicked()
{
ao_app->construct_lobby();
+ ao_app->w_lobby->list_servers();
ao_app->destruct_courtroom();
}
+void Courtroom::on_spectator_clicked()
+{
+ ui_char_select_background->hide();
+}
+
Courtroom::~Courtroom()
{
diff --git a/courtroom.h b/courtroom.h
index dee5401d..ab78c04a 100644
--- a/courtroom.h
+++ b/courtroom.h
@@ -121,10 +121,13 @@ private:
AOButton *ui_spectator;
private slots:
+ void on_change_character_clicked();
void on_reload_theme_clicked();
void on_back_to_lobby_clicked();
+ void on_spectator_clicked();
+
};
#endif // COURTROOM_H
diff --git a/hardware_functions.cpp b/hardware_functions.cpp
index ce6e35a6..e755c246 100644
--- a/hardware_functions.cpp
+++ b/hardware_functions.cpp
@@ -1,6 +1,10 @@
#include "hardware_functions.h"
+#include <QDebug>
+
#if (defined (_WIN32) || defined (_WIN64))
+#include <windows.h>
+
DWORD dwVolSerial;
BOOL bIsRetrieved;
@@ -11,24 +15,44 @@ QString get_hdid()
if (bIsRetrieved)
return QString::number(dwVolSerial, 16);
else
- return "invalid_windows_hd"; //what could possibly go wrong
+ return "gxsps32sa9fnwic92mfbs0"; //what could possibly go wrong
}
#elif (defined (LINUX) || defined (__linux__))
+#include <QFile>
+#include <QTextStream>
+
QString get_hdid()
{
- //T0D0: add linux implementation
- return "linux_os_hdid";
+ QFile fstab_file("/etc/fstab");
+ if (!fstab_file.open(QIODevice::ReadOnly))
+ //literally a random string.... what else are we supposed to do?
+ return "gxcps32sa9fnwic92mfbs0";
+
+ QTextStream in(&fstab_file);
+
+ while(!in.atEnd())
+ {
+ QString line = in.readLine();
+
+ if (line.startsWith("UUID"))
+ {
+ QStringList line_elements = line.split("=");
+
+ if (line_elements.size() > 1)
+ return line_elements.at(1).left(23).trimmed();
+ }
+ }
+
+ qDebug() << "wew";
+ return "gxcpz32sa9fnwic92mfbs0";
}
#else
-QString get_hdid()
-{
- //T0D0: find a sane way to handle this
- return "unknown_os_hdid";
-}
+//throwing compile-time errors professionally
+fhasdfuifhidfhasjkfasdkfahsdj
#endif
diff --git a/hardware_functions.h b/hardware_functions.h
index 7508a5a6..3fcb27cb 100644
--- a/hardware_functions.h
+++ b/hardware_functions.h
@@ -1,14 +1,10 @@
-#ifndef WIN32_FUNCTIONS_H
-#define WIN32_FUNCTIONS_H
+#ifndef HARDWARE_FUNCTIONS_H
+#define HARDWARE_FUNCTIONS_H
#include <QString>
-#ifdef Q_OS_WIN32
-#include <windows.h>
-#endif // Q_OS_WIN32
-
#include <stdio.h>
QString get_hdid();
-#endif // WIN32_FUNCTIONS_H
+#endif // HARDWARE_FUNCTIONS_H
diff --git a/lobby.cpp b/lobby.cpp
index 414ce933..04ec4f99 100644
--- a/lobby.cpp
+++ b/lobby.cpp
@@ -2,7 +2,6 @@
#include "path_functions.h"
#include "text_file_functions.h"
-#include "global_variables.h"
#include "debug_functions.h"
#include "aoapplication.h"
#include "networkmanager.h"
diff --git a/path_functions.cpp b/path_functions.cpp
index 46f80ef3..7afd923a 100644
--- a/path_functions.cpp
+++ b/path_functions.cpp
@@ -1,6 +1,5 @@
#include "aoapplication.h"
-#include "global_variables.h"
#include "text_file_functions.h"
#include <QDir>