Skip to content

Commit

Permalink
[fixed] local installation bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAnswer committed Nov 13, 2013
1 parent 1e0e5ba commit 8786c41
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion gameprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bool GameProcess::start(const QString& folder, const QString& executable, const
connect(process, SIGNAL(started()), this, SLOT(started()));

QStringList env = process->environment();
env.append("SWGCLIENT_MEMORY_SIZE_MB=4096");
//env.append("SWGCLIENT_MEMORY_SIZE_MB=4096");

qDebug() << "env:" << env;
process->setEnvironment(env);
Expand Down
26 changes: 16 additions & 10 deletions installfromswg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ void InstallFromSWG::copyFinished() {
}

void InstallFromSWG::closeEvent(QCloseEvent* event) {
qDebug() << "close event";

cancelThreads = true;

if (copyWatcher.isRunning()) {
copyWatcher.cancel();
copyWatcher.waitForFinished();
}

done(2);

QDialog::closeEvent(event);
}

Expand All @@ -68,12 +72,12 @@ int InstallFromSWG::copyFiles() {
//if (QDir(file))

if (file.first.contains("/")) {
QString dir = emuFolder + "\\" + file.first.mid(0, file.first.lastIndexOf("/"));
QString dir = emuFolder + file.first.mid(0, file.first.lastIndexOf("/"));

QDir(dir).mkpath(".");
}

bool result = QFile::copy(swgfolder + "\\" + file.first, emuFolder + "\\" + file.first);
bool result = QFile::copy(swgfolder + "\\" + file.first, emuFolder + file.first);

//bool result = true;
//QTimer::singleShot(0, this, SLOT(fileCopied(file.first, result)));
Expand All @@ -89,15 +93,9 @@ int InstallFromSWG::copyFiles() {
void InstallFromSWG::fileCopied(const QString& file, bool success) {
if (success) {
ui->label->setText(file + " successfully installed");

ui->progressBar->setValue(ui->progressBar->value()+ 1);
} else {
//ui->label->setPalette(QPalette(Qt::red));
ui->label->setText("Unable to copy file: " + file);

ui->progressBar->setValue(ui->progressBar->maximum());
}

ui->progressBar->setValue(ui->progressBar->value() + 1);
}

int InstallFromSWG::checkSWGFolder() {
Expand Down Expand Up @@ -142,12 +140,20 @@ int InstallFromSWG::installFiles() {
QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks);

if (!QDir(emuFolder).exists()) {
if (!QDir(emuFolder).exists() || emuFolder.isEmpty()) {
QMessageBox::warning(this, "Folder", "The swgemu folder you selected isnt a valid directory");

return 1;
}

//qDebug() << emuFolder;
emuFolder = emuFolder + "/SWGEmu/";

if (QDir(emuFolder).exists()) {
if (QMessageBox::question(this, "Warning", "SWGEmu folder already exists, do you want to overwrite?") != QMessageBox::Yes)
return 3;
}

QVector<QPair<QString, qint64> > requiredFiles = MainWindow::getRequiredFiles();

ui->progressBar->setValue(0);
Expand Down
22 changes: 12 additions & 10 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ QString MainWindow::patchUrl = "http://www.launchpad2.net/SWGEmu/";
QString MainWindow::newsUrl = "http://www.swgemu.com/forums/index.php#bd";
QString MainWindow::gameExecutable = "SWGEmu.exe";
QString MainWindow::selfUpdateUrl = "http://launchpad2.net/setup.cfg";
const QString MainWindow::version = "0.12";
const QString MainWindow::version = "0.13";

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
Expand Down Expand Up @@ -275,12 +275,12 @@ int MainWindow::loadAndBasicCheckFiles(QString swgFolder) {

QFile* MainWindow::getRequiredFilesFile() {
QSettings settings;
QString folder = settings.value("swg_folder").toString();
//QString folder = settings.value("swg_folder").toString();

QFile* file = NULL;

if (QDir(folder).exists()) {
file = new QFile(folder + "/required2.txt");
//if (QDir(folder).exists()) {
file = new QFile("required2.txt");

if (file->exists()) {
if (file->open(QIODevice::ReadOnly | QIODevice::Text)) {
Expand All @@ -290,7 +290,7 @@ QFile* MainWindow::getRequiredFilesFile() {
} else {
delete file;
}
}
//}

file = new QFile(":/files/required2.txt");
file->open(QIODevice::ReadOnly | QIODevice::Text);
Expand Down Expand Up @@ -558,10 +558,10 @@ void MainWindow::requiredFileDownloadFileFinished(QNetworkReply* reply) {
// qDebug() << data;

QSettings settings;
QString folder = settings.value("swg_folder").toString();
// QString folder = settings.value("swg_folder").toString();

if (QDir(folder).exists()) {
QFile file(folder + "/" + "required2.txt");
// if (QDir(folder).exists()) {
QFile file("required2.txt");

if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream stream(&file);
Expand All @@ -572,7 +572,7 @@ void MainWindow::requiredFileDownloadFileFinished(QNetworkReply* reply) {

return;
}
}
//}

startLoadBasicCheck();

Expand Down Expand Up @@ -625,7 +625,9 @@ void MainWindow::startFullScan(bool forceConfigRestore) {

QSettings settings;
QString folder = settings.value("swg_folder").toString();
if (!QDir(folder).exists() || folder.isEmpty()) {
QDir checkDir(folder);

if (!checkDir.exists() || folder.isEmpty() || checkDir.count() < 5) {
QMessageBox::warning(this, "ERROR", "Invalid game folder!");

return;
Expand Down

0 comments on commit 8786c41

Please sign in to comment.