From 9450f1c48c57a65ff51c4a78101e5e4474f684ad Mon Sep 17 00:00:00 2001 From: Florian Bury Date: Wed, 21 Oct 2015 19:05:51 +0200 Subject: [PATCH 1/4] Add Settings-Page to manage Logfiles. --- fsettingsdialog.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++--- fsettingsdialog.h | 5 +++++ fsettingsdialog.ui | 36 ++++++++++++++++++++++++++++- 3 files changed, 92 insertions(+), 4 deletions(-) diff --git a/fsettingsdialog.cpp b/fsettingsdialog.cpp index 538ce65..7c915e9 100644 --- a/fsettingsdialog.cpp +++ b/fsettingsdialog.cpp @@ -21,6 +21,7 @@ FSettingsDialog::FSettingsDialog(FDB *db, QWidget *parent) : ui->listWidget->addItem(tr("Artwork")); ui->listWidget->addItem(tr("Watched Folders")); ui->listWidget->addItem(tr("Launchers")); + ui->listWidget->addItem(tr("Logfiles")); // ui->listWidget->addItem(tr("Savegame-Sync")); ui->listWidget->setCurrentRow(0); @@ -40,7 +41,7 @@ FSettingsDialog::FSettingsDialog(FDB *db, QWidget *parent) : ui->cb_int_language->setCurrentIndex(idx); #endif - //########################## + //================================= //WatchedFolders QList tmpList = db->getWatchedFoldersList(); ui->lw_Folder_FolderList->clear(); @@ -50,13 +51,13 @@ FSettingsDialog::FSettingsDialog(FDB *db, QWidget *parent) : ui->lw_Folder_FolderList->addItem(tmpList[i].getDirectory().absolutePath()); } - //########################## + //================================= // LAUNCHERS loadLaunchers(); - //########################## + //================================= //Savegame-Sync ui->le_sync_path->setText(db->getTextPref("sync_target", "")); ui->sb_sync_backups->setValue(db->getIntPref("sync_No_of_Backups", 0)); @@ -66,6 +67,47 @@ FSettingsDialog::FSettingsDialog(FDB *db, QWidget *parent) : ui->cb_gen_useTrayIcon->setChecked(db->getBoolPref("useTrayIcon", true)); + //================================= + // Log-Files + loadLogfiles(); + +} + +void FSettingsDialog::loadLogfiles() { + ui->lw_log_logfiles->clear(); + + QDir logDir = LibFusion::getWorkingDir().absolutePath() + QDir::separator() + "Logs"; + QStringList logfiles = logDir.entryList(); + for(QString log : logfiles) { + if(log.length()>3) //do skip "." and ".." and other wrong stuff + ui->lw_log_logfiles->addItem(log); + } + + +} + +void FSettingsDialog::on_pb_log_openFolder_clicked() +{ + + QDir logDir = LibFusion::getWorkingDir().absolutePath() + QDir::separator() + "Logs"; + QDesktopServices::openUrl(logDir.absolutePath()); +} + +void FSettingsDialog::on_pb_log_clear_clicked() +{ + if(QMessageBox::question(this, "Please Confirm", "Do you really want to delete all Logfiles?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) + return; + + QDir logDir = LibFusion::getWorkingDir().absolutePath() + QDir::separator() + "Logs"; + QStringList logfiles = logDir.entryList(); + for(QString log : logfiles) { + if(log.length()>3) //do skip "." and ".." and other wrong stuff + { + QFile::remove(logDir.absolutePath() + "/" + log); // logfile(logDir + "/" + log); + } + } + + loadLogfiles(); } FSettingsDialog::~FSettingsDialog() @@ -98,6 +140,13 @@ void FSettingsDialog::on_listWidget_currentRowChanged(int i) ui->settingPages->setCurrentIndex(i); } +void FSettingsDialog::on_lw_log_logfiles_itemDoubleClicked(QListWidgetItem *item) +{ + QDir logDir = LibFusion::getWorkingDir().absolutePath() + QDir::separator() + "Logs"; + QString filename = item->text(); + QDesktopServices::openUrl(logDir.absolutePath() + "/" + filename); +} + void FSettingsDialog::on_pb_selectStylesheet_clicked() { QString stylesheetFile = QFileDialog::getOpenFileName(this, tr("Choose stylesheet"), QDir::homePath(), "*.qss"); diff --git a/fsettingsdialog.h b/fsettingsdialog.h index 40542a6..3e28661 100644 --- a/fsettingsdialog.h +++ b/fsettingsdialog.h @@ -35,8 +35,13 @@ class FSettingsDialog : public QDialog FLauncher *selectedLauncher; void loadLaunchers(); void updateLauncher(); + void loadLogfiles(); private slots: + void on_pb_log_openFolder_clicked(); + void on_pb_log_clear_clicked(); + void on_listWidget_currentRowChanged(int i); + void on_lw_log_logfiles_itemDoubleClicked(QListWidgetItem * item); void on_pb_selectStylesheet_clicked(); void on_pb_ResetStylesheet_clicked(); diff --git a/fsettingsdialog.ui b/fsettingsdialog.ui index f92ae24..a9afd72 100644 --- a/fsettingsdialog.ui +++ b/fsettingsdialog.ui @@ -69,7 +69,7 @@ - 2 + 6 @@ -539,6 +539,40 @@ $GAMEEXE The path to the executable, relative to $GAMEPATH + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Delete Logfiles + + + + + + + Open Folder + + + + + From 85c437923552fa63558205f13366d7beca67fd6b Mon Sep 17 00:00:00 2001 From: Florian Bury Date: Wed, 21 Oct 2015 19:08:58 +0200 Subject: [PATCH 2/4] Update german language-file --- FusionLang_de.qm | Bin 12594 -> 12141 bytes FusionLang_de.ts | 63 +++++++++++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/FusionLang_de.qm b/FusionLang_de.qm index fee07b910d52b0d81a5622ec7486659a092db405..9f57cdcb376508329239596361202f8bfcdad576 100644 GIT binary patch delta 1158 zcmZ`&ZBSHY7(Ki9-o5*Amj!`kZ~=Gu1_PmRiWyS3_>hl*0coU}#2MLLq}c%tGO=h; zv}Oz(oy{pw)C`KjNr`oe5n@UKahee&BUE6>AE_}mW*O1+b!>mspMKnX?)$#ap7%WG zJlntJUgg0MPal93Kx_ii1BhLIv^)vq@mstKajFdvPC{D08eoaEwTE~E(v@Z)ejcII z{akxc)V>AKA42KoT0onD@)H@r$~siM?F5ph@q%VQ5HpEQTHcqC3P=KUJzlR65mxYOzhg6m+ zJhT&4Mn6Wl#h5ZGmqjsl>2V6%BqnA(4@6uRciZTU%_g?j9;Sf3Vpr~YI*=yz40N;p zSMf~CM)C~$(ISaoJpF(IqNRdS3!wW*YRw%5f`+Bj!3`e37%BDjKeFbybakkKg*&8K z`6up=Xx8lH{<2CxMq4zkOLo9;NaG#7NJ|fEI)9`yiP@UlFUA3uD$U)3V~lg1Y}VO; z!bmjl%jVf97|D4#COs7}Z3-Udd~B!BD3=PX#{g`GTCy5v8edzDVuv{?m=DB+Iw$ai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AT8Bc-2NMtsxr3UxJCsR#4sbvxIZh8M101h zwsQJ)8T%*kri_Y`Xsmlng^4W_;# z?(731Gx*o&SLGz#^pTEUrzCOatvpanJgVQ22 z?CH^8ReQD3tI~Ty@E)-qpBpgPbT zQMeM#E>s{uvpNnxoRK!QLo$yVRRnx>KEE^iWKO2ik&F`F*3wx3&!L(wM;-gMquOgY zv~%Q;wZvcBIOfxYGTP6C2X2nV(N}UWDGhF{nf^QyrAY?1z#nB5K#T$U9D#&WcKA7(z?L zuD6*@m9!0pnj7d{mP2FK=bY{-X;?_B6;vZgWn@@M&(F1Q>@4(uGKR_~UuZ?W^(mj+ K6jity6#oG}j$q#a diff --git a/FusionLang_de.ts b/FusionLang_de.ts index bbc1b50..171037a 100644 --- a/FusionLang_de.ts +++ b/FusionLang_de.ts @@ -137,7 +137,7 @@ - + ... ... @@ -203,7 +203,17 @@ ... - + + Delete Logfiles + Lösche Logfiles + + + + Open Folder + Öffne Log-Ordner + + + To enable Syncing, select the Savegame-Folder in the Settings Dialog in each game, and a synced Directory here - for Example an Dropbox or OwnCloud folder. Fusion will then keep these Directorys up to date by overriding the old data. @@ -245,13 +255,13 @@ $GAMEPATH Pfad zum Spiel $GAMEEXE Name des Ausführbaren Datei, relativ zu $GAMEPATH - + Local saved Backups: Anzahl Backups: - - + + Target-Dir Ziel-Verzeichnis @@ -286,77 +296,82 @@ $GAMEEXE Name des Ausführbaren Datei, relativ zu $GAMEPATH Launcher - + + Logfiles + Logfiles + + + Choose stylesheet Wähle Stylesheet - - - + + + Error Fehler - + Please set a name. Bitte Namen angeben. - + Please set a path. Bitte Pfad angeben - + This name already exists! Dieser Name existiert bereits! - + Choose launcher Wähle Launcher - - + + Please confirm! Bitte bestätigen! - + If artwork is found, existing artwork will be overwritten! Wird Artwork gefunden, werden vorhandene Grafiken ersetzt! - + Choose the library folder Wähle einen Ordner - + Do you really want to remove Willst du folgenden Pfad wirklich entfernen? - + The games inside won't be removed from your disk. Die Spiele im Ordner werden nicht entfernt - - + + Running downloads: Laufende Downloads: - + Downloads finished Downloads beendet - + Finished %n download(s) %n Download beendet @@ -543,7 +558,7 @@ Game LIBRARY - LIBRARY + BIBLIOTHEK From 3493a7fb703cd69ce7d84fe2c048c31ad3d032bb Mon Sep 17 00:00:00 2001 From: Florian Bury Date: Wed, 21 Oct 2015 20:01:38 +0200 Subject: [PATCH 3/4] Basic Input-Checking for AddGames --- addgamedialog.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/addgamedialog.cpp b/addgamedialog.cpp index 0fbe485..d305247 100644 --- a/addgamedialog.cpp +++ b/addgamedialog.cpp @@ -2,6 +2,7 @@ #include "ui_addgamedialog.h" #include "fgame.h" #include +#include #include "fdb.h" #include "flauncher.h" @@ -56,6 +57,22 @@ void AddGameDialog::on_chooseGameExecutableButton_clicked() void AddGameDialog::on_buttonBox_accepted() { game.setName(ui->gameNameEdit->text()); + + if(game.getName().length() <= 0) { + QMessageBox::warning(this, "Please fill all fields!", "You have to fill the name-field!", QMessageBox::Ok); + return; + } + + if(game.getExe().length() <= 0) { + QMessageBox::warning(this, "Please fill all fields!", "You have to set an executable!", QMessageBox::Ok); + return; + } + + if(game.getPath().length() <= 0) { + QMessageBox::warning(this, "Please fill all fields!", "You have to set a path!", QMessageBox::Ok); + return; + } + game.setCommand(ui->gameCommandEdit->text()); game.setArgs(QStringList(ui->gameArgsEdit->text())); game.setType(Executable); From ce3ff43c44f715153525294d5e767dfe9c6e94d1 Mon Sep 17 00:00:00 2001 From: Florian Bury Date: Wed, 21 Oct 2015 20:32:23 +0200 Subject: [PATCH 4/4] Set the "last played"-label initially empty --- mainwindow.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mainwindow.ui b/mainwindow.ui index 8605b8f..98bbf04 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -444,7 +444,7 @@ - lbl_lastPlayed +