|
@@ -1,95 +1,207 @@
|
|
-#include "app.h"
|
|
|
|
|
|
+#include "mainwindow.h"
|
|
|
|
|
|
-App *App::instance;
|
|
|
|
|
|
+#include "filesystem.h"
|
|
|
|
+#include "aconfig.h"
|
|
|
|
+#include "anetwork.h"
|
|
|
|
+#include "gameres.h"
|
|
|
|
+#include "downloadmanager.h"
|
|
|
|
+#include "skin.h"
|
|
|
|
|
|
#include <QBitmap>
|
|
#include <QBitmap>
|
|
|
|
+#include <QMovie>
|
|
|
|
+#include <QGraphicsDropShadowEffect>
|
|
|
|
+#include <QCloseEvent>
|
|
|
|
+#include <QClipboard>
|
|
|
|
+#include <QFileDialog>
|
|
|
|
+
|
|
|
|
+MainWindow::MainWindow( QMainWindow* parent )
|
|
|
|
+ : QMainWindow(parent, Qt::Window | Qt::FramelessWindowHint)
|
|
|
|
+ , ui(new Ui::MainWindow)
|
|
|
|
+ , dx(0)
|
|
|
|
+ , dy(0) {
|
|
|
|
|
|
-MainWindow::MainWindow( QMainWindow* parent ) :
|
|
|
|
- QMainWindow( parent, Qt::Window | Qt::FramelessWindowHint ),
|
|
|
|
- ui( new Ui::MainWindow ), dx( 0 ), dy( 0 ) {
|
|
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
|
|
|
|
- App *app = &App::getInstance();
|
|
|
|
- if(!app->helper->fileExists(QApplication::applicationDirPath() + "/settings.ini")) app->config->saveConfig();
|
|
|
|
- QString skin = app->helper->getSkinName();
|
|
|
|
|
|
+ if(!FileSystem::fileExists(QApplication::applicationDirPath() + "/settings.ini"))
|
|
|
|
+ AConfig::getInstance()->saveConfig();
|
|
|
|
+
|
|
|
|
+ QString skin = Skin::getInstance()->getSkinName();
|
|
setWindowIcon(QIcon(":/res/styles/" + skin + "/icon6.png"));
|
|
setWindowIcon(QIcon(":/res/styles/" + skin + "/icon6.png"));
|
|
QCoreApplication::setOrganizationName(ORGANIZATION_NAME);
|
|
QCoreApplication::setOrganizationName(ORGANIZATION_NAME);
|
|
QCoreApplication::setOrganizationDomain(ORGANIZATION_DOMAIN);
|
|
QCoreApplication::setOrganizationDomain(ORGANIZATION_DOMAIN);
|
|
QCoreApplication::setApplicationName(APPLICATION_NAME);
|
|
QCoreApplication::setApplicationName(APPLICATION_NAME);
|
|
- setWindowTitle("Русификация LOTRO");
|
|
|
|
-
|
|
|
|
- app->logSectionEnd();
|
|
|
|
|
|
+ setWindowTitle("ВКО: Наследие");
|
|
|
|
+ show();
|
|
|
|
|
|
// Проводим подготовку к запуску
|
|
// Проводим подготовку к запуску
|
|
- app->window = this;
|
|
|
|
- app->config->loadConfig();
|
|
|
|
- app->config->loadSkin();
|
|
|
|
- app->helper->hideAll();
|
|
|
|
- app->helper->loadNews();
|
|
|
|
- app->network->getFootMessage();
|
|
|
|
- app->network->getServers();
|
|
|
|
- app->network->getCoupon();
|
|
|
|
- app->helper->loadHelp();
|
|
|
|
- app->helper->setAbout();
|
|
|
|
- app->helper->findSkins();
|
|
|
|
|
|
+ loadConfig();
|
|
|
|
+ Skin::getInstance()->loadSkin();
|
|
|
|
+ loadNews();
|
|
|
|
+
|
|
|
|
+ ANetwork::getInstance()->getFootMessage();
|
|
|
|
+ ANetwork::getInstance()->getServers();
|
|
|
|
+ ANetwork::getInstance()->getCoupon();
|
|
|
|
+
|
|
|
|
+ loadHelp();
|
|
|
|
+ setAbout();
|
|
|
|
+ Skin::getInstance()->findSkins();
|
|
//app->helper->setPatchsDates();
|
|
//app->helper->setPatchsDates();
|
|
|
|
|
|
- app->logSectionStart("Запуск Наследия");
|
|
|
|
qInfo("%s:%i: %s", __FILE__, __LINE__, "Оформляем главное окно.");
|
|
qInfo("%s:%i: %s", __FILE__, __LINE__, "Оформляем главное окно.");
|
|
QPixmap maskPix(":/res/styles/" + skin + "/bg.png");
|
|
QPixmap maskPix(":/res/styles/" + skin + "/bg.png");
|
|
- QPixmap maskPixLocal(app->app_folder + "styles/" + skin + "/bg.png");
|
|
|
|
|
|
+ QPixmap maskPixLocal(QApplication::applicationDirPath() + "styles/" + skin + "/bg.png");
|
|
maskPix = maskPix.isNull() ? maskPixLocal : maskPix;
|
|
maskPix = maskPix.isNull() ? maskPixLocal : maskPix;
|
|
this->setMask(maskPix.mask());
|
|
this->setMask(maskPix.mask());
|
|
|
|
|
|
qInfo("%s:%i: %s", __FILE__, __LINE__, "Устанавливаем анимации.");
|
|
qInfo("%s:%i: %s", __FILE__, __LINE__, "Устанавливаем анимации.");
|
|
QMovie * movie = new QMovie(":/res/styles/" + skin + "/loader.gif");
|
|
QMovie * movie = new QMovie(":/res/styles/" + skin + "/loader.gif");
|
|
- if(!movie->isValid()) movie = new QMovie(app->app_folder + "styles/" + skin + "/loader.gif");
|
|
|
|
|
|
+
|
|
ui->loader->setMovie(movie);
|
|
ui->loader->setMovie(movie);
|
|
movie->setScaledSize(QSize(ui->loader->width(), ui->loader->height()));
|
|
movie->setScaledSize(QSize(ui->loader->width(), ui->loader->height()));
|
|
movie->start();
|
|
movie->start();
|
|
|
|
|
|
- connect(app->window->ui->skinSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(saveSkin()));
|
|
|
|
|
|
+ connect(ui->skinSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(saveSkin()));
|
|
|
|
+}
|
|
|
|
|
|
- app->state = "busy";
|
|
|
|
|
|
+void MainWindow::addComboItem(QComboBox* combo, QString itemName, QIcon* icon){
|
|
|
|
+ combo->insertItem(0, itemName);
|
|
|
|
+ combo->setItemIcon(0, *icon);
|
|
}
|
|
}
|
|
|
|
|
|
-void MainWindow::doStartPreparations() {
|
|
|
|
- App *app = &App::getInstance();
|
|
|
|
- // Проверяем файл локализации
|
|
|
|
- app->helper->checkDatFile();
|
|
|
|
|
|
+void MainWindow::saveLocale(int locale, QPushButton * button){
|
|
|
|
+ QString file;
|
|
|
|
|
|
- app->state = "free";
|
|
|
|
|
|
+ if(locale == 0) file = "client_local_English.dat";
|
|
|
|
+ if(locale == 1) file = "client_local_DE.dat";
|
|
|
|
+ if(locale == 2) file = "client_local_FR.dat";
|
|
|
|
|
|
- // Если это первый запуск то показываем мастер
|
|
|
|
- if(app->config->getValue("Local", "runfirst") == "-1"){
|
|
|
|
- qInfo("%s:%i: %s", __FILE__, __LINE__, "Показываем мастер начальных настроек.");
|
|
|
|
- app->helper->setState("runfirst");
|
|
|
|
|
|
+ if(FileSystem::fileExists(AConfig::getInstance()->getValue("Local", "folder") + "/" + file)){
|
|
|
|
+ ui->enButton->setEnabled(true);
|
|
|
|
+ ui->deButton->setEnabled(true);
|
|
|
|
+ ui->frButton->setEnabled(true);
|
|
|
|
+ button->setEnabled(false);
|
|
|
|
+ AConfig::getInstance()->setValue("Local", "file", file);
|
|
} else {
|
|
} else {
|
|
- app->helper->setState("free");
|
|
|
|
|
|
+ QString text = "Данная локализация отсутствует";
|
|
|
|
+ QString info = "В настоящий момент вы не можете выбрать данную опцию, поскольку файл " + file + " отсутствует в вашем игровом клиенте. Чтобы скачать его, запустите официальный лаунчер, выберите желаемый язык в верхней правой части окна и дождитесь, когда загрузка необходимых файлов завершится.";
|
|
|
|
+ myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "", "", 400, 220, true, false);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void MainWindow::loadConfig() {
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Находим каталог с игрой");
|
|
|
|
+ ui->lotropathLabel->setText(AConfig::getInstance()->getValue("Local", "folder") != "-1" ? AConfig::getInstance()->getValue("Local", "folder") : "Выберите папку с игрой");
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Проверяем активность патча \"Шрифты\"");
|
|
|
|
+ ui->checkFonts->setChecked(AConfig::getInstance()->getValue("Editor", "fonts") == "true" ? true : false);
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Проверяем активность патча \"Тексты\"");
|
|
|
|
+ ui->checkTexts->setChecked(AConfig::getInstance()->getValue("Editor", "texts")== "true" ? true : false);
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Проверяем активность патча \"Карты\"");
|
|
|
|
+ ui->checkMaps->setChecked(AConfig::getInstance()->getValue("Editor", "images") == "true" ? true : false);
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Проверяем активность патча \"Звуки\"");
|
|
|
|
+ ui->checkSounds->setChecked(AConfig::getInstance()->getValue("Editor", "sounds")== "true" ? true : false);
|
|
|
|
+
|
|
|
|
+ ui->checkVideos->setChecked(AConfig::getInstance()->getValue("Editor", "videos") == "true" ? true : false);
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Проверяем активность патча \"Заставки\"");
|
|
|
|
+ ui->checkScreens->setChecked(AConfig::getInstance()->getValue("Editor", "screens")== "true" ? true : false);
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Проверяем активность микрообновлений");
|
|
|
|
+ ui->checkMicro->setChecked(AConfig::getInstance()->getValue("Updates", "micro")== "true" ? true : false);
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Выполнено.");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void MainWindow::loadNews(){
|
|
|
|
+ qInfo("Загружаем скин лаунчера");
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Загрузка новостей с сайта");
|
|
|
|
+ QString response = ANetwork::getInstance()->query(AConfig::getInstance()->getValue("Network", "news"));
|
|
|
|
+
|
|
|
|
+ if (response == "error"){
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Отсутствует связь с сервером. Прервано.");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QStringList data = response.split(":::");
|
|
|
|
+ qInfo("%s:%i: %s%s", __FILE__, __LINE__, "Получено новостей - ", QString::number(data.count()).toStdString().c_str());
|
|
|
|
+ int counter = 1;
|
|
|
|
+
|
|
|
|
+ foreach(QString news, data){
|
|
|
|
+ qInfo("%s:%i: %s%s", __FILE__, __LINE__, "Начинаем размещение новости №", QString::number(counter).toStdString().c_str());
|
|
|
|
+
|
|
|
|
+ QStringList item = news.split("|");
|
|
|
|
+ QLabel* image = ui->newsbox->findChild<QLabel*>("news" + QString::number(counter) + "Image");
|
|
|
|
+ QLabel* title = ui->newsbox->findChild<QLabel*>("news" + QString::number(counter) + "Title");
|
|
|
|
+ QLabel* teaser = ui->newsbox->findChild<QLabel*>("news" + QString::number(counter) + "Teaser");
|
|
|
|
+
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Устанавливаем миниатюру новости");
|
|
|
|
+ QByteArray bytes = ANetwork::getInstance()->query_binary(item[0]);
|
|
|
|
+ QImage img(36, 36, QImage::Format_Indexed8);
|
|
|
|
+ img.loadFromData(bytes);
|
|
|
|
+
|
|
|
|
+ QString skin = Skin::getInstance()->getSkinName();
|
|
|
|
+
|
|
|
|
+ if(img.bits() == nullptr){
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Миниатюра не найдена, устанавливаем заглушку");
|
|
|
|
+ img.load(":/res/styles/" + skin + "/nophoto.jpg");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ image->setPixmap(QPixmap::fromImage(img));
|
|
|
|
+
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Применяем HTML-цвета");
|
|
|
|
+ QString hrefcolor = htmlColors.contains("a") ? htmlColors.lowerBound("a").value() : "blue";
|
|
|
|
+ QString html = "<a href=\"" + item[3] +"\" style=\"color:" + hrefcolor + "; text-decoration:none;\">" + item[1] + "</a>";
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Размещаем тексты");
|
|
|
|
+ title->setText(html);
|
|
|
|
+ teaser->setText(item[2]);
|
|
|
|
+ counter = counter + 1;
|
|
}
|
|
}
|
|
qInfo("%s:%i: %s", __FILE__, __LINE__, "Выполнено.");
|
|
qInfo("%s:%i: %s", __FILE__, __LINE__, "Выполнено.");
|
|
- app->logSectionEnd();
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void MainWindow::loadHelp(){
|
|
|
|
+ qInfo("Создание справки");
|
|
|
|
+ QFile file(QApplication::applicationDirPath() + "/readme.html");
|
|
|
|
|
|
|
|
+ if(file.open(QFile::ReadOnly | QFile::Text)){
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Справка загружена. Устанавливаем HTML-цвета и выводим.");
|
|
|
|
+ ui->textBrowser->setHtml("");
|
|
|
|
+ QString content = file.readAll();
|
|
|
|
|
|
- // Если приготовления выполнены загружаем патчи
|
|
|
|
- if(app->state == "free" && app->ready == true){
|
|
|
|
- app->logSectionStart("Загрузка патчей");
|
|
|
|
- //for (int i = 0; i < 5; i++) app->datfiles[i].CommitChanges();
|
|
|
|
- app->network->getPaths();
|
|
|
|
|
|
+ stylehtml = "<style>";
|
|
|
|
+ for(auto e : htmlColors.keys()){
|
|
|
|
+ stylehtml = stylehtml + e + "{color:" + htmlColors.value(e) + ";}";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ QFile styleF;
|
|
|
|
+ QString skin = Skin::getInstance()->getSkinName();
|
|
|
|
+ styleF.setFileName(QApplication::applicationDirPath() + "styles/" + skin + "/readme.css");
|
|
|
|
+ if(styleF.open(QFile::ReadOnly)){
|
|
|
|
+ stylehtml = "<html><head><style type=\"text/css\">" + stylehtml + styleF.readAll();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ stylehtml = stylehtml + "</style></head>";
|
|
|
|
+
|
|
|
|
+ ui->textBrowser->setHtml(stylehtml + content);
|
|
|
|
+ ui->textBrowser->document()->setDefaultStyleSheet(styleF.readAll());
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Выполнено.");
|
|
|
|
+ } else {
|
|
|
|
+ qWarning("%s:%i: %s", __FILE__, __LINE__, "Не удалось получить информацию с сервера");
|
|
qInfo("%s:%i: %s", __FILE__, __LINE__, "Выполнено.");
|
|
qInfo("%s:%i: %s", __FILE__, __LINE__, "Выполнено.");
|
|
- app->logSectionEnd();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-MainWindow::~MainWindow()
|
|
|
|
-{
|
|
|
|
|
|
+MainWindow::~MainWindow() {
|
|
delete ui;
|
|
delete ui;
|
|
}
|
|
}
|
|
|
|
|
|
-void MainWindow::closeEvent(QCloseEvent *e){
|
|
|
|
- App *app = &App::getInstance();
|
|
|
|
- if(app->state == "busy") e->ignore();
|
|
|
|
|
|
+void MainWindow::applyShadow(QWidget * obj, QString color, int blur, int offset_x, int offset_y){
|
|
|
|
+ QGraphicsDropShadowEffect *pLabelTextShadowEffect = new QGraphicsDropShadowEffect(obj);
|
|
|
|
+ pLabelTextShadowEffect->setColor(QColor(color));
|
|
|
|
+ pLabelTextShadowEffect->setBlurRadius(blur);
|
|
|
|
+ pLabelTextShadowEffect->setOffset(offset_x, offset_y);
|
|
|
|
+ obj->setGraphicsEffect(pLabelTextShadowEffect);
|
|
|
|
+}
|
|
|
|
|
|
|
|
+void MainWindow::closeEvent(QCloseEvent *e) {
|
|
|
|
+ if (state == "busy") e->ignore();
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::mouseMoveEvent( QMouseEvent* e ) {
|
|
void MainWindow::mouseMoveEvent( QMouseEvent* e ) {
|
|
@@ -131,8 +243,7 @@ void MainWindow::minimize() {
|
|
}
|
|
}
|
|
|
|
|
|
bool MainWindow::eventFilter(QObject *obj, QEvent *event){
|
|
bool MainWindow::eventFilter(QObject *obj, QEvent *event){
|
|
- App *app = &App::getInstance();
|
|
|
|
- if(app->state == "busy") return false;
|
|
|
|
|
|
+ if(state == "busy") return false;
|
|
|
|
|
|
if(obj->objectName() == "mainButton"){
|
|
if(obj->objectName() == "mainButton"){
|
|
this->ui->hintLabel->setText("Применение патчей");
|
|
this->ui->hintLabel->setText("Применение патчей");
|
|
@@ -166,74 +277,69 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event){
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_mainButton_clicked(){
|
|
void MainWindow::on_mainButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->checkTab("mainbox");
|
|
|
|
- app->window->ui->titleLabel->setText("Патчи");
|
|
|
|
- if(app->state != "busy") app->network->getPaths();
|
|
|
|
|
|
+ checkTab("mainbox");
|
|
|
|
+ ui->titleLabel->setText("Патчи");
|
|
|
|
+ if(state != "busy") ANetwork::getInstance()->getPatches();
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_optButton_clicked(){
|
|
void MainWindow::on_optButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->checkTab("optbox");
|
|
|
|
- app->window->ui->titleLabel->setText("Настройки");
|
|
|
|
|
|
+ checkTab("optbox");
|
|
|
|
+ ui->titleLabel->setText("Настройки");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_newsButton_clicked(){
|
|
void MainWindow::on_newsButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->checkTab("newsbox");
|
|
|
|
- app->window->ui->titleLabel->setText("Новости");
|
|
|
|
|
|
+ checkTab("newsbox");
|
|
|
|
+ ui->titleLabel->setText("Новости");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_helpButton_clicked(){
|
|
void MainWindow::on_helpButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->checkTab("helpbox");
|
|
|
|
- app->window->ui->titleLabel->setText("Справка");
|
|
|
|
|
|
+ checkTab("helpbox");
|
|
|
|
+ ui->titleLabel->setText("Справка");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_aboutButton_clicked(){
|
|
void MainWindow::on_aboutButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->checkTab("aboutbox");
|
|
|
|
- app->window->ui->titleLabel->setText("О нас");
|
|
|
|
|
|
+ checkTab("aboutbox");
|
|
|
|
+ ui->titleLabel->setText("О нас");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_enterButton_clicked(){
|
|
void MainWindow::on_enterButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->window->ui->startbox->setGeometry(0, 0, app->window->width(), app->window->height());
|
|
|
|
- QSettings settings( app->config->getSkinFile(), QSettings::IniFormat );
|
|
|
|
|
|
+ ui->startbox->setGeometry(0, 0, width(), height());
|
|
|
|
+ QSettings settings(Skin::getInstance()->getSkinFile(), QSettings::IniFormat);
|
|
|
|
|
|
settings.beginGroup("mainWindow");
|
|
settings.beginGroup("mainWindow");
|
|
- int left = (settings.value("width").toInt() - app->window->ui->startframe->width())/2;
|
|
|
|
- int top = (settings.value("height").toInt() - app->window->ui->startframe->height())/2;
|
|
|
|
- app->window->ui->startframe->setGeometry(QRect(left, top, app->window->ui->startframe->width(), app->window->ui->startframe->height()));
|
|
|
|
|
|
+ int left = (settings.value("width").toInt() - ui->startframe->width())/2;
|
|
|
|
+ int top = (settings.value("height").toInt() - ui->startframe->height())/2;
|
|
|
|
+ ui->startframe->setGeometry(QRect(left, top, ui->startframe->width(), ui->startframe->height()));
|
|
settings.endGroup();
|
|
settings.endGroup();
|
|
- QString file = app->config->getValue("Local", "file");
|
|
|
|
- if(file == "client_local_English.dat") file = "goenr.png";
|
|
|
|
- if(file == "client_local_DE.dat") file = "goderr.png";
|
|
|
|
- if(file == "client_local_FR.dat") file = "gofrr.png";
|
|
|
|
|
|
|
|
- QString skin = app->config->getSkinName();
|
|
|
|
|
|
+ QString file = AConfig::getInstance()->getValue("Local", "file");
|
|
|
|
+
|
|
|
|
+ if (file == "client_local_English.dat") file = "goenr.png";
|
|
|
|
+ if (file == "client_local_DE.dat") file = "goderr.png";
|
|
|
|
+ if (file == "client_local_FR.dat") file = "gofrr.png";
|
|
|
|
+
|
|
|
|
+ QString skin = Skin::getInstance()->getSkinName();
|
|
QString bname = ":/res/styles/" + skin + "/" + file;
|
|
QString bname = ":/res/styles/" + skin + "/" + file;
|
|
QPixmap isset(bname);
|
|
QPixmap isset(bname);
|
|
- bname = isset.isNull() ? app->app_folder + "styles/" + skin + "/" + file : bname;
|
|
|
|
- app->window->ui->goOriginal->setStyleSheet("QPushButton#goOriginal { border-image: url(" + bname + ") 0 0 0 0 stretch stretch;}");
|
|
|
|
-
|
|
|
|
- app->window->ui->startbox->show();
|
|
|
|
|
|
+ bname = isset.isNull() ? app_folder + "styles/" + skin + "/" + file : bname;
|
|
|
|
+ ui->goOriginal->setStyleSheet("QPushButton#goOriginal { border-image: url(" + bname + ") 0 0 0 0 stretch stretch;}");
|
|
|
|
+ ui->startbox->show();
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_goCancel_clicked(){
|
|
void MainWindow::on_goCancel_clicked(){
|
|
- this->ui->startbox->hide();
|
|
|
|
|
|
+ ui->startbox->hide();
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_goOriginal_clicked(){
|
|
void MainWindow::on_goOriginal_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->window->ui->goProgress->show();
|
|
|
|
- QtConcurrent::run([=]() { app->helper->setGameLocale("Original"); app->helper->startGame(); });
|
|
|
|
|
|
+ ui->goProgress->show();
|
|
|
|
+ GameRes::getInstance()->setGameLocale("Original");
|
|
|
|
+ //connect(GameRes::getInstance(), SIGNAL(GameRes::getInstance()->setGameLocaleFinished()), GameRes::getInstance(), SLOT(GameRes::getInstance()->startGame()));
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_goLocal_clicked(){
|
|
void MainWindow::on_goLocal_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->window->ui->goProgress->show();
|
|
|
|
- QtConcurrent::run([=]() { if(app->helper->setGameLocale("RU")) app->helper->startGame(); });
|
|
|
|
|
|
+ ui->goProgress->show();
|
|
|
|
+ GameRes::getInstance()->setGameLocale("RU");
|
|
|
|
+ //connect(GameRes::getInstance(), SIGNAL(GameRes::getInstance()->setGameLocaleFinished()), GameRes::getInstance(), SLOT(GameRes::getInstance()->startGame()));
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_minimizeButton_clicked(){
|
|
void MainWindow::on_minimizeButton_clicked(){
|
|
@@ -245,203 +351,282 @@ void MainWindow::on_closeButton_clicked(){
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_couponButton_clicked(){
|
|
void MainWindow::on_couponButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- QApplication::clipboard()->setText(app->window->ui->couponButton->text());
|
|
|
|
- this->ui->exthintLabel->setText("Код скопирован.");
|
|
|
|
|
|
+ QApplication::clipboard()->setText(ui->couponButton->text());
|
|
|
|
+ ui->exthintLabel->setText("Код скопирован.");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_enButton_clicked(){
|
|
void MainWindow::on_enButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->saveLocale(0, this->ui->enButton);
|
|
|
|
- app->config->setValue("Local", "lang", "en");
|
|
|
|
|
|
+ saveLocale(0, ui->enButton);
|
|
|
|
+ AConfig::getInstance()->setValue("Local", "lang", "en");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_deButton_clicked(){
|
|
void MainWindow::on_deButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->saveLocale(1, this->ui->deButton);
|
|
|
|
- app->config->setValue("Local", "lang", "de");
|
|
|
|
|
|
+ saveLocale(1, this->ui->deButton);
|
|
|
|
+ AConfig::getInstance()->setValue("Local", "lang", "de");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_frButton_clicked(){
|
|
void MainWindow::on_frButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->saveLocale(2, this->ui->frButton);
|
|
|
|
- app->config->setValue("Local", "lang", "fr");
|
|
|
|
|
|
+ saveLocale(2, this->ui->frButton);
|
|
|
|
+ AConfig::getInstance()->setValue("Local", "lang", "fr");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::saveSkin(){
|
|
void MainWindow::saveSkin(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- QString new_theme = app->window->ui->skinSelect->currentText();
|
|
|
|
- if(app->config->getSkinName() != new_theme){
|
|
|
|
- app->config->setValue("Global", "current_theme", new_theme);
|
|
|
|
- app->helper->replaceSkin(new_theme);
|
|
|
|
|
|
+ QString new_theme = ui->skinSelect->currentText();
|
|
|
|
+ if(Skin::getInstance()->getSkinName() != new_theme){
|
|
|
|
+ AConfig::getInstance()->setValue("Global", "current_theme", new_theme);
|
|
|
|
+ Skin::getInstance()->replaceSkin(new_theme);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_checkFonts_stateChanged(int arg1){
|
|
void MainWindow::on_checkFonts_stateChanged(int arg1){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->config->setValue("Editor", "fonts", arg1 ? "true" : "false");
|
|
|
|
|
|
+ AConfig::getInstance()->setValue("Editor", "fonts", arg1 ? "true" : "false");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_checkTexts_stateChanged(int arg1){
|
|
void MainWindow::on_checkTexts_stateChanged(int arg1){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->config->setValue("Editor", "texts", arg1 ? "true" : "false");;
|
|
|
|
- app->downloader->abortDownload("texts");
|
|
|
|
|
|
+ AConfig::getInstance()->setValue("Editor", "texts", arg1 ? "true" : "false");;
|
|
|
|
+ DownloadManager::getInstance()->abortDownload("texts");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_checkSounds_stateChanged(int arg1){
|
|
void MainWindow::on_checkSounds_stateChanged(int arg1){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->config->setValue("Editor", "sounds", arg1 ? "true" : "false");
|
|
|
|
- app->downloader->abortDownload("sounds");
|
|
|
|
|
|
+ AConfig::getInstance()->setValue("Editor", "sounds", arg1 ? "true" : "false");
|
|
|
|
+ DownloadManager::getInstance()->abortDownload("sounds");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_checkMaps_stateChanged(int arg1){
|
|
void MainWindow::on_checkMaps_stateChanged(int arg1){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->config->setValue("Editor", "images", arg1 ? "true" : "false");
|
|
|
|
- app->downloader->abortDownload("images");
|
|
|
|
|
|
+ AConfig::getInstance()->setValue("Editor", "images", arg1 ? "true" : "false");
|
|
|
|
+ DownloadManager::getInstance()->abortDownload("images");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_checkScreens_stateChanged(int arg1){
|
|
void MainWindow::on_checkScreens_stateChanged(int arg1){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->config->setValue("Editor", "screens", arg1 ? "true" : "false");
|
|
|
|
- app->downloader->abortDownload("screens");
|
|
|
|
|
|
+ AConfig::getInstance()->setValue("Editor", "screens", arg1 ? "true" : "false");
|
|
|
|
+ DownloadManager::getInstance()->abortDownload("screens");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_checkVideos_stateChanged(int arg1){
|
|
void MainWindow::on_checkVideos_stateChanged(int arg1){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->config->setValue("Editor", "videos", arg1 ? "true" : "false");
|
|
|
|
- app->downloader->abortDownload("videos");
|
|
|
|
|
|
+ AConfig::getInstance()->setValue("Editor", "videos", arg1 ? "true" : "false");
|
|
|
|
+ DownloadManager::getInstance()->abortDownload("videos");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_checkMicro_stateChanged(int arg1){
|
|
void MainWindow::on_checkMicro_stateChanged(int arg1){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->config->setValue("Updates", "micro", arg1 ? "true" : "false");
|
|
|
|
|
|
+ AConfig::getInstance()->setValue("Updates", "micro", arg1 ? "true" : "false");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_lotropathButton_clicked(){
|
|
void MainWindow::on_lotropathButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
QString path = QFileDialog::getExistingDirectory(0, "Выберите папку с игрой");
|
|
QString path = QFileDialog::getExistingDirectory(0, "Выберите папку с игрой");
|
|
- if(path != "" && app->helper->fileExists(path + "/TurbineLauncher.exe")){
|
|
|
|
- app->window->ui->lotropathLabel->setText(path);
|
|
|
|
- app->config->setValue("Local", "folder", path);
|
|
|
|
|
|
+ if(path != "" && FileSystem::fileExists(path + "/TurbineLauncher.exe")) {
|
|
|
|
+ ui->lotropathLabel->setText(path);
|
|
|
|
+ AConfig::getInstance()->setValue("Local", "folder", path);
|
|
} else {
|
|
} else {
|
|
QString text = "Выбрана неверная папка";
|
|
QString text = "Выбрана неверная папка";
|
|
QString info = "<p>Убедитесь, что выбранный вами каталог является папкой игры и содержит такие файлы как TurbineLauncher.exe и client_local_English.dat.</p>";
|
|
QString info = "<p>Убедитесь, что выбранный вами каталог является папкой игры и содержит такие файлы как TurbineLauncher.exe и client_local_English.dat.</p>";
|
|
- app->helper->myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "", "", 400, 160, true, false);
|
|
|
|
|
|
+ myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "", "", 400, 160, true, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_designButton_clicked(){
|
|
void MainWindow::on_designButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->helper->replaceSkin(app->config->getSkinName());
|
|
|
|
|
|
+ Skin::getInstance()->replaceSkin(Skin::getInstance()->getSkinName());
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_repairButton_clicked(){
|
|
void MainWindow::on_repairButton_clicked(){
|
|
- App *app = &App::getInstance();
|
|
|
|
- app->config->deleteSection("Applied");
|
|
|
|
- app->helper->applyGlobal();
|
|
|
|
- app->helper->checkTab("mainbox");
|
|
|
|
|
|
+ AConfig::getInstance()->deleteSection("Applied");
|
|
|
|
+ GameRes::getInstance()->applyAll();
|
|
|
|
+ checkTab("mainbox");
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_okButton_clicked(){
|
|
void MainWindow::on_okButton_clicked(){
|
|
|
|
+ //QStringList commands = app->helper->dialog_ok_answer.split(" ");
|
|
|
|
+// foreach(QString command, commands){
|
|
|
|
+// if(command == "close"){
|
|
|
|
+// ui->dialogbox->hide();
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(command == "gamefind"){
|
|
|
|
+// QStringList folders = app->config->getLotroPath();
|
|
|
|
+// if(folders.count() > 1){
|
|
|
|
+// QString text = "Результаты поиска";
|
|
|
|
+// QString info = "Найдены следующие папки в которых установлена игра:<br/><br/><br/><br/><br/>Выберите нужную папку и нажмите «Далее»<br/>";
|
|
|
|
+// app->helper->myDialogBox(text, info, "Далее", "Отмена", "gandalf.png", "writefolder", "", 530, 200, true, false);
|
|
|
|
+// ui->dialogList->setGeometry(QRect(
|
|
|
|
+// ui->dialogImage->rect().right() + 10,
|
|
|
|
+// ui->dialogHeader->rect().bottom()+40, 417, 50));
|
|
|
|
+
|
|
|
|
+// foreach(QString f, folders) new QListWidgetItem(f, ui->dialogList);
|
|
|
|
+// ui->dialogList->show();
|
|
|
|
+
|
|
|
|
+// } else {
|
|
|
|
+// if(folders.count() == 1){
|
|
|
|
+// ui->lotropathLabel->setText(folders.first());
|
|
|
|
+// app->config->setValue("Local", "folder", folders.first());
|
|
|
|
+// this->ui->dialogbox->hide();
|
|
|
|
+// QString text = "Завершающий этап";
|
|
|
|
+// QString info = "Необходимые приготовления завершены. Сейчас вы будете перенаправлены в раздел «Настройки», где сможете выбрать патчи, которые хотите установить. После этого перейдите в раздел «Патчи» для начала их загрузки и применения.";
|
|
|
|
+// app->helper->myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "close gotooptions", "",400, 200, true, false);
|
|
|
|
+// } else {
|
|
|
|
+// QString text = "Завершающий этап";
|
|
|
|
+// QString info = "Обнаружить каталог игры автоматически не удалось. Сейчас вы будете перенаправлены в раздел «Настройки», где сможете вручную выбрать каталог игры и патчи, которые хотите установить. После этого перейдите в раздел «Патчи» для начала их загрузки и применения.";
|
|
|
|
+// app->helper->myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "close gotooptions", "",450, 200, true, false);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// qDebug() << folders;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(command == "writefolder"){
|
|
|
|
+// if(ui->dialogList->currentItem()){
|
|
|
|
+// QString path = ui->dialogList->currentItem()->text();qDebug() << path;
|
|
|
|
+// ui->lotropathLabel->setText(path);
|
|
|
|
+// app->config->setValue("Local", "folder", path);
|
|
|
|
+// ui->dialogList->clear();
|
|
|
|
+// ui->dialogList->hide();
|
|
|
|
+// this->ui->dialogbox->hide();
|
|
|
|
+// QString text = "Завершающий этап";
|
|
|
|
+// QString info = "Необходимые приготовления завершены. Сейчас вы будете перенаправлены в раздел «Настройки», где сможете выбрать патчи, которые хотите установить. После этого перейдите в раздел «Патчи» для начала их загрузки и применения.";
|
|
|
|
+// app->helper->myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "close gotooptions", "",400, 200, true, false);
|
|
|
|
+
|
|
|
|
+// } else {
|
|
|
|
+// break;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(command == "gotooptions"){
|
|
|
|
+// app->helper->checkTab("optbox");
|
|
|
|
+// app->config->setValue("Local", "runfirst", "1");
|
|
|
|
+// app->helper->setState("free");
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(command == "applypaths"){
|
|
|
|
+// app->ready = true;
|
|
|
|
+// app->config->deleteSection("Applied");
|
|
|
|
+// app->network->getPaths();
|
|
|
|
+// app->helper->checkTab("mainbox");
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(command == "loaddatfile"){
|
|
|
|
+// app->config->deleteSection("Applied");
|
|
|
|
+// QString filename = app->config->getDatPath(0);
|
|
|
|
+// qInfo("%s:%i: %s%s", __FILE__, __LINE__, "Удаляем файл: ", app->helper->stringToChar(filename));
|
|
|
|
+// app->helper->closeDatFile(0);
|
|
|
|
+// if(QFile::remove(filename)){
|
|
|
|
+// app->helper->startGame();
|
|
|
|
+// qApp->exit();
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
- App *app = &App::getInstance();
|
|
|
|
- QStringList commands = app->helper->dialog_ok_answer.split(" ");
|
|
|
|
- foreach(QString command, commands){
|
|
|
|
- if(command == "close"){
|
|
|
|
- this->ui->dialogbox->hide();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(command == "gamefind"){
|
|
|
|
- QStringList folders = app->config->getLotroPath();
|
|
|
|
- if(folders.count() > 1){
|
|
|
|
- QString text = "Результаты поиска";
|
|
|
|
- QString info = "Найдены следующие папки в которых установлена игра:<br/><br/><br/><br/><br/>Выберите нужную папку и нажмите «Далее»<br/>";
|
|
|
|
- app->helper->myDialogBox(text, info, "Далее", "Отмена", "gandalf.png", "writefolder", "", 530, 200, true, false);
|
|
|
|
- app->window->ui->dialogList->setGeometry(QRect(
|
|
|
|
- app->window->ui->dialogImage->rect().right() + 10,
|
|
|
|
- app->window->ui->dialogHeader->rect().bottom()+40, 417, 50));
|
|
|
|
-
|
|
|
|
- foreach(QString f, folders) new QListWidgetItem(f, app->window->ui->dialogList);
|
|
|
|
- app->window->ui->dialogList->show();
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- if(folders.count() == 1){
|
|
|
|
- app->window->ui->lotropathLabel->setText(folders.first());
|
|
|
|
- app->config->setValue("Local", "folder", folders.first());
|
|
|
|
- this->ui->dialogbox->hide();
|
|
|
|
- QString text = "Завершающий этап";
|
|
|
|
- QString info = "Необходимые приготовления завершены. Сейчас вы будете перенаправлены в раздел «Настройки», где сможете выбрать патчи, которые хотите установить. После этого перейдите в раздел «Патчи» для начала их загрузки и применения.";
|
|
|
|
- app->helper->myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "close gotooptions", "",400, 200, true, false);
|
|
|
|
- } else {
|
|
|
|
- QString text = "Завершающий этап";
|
|
|
|
- QString info = "Обнаружить каталог игры автоматически не удалось. Сейчас вы будете перенаправлены в раздел «Настройки», где сможете вручную выбрать каталог игры и патчи, которые хотите установить. После этого перейдите в раздел «Патчи» для начала их загрузки и применения.";
|
|
|
|
- app->helper->myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "close gotooptions", "",450, 200, true, false);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+}
|
|
|
|
|
|
- qDebug() << folders;
|
|
|
|
- }
|
|
|
|
|
|
+void MainWindow::on_cancelButton_clicked(){
|
|
|
|
+// QStringList commands = app->helper->dialog_cancel_answer.split(" ");
|
|
|
|
+// foreach(QString command, commands){
|
|
|
|
+// if(command == "close") this->ui->dialogbox->hide();
|
|
|
|
+// }
|
|
|
|
+}
|
|
|
|
|
|
- if(command == "writefolder"){
|
|
|
|
- if(app->window->ui->dialogList->currentItem()){
|
|
|
|
- QString path = app->window->ui->dialogList->currentItem()->text();qDebug() << path;
|
|
|
|
- app->window->ui->lotropathLabel->setText(path);
|
|
|
|
- app->config->setValue("Local", "folder", path);
|
|
|
|
- app->window->ui->dialogList->clear();
|
|
|
|
- app->window->ui->dialogList->hide();
|
|
|
|
- this->ui->dialogbox->hide();
|
|
|
|
- QString text = "Завершающий этап";
|
|
|
|
- QString info = "Необходимые приготовления завершены. Сейчас вы будете перенаправлены в раздел «Настройки», где сможете выбрать патчи, которые хотите установить. После этого перейдите в раздел «Патчи» для начала их загрузки и применения.";
|
|
|
|
- app->helper->myDialogBox(text, info, "OK", "Отмена", "gandalf.png", "close gotooptions", "",400, 200, true, false);
|
|
|
|
|
|
|
|
|
|
+void MainWindow::checkTab(QString tabname){
|
|
|
|
+ QList<QGroupBox *> boxes = findChildren<QGroupBox *> ();
|
|
|
|
+ foreach (QGroupBox * box, boxes){
|
|
|
|
+ if(box->parent()->objectName() == "centralWidget"){
|
|
|
|
+ QLabel* boximage = findChild<QLabel*>(box->objectName() + "Image");
|
|
|
|
+ if(box->objectName() == tabname){
|
|
|
|
+ box->show();
|
|
|
|
+ if(boximage != nullptr) boximage->show();
|
|
} else {
|
|
} else {
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(command == "gotooptions"){
|
|
|
|
- app->helper->checkTab("optbox");
|
|
|
|
- app->config->setValue("Local", "runfirst", "1");
|
|
|
|
- app->helper->setState("free");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(command == "applypaths"){
|
|
|
|
- app->ready = true;
|
|
|
|
- app->config->deleteSection("Applied");
|
|
|
|
- app->network->getPaths();
|
|
|
|
- app->helper->checkTab("mainbox");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(command == "loaddatfile"){
|
|
|
|
- app->config->deleteSection("Applied");
|
|
|
|
- QString filename = app->config->getDatPath(0);
|
|
|
|
- qInfo("%s:%i: %s%s", __FILE__, __LINE__, "Удаляем файл: ", app->helper->stringToChar(filename));
|
|
|
|
- app->helper->closeDatFile(0);
|
|
|
|
- if(QFile::remove(filename)){
|
|
|
|
- app->helper->startGame();
|
|
|
|
- qApp->exit();
|
|
|
|
|
|
+ box->hide();
|
|
|
|
+ if(boximage != nullptr) boximage->hide();
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ ui->serversbox->show();
|
|
|
|
+}
|
|
|
|
|
|
|
|
+void MainWindow::myDialogBox(QString text, QString info, QString okText, QString cancelText, QString image, QString okAnswer, QString cancelAnswer,
|
|
|
|
+ int w, int h, bool textshadow = false, bool is_cancel = false){
|
|
|
|
|
|
-}
|
|
|
|
|
|
+ if(okAnswer == "") okAnswer = "close";
|
|
|
|
+ //app->helper->dialog_ok_answer = okAnswer;
|
|
|
|
+ if(cancelAnswer == "") cancelAnswer = "close";
|
|
|
|
+ //app->helper->dialog_cancel_answer = cancelAnswer;
|
|
|
|
|
|
-void MainWindow::on_cancelButton_clicked(){
|
|
|
|
|
|
+ ui->okButton->setText(okText);
|
|
|
|
+ ui->cancelButton->setText(cancelText);
|
|
|
|
+ ui->dialogbox->setGeometry(0, 0, width(), height());
|
|
|
|
|
|
- App *app = &App::getInstance();
|
|
|
|
- QStringList commands = app->helper->dialog_cancel_answer.split(" ");
|
|
|
|
- foreach(QString command, commands){
|
|
|
|
- if(command == "close") this->ui->dialogbox->hide();
|
|
|
|
|
|
+ QSettings settings(Skin::getInstance()->getSkinFile(), QSettings::IniFormat );
|
|
|
|
+ settings.beginGroup("mainWindow");
|
|
|
|
+ int left = (settings.value("width").toInt() - w)/2;
|
|
|
|
+ int top = (settings.value("height").toInt() - h)/2;
|
|
|
|
+ ui->dialog->setGeometry(QRect(left, top, w, h));
|
|
|
|
+ settings.endGroup();
|
|
|
|
|
|
|
|
+ int image_height = ui->dialog->rect().height() - ui->dialogHeader->rect().height();
|
|
|
|
+ ui->dialogImage->setGeometry(0,
|
|
|
|
+ ui->dialogHeader->rect().bottom(),
|
|
|
|
+ image_height/2 ,image_height
|
|
|
|
+ );
|
|
|
|
|
|
|
|
+ QString skin = Skin::getInstance()->getSkinName();
|
|
|
|
+ QString iconpath = "";
|
|
|
|
+ iconpath = FileSystem::fileExists("styles/" + skin + "/" + image) ? "styles/" + skin + "/" + image : ":/res/styles/" + skin + "/" + image;
|
|
|
|
+ QPixmap icon(iconpath);
|
|
|
|
|
|
|
|
+ ui->dialogImage->setPixmap(icon.scaled(ui->dialogImage->width(), ui->dialogImage->height()));
|
|
|
|
+ if(icon.isNull()){
|
|
|
|
+ ui->dialogImage->setGeometry(QRect(10, 10, 10, 10));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ui->dialogHeader->setGeometry(
|
|
|
|
+ ui->dialogHeader->rect().left(),
|
|
|
|
+ ui->dialogHeader->rect().top(),
|
|
|
|
+ ui->dialog->rect().width(),
|
|
|
|
+ ui->dialogHeader->rect().height()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ ui->dialogInfo->setGeometry(ui->dialogImage->rect().right(),
|
|
|
|
+ ui->dialogHeader->rect().bottom(),
|
|
|
|
+ ui->dialog->rect().width() - ui->dialogImage->rect().width()-7,
|
|
|
|
+ image_height - ui->cancelButton->height()
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(is_cancel){
|
|
|
|
+ ui->cancelButton->setGeometry(
|
|
|
|
+ ui->dialog->rect().left() + ui->dialog->width() - ui->cancelButton->width() - 20,
|
|
|
|
+ ui->dialog->rect().bottom() - ui->cancelButton->height() - 10,
|
|
|
|
+ ui->cancelButton->width(),
|
|
|
|
+ ui->cancelButton->height()
|
|
|
|
+ );
|
|
|
|
+ ui->okButton->setGeometry(
|
|
|
|
+ ui->dialog->rect().left() + ui->dialog->width() - ui->cancelButton->width() - ui->cancelButton->width() - 40,
|
|
|
|
+ ui->dialog->rect().bottom() - ui->cancelButton->height() - 10,
|
|
|
|
+ ui->cancelButton->width(),
|
|
|
|
+ ui->cancelButton->height()
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ ui->cancelButton->setGeometry(-1000,-1000, ui->cancelButton->width(), ui->cancelButton->height());
|
|
|
|
+ ui->okButton->setGeometry(
|
|
|
|
+ ui->dialog->rect().left() + ui->dialog->width() - ui->cancelButton->width() - 20,
|
|
|
|
+ ui->dialog->rect().bottom() - ui->cancelButton->height() - 10,
|
|
|
|
+ ui->cancelButton->width(),
|
|
|
|
+ ui->cancelButton->height()
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ ui->dialogHeader->setText(text);
|
|
|
|
+ ui->dialogInfo->setText(info);
|
|
|
|
+ ui->dialogImage->setText("");
|
|
|
|
+ ui->dialogbox->show();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+void MainWindow::setAbout(){
|
|
|
|
+ qInfo("%s:%i: %s", __FILE__, __LINE__, "Размещаем информацию о хороших людях.");
|
|
|
|
+ ui->programmerslist->setText("Gi1dor, coder");
|
|
|
|
+ ui->designerslist->setText("Чирик, valyot, Quilanar, Eodoro");
|
|
|
|
+ ui->translatorslist->setText("Arissa, unnamedartist, valyot, Чирик, Eodoro, Ferdik, Tukbard, Alcassar, Satenskyhou, Quilanar, Коралан, Invizet, taiki_exe, Rhymer, Takhizis, Lauraldo, seventhgate027, Kerita, Хилко, Leodgar, Juolukka, Auruman, Drazgar, Tondred, Foldoren, Exildil, Anormir, Василий Волков, Andoriel, Felicer, noldohini, Gi1dor, Progylkin, Arkwendir, Bara Norkins, Siltier, Maxsikr, Nahkrin, Nick_os, Razverg, ENDrain, ToX4SHOW, Jeyolin, Frenni, Коралан, Palmuch, Marty");
|
|
|
|
+ ui->helperslist->setText("Menelhad, Мурзилка, Pastor, Alvees, Mirta, иван петров, vensys, Arkelas, Чеширская Улыбка, Shanishka70 ");
|
|
|
|
+}
|