added hdid implementation for linux and did more work on courtroom
This commit is contained in:
		
							parent
							
								
									6b85266e86
								
							
						
					
					
						commit
						a6b39c1d4f
					
				@ -64,14 +64,14 @@ public:
 | 
				
			|||||||
  void set_user_theme();
 | 
					  void set_user_theme();
 | 
				
			||||||
  QString get_user_theme() {return user_theme;}
 | 
					  QString get_user_theme() {return user_theme;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //path functions
 | 
					  //implementation in path_functions.cpp
 | 
				
			||||||
  QString get_base_path();
 | 
					  QString get_base_path();
 | 
				
			||||||
  QString get_theme_path();
 | 
					  QString get_theme_path();
 | 
				
			||||||
  QString get_default_theme_path();
 | 
					  QString get_default_theme_path();
 | 
				
			||||||
  QString get_character_path(QString p_character);
 | 
					  QString get_character_path(QString p_character);
 | 
				
			||||||
  QString get_demothings_path();
 | 
					  QString get_demothings_path();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //text file functions
 | 
					  //implementation in text_file_functions.cpp
 | 
				
			||||||
  QString read_user_theme();
 | 
					  QString read_user_theme();
 | 
				
			||||||
  void write_to_serverlist_txt(QString p_line);
 | 
					  void write_to_serverlist_txt(QString p_line);
 | 
				
			||||||
  QVector<server_type> read_serverlist_txt();
 | 
					  QVector<server_type> read_serverlist_txt();
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
#include "file_functions.h"
 | 
					#include "file_functions.h"
 | 
				
			||||||
#include "path_functions.h"
 | 
					#include "path_functions.h"
 | 
				
			||||||
#include "global_variables.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "aoimage.h"
 | 
					#include "aoimage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,9 @@
 | 
				
			|||||||
#include "courtroom.h"
 | 
					#include "courtroom.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "aoapplication.h"
 | 
					#include "aoapplication.h"
 | 
				
			||||||
 | 
					#include "lobby.h"
 | 
				
			||||||
#include "text_file_functions.h"
 | 
					#include "text_file_functions.h"
 | 
				
			||||||
#include "path_functions.h"
 | 
					#include "path_functions.h"
 | 
				
			||||||
#include "global_variables.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -73,9 +73,17 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  ui_text_color = new QComboBox(this);
 | 
					  ui_text_color = new QComboBox(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_music_slider = new QSlider(this);
 | 
					  ui_music_slider = new QSlider(Qt::Horizontal, this);
 | 
				
			||||||
  ui_sfx_slider = new QSlider(this);
 | 
					  ui_music_slider->setRange(0, 100);
 | 
				
			||||||
  ui_blip_slider = new QSlider(this);
 | 
					  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);
 | 
					  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_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_selector = new AOImage(ui_char_select_background, ao_app);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_back_to_lobby = new AOButton(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);
 | 
					  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_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_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_widgets();
 | 
					  set_widgets();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -148,7 +158,10 @@ void Courtroom::set_widgets()
 | 
				
			|||||||
  //emote buttons
 | 
					  //emote buttons
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_emote_left, "emote_left");
 | 
					  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");
 | 
					  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_defense_bar, "defense_bar");
 | 
				
			||||||
  set_size_and_pos(ui_prosecution_bar, "prosecution_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_cross_examination, "cross_examination");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_change_character, "change_character");
 | 
					  set_size_and_pos(ui_change_character, "change_character");
 | 
				
			||||||
 | 
					  ui_change_character->setText("Change character");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_reload_theme, "reload_theme");
 | 
					  set_size_and_pos(ui_reload_theme, "reload_theme");
 | 
				
			||||||
  ui_reload_theme->setText("Reload theme");
 | 
					  ui_reload_theme->setText("Reload theme");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_call_mod, "call_mod");
 | 
					  set_size_and_pos(ui_call_mod, "call_mod");
 | 
				
			||||||
 | 
					  ui_call_mod->setText("Call mod");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_pre, "pre");
 | 
					  set_size_and_pos(ui_pre, "pre");
 | 
				
			||||||
 | 
					  ui_pre->setText("Pre");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_flip, "flip");
 | 
					  set_size_and_pos(ui_flip, "flip");
 | 
				
			||||||
 | 
					  ui_flip->setText("Flip");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_guard, "guard");
 | 
					  set_size_and_pos(ui_guard, "guard");
 | 
				
			||||||
 | 
					  ui_guard->setText("Guard");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_size_and_pos(ui_custom_objection, "custom_objection");
 | 
					  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_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");
 | 
					  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");
 | 
					  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");
 | 
					  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");
 | 
					  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");
 | 
					  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");
 | 
					  set_size_and_pos(ui_char_password, "char_password");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_spectator->setText("spectator");
 | 
					  ui_spectator->setText("Spectator");
 | 
				
			||||||
  set_size_and_pos(ui_spectator, "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);
 | 
					  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()
 | 
					void Courtroom::on_reload_theme_clicked()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  ao_app->set_user_theme();
 | 
					  ao_app->set_user_theme();
 | 
				
			||||||
@ -252,9 +288,15 @@ void Courtroom::on_reload_theme_clicked()
 | 
				
			|||||||
void Courtroom::on_back_to_lobby_clicked()
 | 
					void Courtroom::on_back_to_lobby_clicked()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  ao_app->construct_lobby();
 | 
					  ao_app->construct_lobby();
 | 
				
			||||||
 | 
					  ao_app->w_lobby->list_servers();
 | 
				
			||||||
  ao_app->destruct_courtroom();
 | 
					  ao_app->destruct_courtroom();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Courtroom::on_spectator_clicked()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  ui_char_select_background->hide();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Courtroom::~Courtroom()
 | 
					Courtroom::~Courtroom()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -121,10 +121,13 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  AOButton *ui_spectator;
 | 
					  AOButton *ui_spectator;
 | 
				
			||||||
private slots:
 | 
					private slots:
 | 
				
			||||||
 | 
					  void on_change_character_clicked();
 | 
				
			||||||
  void on_reload_theme_clicked();
 | 
					  void on_reload_theme_clicked();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void on_back_to_lobby_clicked();
 | 
					  void on_back_to_lobby_clicked();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void on_spectator_clicked();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // COURTROOM_H
 | 
					#endif // COURTROOM_H
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,10 @@
 | 
				
			|||||||
#include "hardware_functions.h"
 | 
					#include "hardware_functions.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QDebug>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (defined (_WIN32) || defined (_WIN64))
 | 
					#if (defined (_WIN32) || defined (_WIN64))
 | 
				
			||||||
 | 
					#include <windows.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DWORD dwVolSerial;
 | 
					DWORD dwVolSerial;
 | 
				
			||||||
BOOL bIsRetrieved;
 | 
					BOOL bIsRetrieved;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -11,24 +15,44 @@ QString get_hdid()
 | 
				
			|||||||
    if (bIsRetrieved)
 | 
					    if (bIsRetrieved)
 | 
				
			||||||
        return QString::number(dwVolSerial, 16);
 | 
					        return QString::number(dwVolSerial, 16);
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        return "invalid_windows_hd"; //what could possibly go wrong
 | 
					        return "gxsps32sa9fnwic92mfbs0"; //what could possibly go wrong
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif (defined (LINUX) || defined (__linux__))
 | 
					#elif (defined (LINUX) || defined (__linux__))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QFile>
 | 
				
			||||||
 | 
					#include <QTextStream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString get_hdid()
 | 
					QString get_hdid()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //T0D0: add linux implementation
 | 
					  QFile fstab_file("/etc/fstab");
 | 
				
			||||||
  return "linux_os_hdid";
 | 
					  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
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString get_hdid()
 | 
					//throwing compile-time errors professionally
 | 
				
			||||||
{
 | 
					fhasdfuifhidfhasjkfasdkfahsdj
 | 
				
			||||||
  //T0D0: find a sane way to handle this
 | 
					 | 
				
			||||||
  return "unknown_os_hdid";
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,10 @@
 | 
				
			|||||||
#ifndef WIN32_FUNCTIONS_H
 | 
					#ifndef HARDWARE_FUNCTIONS_H
 | 
				
			||||||
#define WIN32_FUNCTIONS_H
 | 
					#define HARDWARE_FUNCTIONS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QString>
 | 
					#include <QString>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef Q_OS_WIN32
 | 
					 | 
				
			||||||
#include <windows.h>
 | 
					 | 
				
			||||||
#endif // Q_OS_WIN32
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString get_hdid();
 | 
					QString get_hdid();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // WIN32_FUNCTIONS_H
 | 
					#endif // HARDWARE_FUNCTIONS_H
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "path_functions.h"
 | 
					#include "path_functions.h"
 | 
				
			||||||
#include "text_file_functions.h"
 | 
					#include "text_file_functions.h"
 | 
				
			||||||
#include "global_variables.h"
 | 
					 | 
				
			||||||
#include "debug_functions.h"
 | 
					#include "debug_functions.h"
 | 
				
			||||||
#include "aoapplication.h"
 | 
					#include "aoapplication.h"
 | 
				
			||||||
#include "networkmanager.h"
 | 
					#include "networkmanager.h"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
#include "aoapplication.h"
 | 
					#include "aoapplication.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "global_variables.h"
 | 
					 | 
				
			||||||
#include "text_file_functions.h"
 | 
					#include "text_file_functions.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user