|
@@ -1,6 +1,6 @@
|
|
#include "mainwindow.h"
|
|
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
-#include "legacyapp.h"
|
|
|
|
|
|
+#include "models/lotromanager.h"
|
|
|
|
|
|
#include <QBitmap>
|
|
#include <QBitmap>
|
|
#include <QPainter>
|
|
#include <QPainter>
|
|
@@ -12,33 +12,39 @@
|
|
#include <QDesktopWidget>
|
|
#include <QDesktopWidget>
|
|
#include <QtConcurrent/QtConcurrent>
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
|
|
-MainWindow::MainWindow(LegacyApp *app, QWidget *parent) :
|
|
|
|
|
|
+MainWindow::MainWindow(LotroManager* mgr, QSettings* settings, QWidget *parent) :
|
|
QMainWindow(parent, Qt::Window | Qt::FramelessWindowHint), app(app),
|
|
QMainWindow(parent, Qt::Window | Qt::FramelessWindowHint), app(app),
|
|
ui(new Ui::MainWindow), menuHoverWidget(nullptr), menuHoverWidgetAnimation(nullptr)
|
|
ui(new Ui::MainWindow), menuHoverWidget(nullptr), menuHoverWidgetAnimation(nullptr)
|
|
{
|
|
{
|
|
-}
|
|
|
|
|
|
|
|
-void MainWindow::Init() {
|
|
|
|
- ui->setupUi(this);
|
|
|
|
|
|
+ QDebug << "Initialising Settings module";
|
|
|
|
+ QSettings *settings = new QSettings(qApp->applicationDirPath() + "/legacy_v2.ini", QSettings::IniFormat);
|
|
|
|
|
|
- qDebug() << "Stage 1 beginnig: Initialising frames";
|
|
|
|
|
|
|
|
- export_frame = new ExportWidget(app, this);
|
|
|
|
- import_frame = new ImportWidget(app, this);
|
|
|
|
- manage_frame = new ManageWidget(app, this);
|
|
|
|
- browse_frame = new BrowseWidget(app, this);
|
|
|
|
|
|
+ QDebug << "Creating lotro manager instance & thread";
|
|
|
|
+ QThread *lotro_mgr_thread = new QThread();
|
|
|
|
+ LotroManager *lotro_mgr = new LotroManager(settings);
|
|
|
|
+ QObject::connect(lotro_mgr_thread, &QThread::finished, lotro_mgr, &QObject::deleteLater, type=Qt::QueuedConnection);
|
|
|
|
+ lotro_mgr->moveToThread(lotro_mgr_thread);
|
|
|
|
+ lotro_mgr_thread->run();
|
|
|
|
|
|
- ui->content_layout->addWidget(export_frame);
|
|
|
|
- ui->content_layout->addWidget(import_frame);
|
|
|
|
- ui->content_layout->addWidget(manage_frame);
|
|
|
|
- ui->content_layout->addWidget(browse_frame);
|
|
|
|
|
|
+ QDebug << "Creating widgets";
|
|
|
|
+ browse_widget = new BrowseWidget(lotro_mgr, settings, this);
|
|
|
|
+ import_widget = new ImportWidget(lotro_mgr, settings, this);
|
|
|
|
+ export_widget = new ExportWidget(lotro_mgr, settings, this);
|
|
|
|
+ manage_widget = new ManageWidget(lotro_mgr, settings, this);
|
|
|
|
|
|
|
|
+ ui->content_layout->addWidget(export_widget);
|
|
|
|
+ ui->content_layout->addWidget(import_widget);
|
|
|
|
+ ui->content_layout->addWidget(manage_widget);
|
|
|
|
+ ui->content_layout->addWidget(browse_widget);
|
|
|
|
|
|
- hideAllContentWidgets();
|
|
|
|
- manage_frame->show();
|
|
|
|
|
|
+ ui->centralWidget->setStyleSheet("");
|
|
|
|
|
|
- qDebug() << "Stage 1 completed: Initialised frames";
|
|
|
|
|
|
+ hideAllContentWidgets();
|
|
|
|
+ manage_widget->show();
|
|
|
|
|
|
|
|
+ qDebug() << "Making fonts and making background";
|
|
changeFontSizeRecursive(100, this);
|
|
changeFontSizeRecursive(100, this);
|
|
|
|
|
|
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
@@ -50,10 +56,12 @@ void MainWindow::Init() {
|
|
updateGeometry();
|
|
updateGeometry();
|
|
repaint();
|
|
repaint();
|
|
|
|
|
|
|
|
+ qDebug() << "Initialising background updates";
|
|
background_update_timer.setInterval(30 * 1000);
|
|
background_update_timer.setInterval(30 * 1000);
|
|
connect(&background_update_timer, &QTimer::timeout, this, &MainWindow::randomChangeBackground);
|
|
connect(&background_update_timer, &QTimer::timeout, this, &MainWindow::randomChangeBackground);
|
|
background_update_timer.start();
|
|
background_update_timer.start();
|
|
- ui->centralWidget->setStyleSheet("");
|
|
|
|
|
|
+
|
|
|
|
+ qDebug() << "Finighing main frame initialisation";
|
|
show();
|
|
show();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -69,9 +77,9 @@ void MainWindow::mouseMoveEvent(QMouseEvent *event)
|
|
{
|
|
{
|
|
if (event->buttons() & Qt::LeftButton) {
|
|
if (event->buttons() & Qt::LeftButton) {
|
|
move(event->globalPos() - dragPosition);
|
|
move(event->globalPos() - dragPosition);
|
|
- app->process_window->move(event->globalPos() - dragPosition +
|
|
|
|
- QPoint((width() - app->process_window->width()) / 2, (height() - app->process_window->height()) / 2)
|
|
|
|
- );
|
|
|
|
|
|
+// app->process_window->move(event->globalPos() - dragPosition +
|
|
|
|
+// QPoint((width() - app->process_window->width()) / 2, (height() - app->process_window->height()) / 2)
|
|
|
|
+// );
|
|
event->accept();
|
|
event->accept();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -145,25 +153,25 @@ MainWindow::~MainWindow()
|
|
void MainWindow::on_menuentry_1_common_clicked()
|
|
void MainWindow::on_menuentry_1_common_clicked()
|
|
{
|
|
{
|
|
hideAllContentWidgets();
|
|
hideAllContentWidgets();
|
|
- manage_frame->show();
|
|
|
|
|
|
+ manage_widget->show();
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_menuentry_2_common_clicked()
|
|
void MainWindow::on_menuentry_2_common_clicked()
|
|
{
|
|
{
|
|
hideAllContentWidgets();
|
|
hideAllContentWidgets();
|
|
- export_frame->show();
|
|
|
|
|
|
+ export_widget->show();
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_menuentry_3_common_clicked()
|
|
void MainWindow::on_menuentry_3_common_clicked()
|
|
{
|
|
{
|
|
hideAllContentWidgets();
|
|
hideAllContentWidgets();
|
|
- import_frame->show();
|
|
|
|
|
|
+ import_widget->show();
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_menuentry_4_common_clicked()
|
|
void MainWindow::on_menuentry_4_common_clicked()
|
|
{
|
|
{
|
|
hideAllContentWidgets();
|
|
hideAllContentWidgets();
|
|
- browse_frame->show();
|
|
|
|
|
|
+ browse_widget->show();
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::onHoverMenuentry()
|
|
void MainWindow::onHoverMenuentry()
|
|
@@ -175,7 +183,6 @@ void MainWindow::setupWindowBackgroundAndMask()
|
|
{
|
|
{
|
|
current_bg = background->scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
|
current_bg = background->scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
|
current_mask = current_bg.mask();
|
|
current_mask = current_bg.mask();
|
|
- current_mask.save(QApplication::applicationDirPath() + "/abacaba.png");
|
|
|
|
setMask(current_mask);
|
|
setMask(current_mask);
|
|
|
|
|
|
QPalette palette;
|
|
QPalette palette;
|