diff --git a/LaunchDrop.png b/LaunchDrop.png
new file mode 100644
index 0000000..0e2cb9a
Binary files /dev/null and b/LaunchDrop.png differ
diff --git a/README.md b/README.md
index 6735f94..871cc19 100644
--- a/README.md
+++ b/README.md
@@ -32,22 +32,18 @@ Rocket Launcher 2.0 also features a new tab allowing you to configure each engin
### Qt Framework
-This allows for this project to be cross platform, including support for Linux and OSX. For windows I provide a static build, which means it's provided as a single executable with no additional DLL's required or frameworks to install.
+This allows for this project to be cross platform, including support for Linux and Windows.
### Installation
-#### Windows
+#### Windows (7 or later)
-Download executable here: https://github.com/Hypnotoad90/RocketLauncher2/releases/download/0.1.0.1/RocketLauncher2_v0101.zip
+Download executable here: https://github.com/paynworth/RocketLauncher2/releases/download/v1.1/RocketLauncherPW_v1.1.zip
#### Linux
No binaries available as of yet. To compile, simply grab Qt5-default package, then run qmake, followed by make, on the source code.
-#### Mac
-
-Coming soon.
-
### Thanks to:
Blzut3: for helping me with some Qt queries.
diff --git a/RLPics/LaunchDrop.png b/RLPics/LaunchDrop.png
index 0edcb54..0e2cb9a 100644
Binary files a/RLPics/LaunchDrop.png and b/RLPics/LaunchDrop.png differ
diff --git a/RocketLauncher2.pro b/RocketLauncher2.pro
index 68f0fc3..3474f53 100644
--- a/RocketLauncher2.pro
+++ b/RocketLauncher2.pro
@@ -18,15 +18,18 @@ SOURCES += main.cpp\
dndfilesystemlistview.cpp \
hyp_commonfunc.cpp \
configs.cpp \
- enginesetup.cpp
+ enginesetup.cpp \
+ commandlinedialog.cpp
HEADERS += rocketlauncher2.h \
abstractmodels.h \
dndfilesystemlistview.h \
hyp_commonfunc.h \
- configs.h
+ configs.h \
+ commandlinedialog.h
-FORMS += rocketlauncher2.ui
+FORMS += rocketlauncher2.ui \
+ commandlinedialog.ui
RESOURCES += \
resources.qrc
diff --git a/abstractmodels.cpp b/abstractmodels.cpp
index f989283..db4292b 100644
--- a/abstractmodels.cpp
+++ b/abstractmodels.cpp
@@ -216,6 +216,10 @@ int EngineListModel::SearchEngines(const QString name)
return -1;
}
+bool EngineListModel::isEmpty(){
+ return Engines_.isEmpty();
+}
+
void EngineListModel::LoadEngineData()
{
int size = EngineSettings.beginReadArray("Engines");
@@ -242,7 +246,9 @@ void EngineListModel::LoadEngineData()
void EngineListModel::SaveEngineData()
{
+
EngineSettings.beginWriteArray("Engines");
+ EngineSettings.clear();
for (int i = 0; i < Engines_.count(); i++)
{
EngineSettings.setArrayIndex(i);
@@ -338,6 +344,24 @@ void EngineListModel::removeRow(int row, const QModelIndex &parent)
QAbstractListModel::removeRow(row, parent);
}
+void EngineListModel::moveRowDown(int row, const QModelIndex &parent)
+{
+ if (!Engines_.isEmpty() && (row < Engines_.size()-1)){
+ Engines_.move(row, row+1);
+ QModelIndex sibling = parent.sibling(row+1, parent.column());
+ QAbstractListModel::moveRow(parent, row, sibling, row+1);
+ }
+}
+
+void EngineListModel::moveRowUp(int row, const QModelIndex &parent)
+{
+ if (!Engines_.isEmpty() && (row > 0)){
+ Engines_.move(row, row-1);
+ QModelIndex sibling = parent.sibling(row-1, parent.column());
+ QAbstractListModel::moveRow(parent, row, sibling, row-1);
+ }
+}
+
void EngineListModel::addDefaultEngine(QString path)
{
QFileInfo tempfile(path);
@@ -346,11 +370,11 @@ void EngineListModel::addDefaultEngine(QString path)
QMessageBox::information(NULL,"Error",QString("Failed to add executable."));
return;
}
-
- EngineInfo newengine = {path, "Custom engine", Engine_Default, Pic_Default};
+ QString fileName(tempfile.fileName());
+ EngineInfo newengine = {path, fileName, Engine_Default, Pic_Default};
Engines_ << newengine;
QMessageBox::information(NULL,"Executable Added",QString("Custom engine added!"));
- emit updateCombo("Custom engine");
+ emit updateCombo(fileName);
emit dataChanged(QModelIndex(),QModelIndex());
SaveEngineData();
}
diff --git a/abstractmodels.h b/abstractmodels.h
index 6c1be4e..b7fb0c5 100644
--- a/abstractmodels.h
+++ b/abstractmodels.h
@@ -53,7 +53,8 @@ enum EnginePic
Pic_Retro,
Pic_Vavoom,
Pic_Doomsday,
- Pic_Edge
+ Pic_Edge,
+ Pic_LZdoom
};
struct EngineInfo
@@ -90,9 +91,12 @@ class EngineListModel : public QAbstractListModel {
QString updateEngine(QString engine, QString path, EngineType type, EnginePic pic, bool known);
bool EngineSet;
void LoadEngineData();
+ bool isEmpty();
EngineType getEngineType();
QString DoomExePath;
void removeRow(int row, const QModelIndex &parent = QModelIndex());
+ void moveRowDown(int row, const QModelIndex &parent = QModelIndex());
+ void moveRowUp(int row, const QModelIndex &parent = QModelIndex());
QSettings EngineSettings;
void SaveEngineData();
EngineType getEngineTypeFromIndex(const QModelIndex &index);
diff --git a/commandlinedialog.cpp b/commandlinedialog.cpp
new file mode 100644
index 0000000..0a69c35
--- /dev/null
+++ b/commandlinedialog.cpp
@@ -0,0 +1,22 @@
+#include "commandlinedialog.h"
+#include "ui_commandlinedialog.h"
+
+CommandLineDialog::CommandLineDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::CommandLineDialog)
+{
+ ui->setupUi(this);
+
+ connect(ui->button_copycmd, SIGNAL(pressed()), this, SLOT(copyText()));
+
+}
+
+void CommandLineDialog::setTextBox(QString cmdargs){
+ ui->text_cmd->setPlainText(cmdargs);
+ ui->text_cmd->setReadOnly(true);
+}
+void CommandLineDialog::copyText(){
+ ui->text_cmd->selectAll();
+ ui->text_cmd->copy();
+
+}
diff --git a/commandlinedialog.h b/commandlinedialog.h
new file mode 100644
index 0000000..0a6bf27
--- /dev/null
+++ b/commandlinedialog.h
@@ -0,0 +1,26 @@
+#ifndef COMMANDLINEDIALOG_H
+#define COMMANDLINEDIALOG_H
+
+#include
+
+namespace Ui {
+class CommandLineDialog;
+}
+
+class CommandLineDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit CommandLineDialog(QWidget *parent = 0);
+
+private:
+ Ui::CommandLineDialog *ui;
+
+signals:
+
+public slots:
+ void setTextBox(const QString cmdargs);
+ void copyText();
+};
+
+#endif // COMMANDLINEDIALOG_H
diff --git a/commandlinedialog.ui b/commandlinedialog.ui
new file mode 100644
index 0000000..1bf9981
--- /dev/null
+++ b/commandlinedialog.ui
@@ -0,0 +1,85 @@
+
+
+ CommandLineDialog
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Doomseeker - Copy Text
+
+
+ -
+
+
+ Text to copy:
+
+
+
+ -
+
+
+ -
+
+
-
+
+
+ Copy to clipboard
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Close
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ CommandLineDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ CommandLineDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/configs.cpp b/configs.cpp
index 7b68c71..ebf20c1 100644
--- a/configs.cpp
+++ b/configs.cpp
@@ -26,16 +26,46 @@
#include
#include
#include
+#include
void RocketLauncher2::on_button_loadConfigExt_clicked()
{
- QString settingsDir = QFileDialog::getOpenFileName(this,"Load a configuration file.", QString(),"Rocket Files (*.rocket)");
+ QString configsLocation = QStandardPaths::locate(QStandardPaths::AppConfigLocation, QString(), QStandardPaths::LocateDirectory);
+ QString settingsDir = QFileDialog::getOpenFileName(this,"Load a configuration file.", configsLocation,"Rocket Files (*.rocket)");
if (settingsDir != NULL)
{
loadExtConfig(settingsDir);
}
}
+void RocketLauncher2::autoLoadConfig(){
+ AutoLoad.beginReadArray("configs");
+ if (AutoLoad.contains("name"))
+ {
+ RocketFile *rocket = new RocketFile();
+ rocket->name = AutoLoad.value("name").toString();
+ rocket->engName = AutoLoad.value("engName").toString();
+ rocket->iwadName = AutoLoad.value("iwadName").toString();
+ rocket->filePaths = AutoLoad.value("filePaths").toStringList();
+ rocket->map = AutoLoad.value("map").toString();
+ rocket->skill = AutoLoad.value("skill").toInt();
+ rocket->addCmd = AutoLoad.value("addCmd").toString();
+ rocket->demo = AutoLoad.value("demo").toBool();
+ rocket->demoName = AutoLoad.value("demoName").toString();
+ rocket->noMonsters = AutoLoad.value("noMonsters").toBool();
+ rocket->noMusic = AutoLoad.value("noMusic").toBool();
+
+ foreach( QVariant v, AutoLoad.value("filesChecked").toList())
+ {
+ rocket->filesChecked << v.toBool();
+ }
+
+ applyConfig(rocket);
+ delete rocket;
+ }
+}
+
+
void RocketLauncher2::initConfigs()
{
conflist = new ConfigListModel();
@@ -49,7 +79,6 @@ void RocketLauncher2::initConfigs()
rocket.name = ConfigSettings.value("name").toString();
rocket.engName = ConfigSettings.value("engName").toString();
rocket.iwadName = ConfigSettings.value("iwadName").toString();
- rocket.resPaths = ConfigSettings.value("resPaths").toStringList();
rocket.filePaths = ConfigSettings.value("filePaths").toStringList();
rocket.map = ConfigSettings.value("map").toString();
rocket.skill = ConfigSettings.value("skill").toInt();
@@ -92,14 +121,9 @@ RocketFile RocketLauncher2::makeConfigFromCurrent(QString name)
{
RocketFile rocket;
rocket.name = name;
- rocket.engName = enginelist->getCurrentEngine()->name;
+ if (!enginelist->isEmpty()) rocket.engName = enginelist->getCurrentEngine()->name;
rocket.iwadName = returnSelectedDndViewItemData(ui->listbox_IWADs, Qt::DisplayRole);
- for (int row = 0; row < reslist->rowCount(); row++)
- {
- if (reslist->item(row)->checkState() == Qt::Checked)
- rocket.resPaths.append(reslist->item(row)->data(Qt::UserRole).toString());
- }
for (int row = 0; row < pwadloadlist->rowCount(); row++)
{
rocket.filePaths.append(pwadloadlist->item(row)->data(Qt::UserRole).toString());
@@ -136,7 +160,7 @@ void RocketLauncher2::applyConfig(RocketFile *rocket)
}
else
{
- QMessageBox::information(this, "Engine not found!", QString("Warning, %1 engine could not be found.").arg(rocket->engName));
+ //QMessageBox::information(this, "Engine not found!", QString("Warning, %1 engine could not be found.").arg(rocket->engName));
}
QModelIndexList indexes = iwadlist->match(iwadlist->index(0,0),Qt::DisplayRole,QVariant::fromValue(rocket->iwadName));
@@ -150,30 +174,21 @@ void RocketLauncher2::applyConfig(RocketFile *rocket)
QMessageBox::information(this, "IWAD not found!", QString("Warning, %1 IWAD could not be found.").arg(rocket->iwadName));
}
- for (int i = 0; i < rocket->resPaths.count(); i++)
- {
- QModelIndexList resindex = reslist->match(reslist->index(0,0),Qt::UserRole,QVariant::fromValue(rocket->resPaths.at(i)));
- if (resindex.count() > 0)
- {
- reslist->itemFromIndex(resindex.at(0))->setCheckState(Qt::Checked);
- }
- else
- {
- QMessageBox::information(this, "File Missing" , QString("Resource file missing (%1)").arg(rocket->resPaths.at(i)));
- }
- }
-
pwadloadlist->clear();
if (rocket->filePaths.count() == rocket->filesChecked.count())
{
+ int listi = 0;
for (int i = 0; i < rocket->filePaths.count(); i++)
{
- addpwad(rocket->filePaths.at(i));
- if (rocket->filesChecked.at(i).toBool() == true)
- pwadloadlist->item(i)->setCheckState(Qt::Checked);
- else
- pwadloadlist->item(i)->setCheckState(Qt::Unchecked);
+ if (addpwad(rocket->filePaths.at(i)) == true){
+ if (rocket->filesChecked.at(i).toBool() == true)
+ pwadloadlist->item(listi)->setCheckState(Qt::Checked);
+ else
+ pwadloadlist->item(listi)->setCheckState(Qt::Unchecked);
+ listi++;
+ }
+
}
}
@@ -194,7 +209,9 @@ void RocketLauncher2::applyConfig(RocketFile *rocket)
ui->check_nomusic->setChecked(rocket->noMusic);
ui->input_record->setText(rocket->demoName);
- QMessageBox::information(this, "Success", QString("%1 configuration loaded.").arg(rocket->name));
+ //QMessageBox::information(this, "Success", QString("%1 configuration loaded.").arg(rocket->name));
+
+ ui->tabWidget_rlauncher->setCurrentIndex(0);
}
@@ -206,12 +223,13 @@ void RocketLauncher2::on_button_loadFavConfig_clicked()
void RocketLauncher2::saveToExternal(RocketFile &rocket, QString name)
{
- QString settingsDir = QFileDialog::getSaveFileName(this,"Choose where you wish to save the configuration.", m_mainAppPath.filePath(name + ".rocket"),"Rocket Files (*.rocket)");
+ QString configsLocation = QStandardPaths::locate(QStandardPaths::AppConfigLocation, QString(), QStandardPaths::LocateDirectory);
+ QString rocketDirPath = configsLocation+name+".rocket";
+ QString settingsDir = QFileDialog::getSaveFileName(this,"Choose where you wish to save the configuration.", rocketDirPath,"Rocket Files (*.rocket)");
QSettings rocketSetting(settingsDir,QSettings::IniFormat);
rocketSetting.setValue("name", rocket.name);
rocketSetting.setValue("engName",rocket.engName);
rocketSetting.setValue("iwadName",rocket.iwadName);
- rocketSetting.setValue("resPaths",rocket.resPaths);
rocketSetting.setValue("filePaths",rocket.filePaths);
rocketSetting.setValue("map",rocket.map);
rocketSetting.setValue("skill",rocket.skill);
@@ -236,8 +254,9 @@ void RocketLauncher2::on_button_saveConfigExt_clicked()
if (!inputExists(name))
{
- QMessageBox::information(this,"Input Name", "Please input a name for this config to be saved");
- return;
+ //QMessageBox::information(this,"Input Name", "Please input a name for this config to be saved");
+ //return;
+ name = "My Rocket";
}
RocketFile rocket = makeConfigFromCurrent(name);
@@ -245,6 +264,31 @@ void RocketLauncher2::on_button_saveConfigExt_clicked()
}
+void RocketLauncher2::saveToAutoLoad()
+{
+ RocketFile rocket = RocketLauncher2::makeConfigFromCurrent("AutoLoad");
+ AutoLoad.setValue("name", rocket.name);
+ AutoLoad.setValue("engName",rocket.engName);
+ AutoLoad.setValue("iwadName",rocket.iwadName);
+ AutoLoad.setValue("filePaths",rocket.filePaths);
+ AutoLoad.setValue("map",rocket.map);
+ AutoLoad.setValue("skill",rocket.skill);
+ AutoLoad.setValue("addCmd",rocket.addCmd);
+ AutoLoad.setValue("demo",rocket.demo);
+ AutoLoad.setValue("demoName",rocket.demoName);
+ AutoLoad.setValue("noMonsters",rocket.noMonsters);
+ AutoLoad.setValue("noMusic",rocket.noMusic);
+ QVariantList filesCheckedVariant;
+
+ foreach (auto v, rocket.filesChecked)
+ {
+ filesCheckedVariant << v;
+ }
+
+ AutoLoad.setValue("filesChecked", filesCheckedVariant);
+ AutoLoad.endArray();
+}
+
void RocketLauncher2::saveToGlobal(RocketFile &rocket)
{
int fsize = ConfigSettings.beginReadArray("configs");
@@ -254,7 +298,6 @@ void RocketLauncher2::saveToGlobal(RocketFile &rocket)
ConfigSettings.setValue("name", rocket.name);
ConfigSettings.setValue("engName",rocket.engName);
ConfigSettings.setValue("iwadName",rocket.iwadName);
- ConfigSettings.setValue("resPaths",rocket.resPaths);
ConfigSettings.setValue("filePaths",rocket.filePaths);
ConfigSettings.setValue("map",rocket.map);
ConfigSettings.setValue("skill",rocket.skill);
@@ -280,7 +323,6 @@ void RocketLauncher2::saveToGlobalFromList(RocketFile *rocket, int index)
ConfigSettings.setValue("name", rocket->name);
ConfigSettings.setValue("engName",rocket->engName);
ConfigSettings.setValue("iwadName",rocket->iwadName);
- ConfigSettings.setValue("resPaths",rocket->resPaths);
ConfigSettings.setValue("filePaths",rocket->filePaths);
ConfigSettings.setValue("map",rocket->map);
ConfigSettings.setValue("skill",rocket->skill);
@@ -331,7 +373,6 @@ void RocketLauncher2::loadExtConfig(QString path)
rocket->name = rocketSetting.value("name").toString();
rocket->engName = rocketSetting.value("engName").toString();
rocket->iwadName = rocketSetting.value("iwadName").toString();
- rocket->resPaths = rocketSetting.value("resPaths").toStringList();
rocket->filePaths = rocketSetting.value("filePaths").toStringList();
rocket->map = rocketSetting.value("map").toString();
rocket->skill = rocketSetting.value("skill").toInt();
diff --git a/configs.h b/configs.h
index f15b625..e8466c5 100644
--- a/configs.h
+++ b/configs.h
@@ -31,7 +31,6 @@ class RocketFile
QString name;
QString engName;
QString iwadName;
- QStringList resPaths;
QStringList filePaths;
QVariantList filesChecked;
QString map;
diff --git a/enginesetup.cpp b/enginesetup.cpp
index 121cf4c..b607c8f 100644
--- a/enginesetup.cpp
+++ b/enginesetup.cpp
@@ -48,11 +48,72 @@ void RocketLauncher2::on_button_removeEng_clicked()
ui->listbox_engines->setUpdatesEnabled(true);
ui->combo_Engines->setUpdatesEnabled(true);
enginelist->EngineSettings.beginWriteArray("Engines");
- ConfigSettings.remove("");
enginelist->EngineSettings.endArray();
enginelist->SaveEngineData();
+ if (!enginelist->isEmpty()){
+ enginelist->setCurrentEngine(0);
+ enginelist->updateComboIndex(0);
+ enginelist->EngineSet = true;
+ } else {enginelist->EngineSet = false;}
}
+void RocketLauncher2::on_button_moveEngineUp_clicked()
+{
+ if (!ui->listbox_engines->currentIndex().isValid()){return;}
+
+ ui->listbox_engines->setUpdatesEnabled(false);
+ ui->combo_Engines->setUpdatesEnabled(false);
+ QModelIndexList indexes = ui->listbox_engines->selectionModel()->selectedIndexes();
+ qSort(indexes.begin(), indexes.end());
+ QModelIndex currentIndex;
+ for (int i = indexes.count() - 1; i > -1; --i)
+ {
+ currentIndex = indexes.at(i);
+ enginelist->moveRowUp(currentIndex.row());
+
+ }
+ ui->listbox_engines->setUpdatesEnabled(true);
+ ui->combo_Engines->setUpdatesEnabled(true);
+ enginelist->EngineSettings.beginWriteArray("Engines");
+ enginelist->EngineSettings.endArray();
+ enginelist->SaveEngineData();
+ if (!enginelist->isEmpty()){
+ enginelist->setCurrentEngine(0);
+ enginelist->updateComboIndex(0);
+ enginelist->EngineSet = true;
+ } else {enginelist->EngineSet = false;}
+ ui->listbox_engines->setCurrentIndex(ui->listbox_engines->model()->index(currentIndex.row()-1,0));
+}
+
+void RocketLauncher2::on_button_moveEngineDown_clicked()
+{
+ if (!ui->listbox_engines->currentIndex().isValid()){return;}
+
+ ui->listbox_engines->setUpdatesEnabled(false);
+ ui->combo_Engines->setUpdatesEnabled(false);
+ QModelIndexList indexes = ui->listbox_engines->selectionModel()->selectedIndexes();
+ qSort(indexes.begin(), indexes.end());
+ QModelIndex currentIndex;
+ for (int i = indexes.count() - 1; i > -1; --i)
+ {
+ currentIndex = indexes.at(i);
+ enginelist->moveRowDown(currentIndex.row());
+
+ }
+ ui->listbox_engines->setUpdatesEnabled(true);
+ ui->combo_Engines->setUpdatesEnabled(true);
+ enginelist->EngineSettings.beginWriteArray("Engines");
+ enginelist->EngineSettings.endArray();
+ enginelist->SaveEngineData();
+ if (!enginelist->isEmpty()){
+ enginelist->setCurrentEngine(0);
+ enginelist->updateComboIndex(0);
+ enginelist->EngineSet = true;
+ } else {enginelist->EngineSet = false;}
+
+ ui->listbox_engines->setCurrentIndex(ui->listbox_engines->model()->index(currentIndex.row()+1,0));
+
+}
void RocketLauncher2::on_listbox_engines_clicked(const QModelIndex &index)
{
@@ -104,7 +165,8 @@ void RocketLauncher2::on_listbox_engines_clicked(const QModelIndex &index)
ui->combo_EngPic->setCurrentText("Vavoom");
else if (pic == Pic_Doomsday)
ui->combo_EngPic->setCurrentText("Doomsday");
-
+ else if (pic == Pic_LZdoom)
+ ui->combo_EngPic->setCurrentText("LZdoom");
}
void RocketLauncher2::on_button_addCustEng_clicked()
@@ -140,8 +202,11 @@ void RocketLauncher2::on_button_selEngBrowse_clicked()
{
QModelIndex index = ui->listbox_engines->selectionModel()->selectedIndexes()[0];
QString path = QFileDialog::getOpenFileName(this, "Locate executable.");
- enginelist->setPathFromIndex(path, index);
- ui->input_selEngPath->setText(path);
+ if (!path.isEmpty()){
+ enginelist->setPathFromIndex(path, index);
+ ui->input_selEngPath->setText(path);
+ }
+
}
else
{
@@ -184,7 +249,7 @@ void RocketLauncher2::on_combo_EngPic_currentTextChanged(const QString &arg1)
enginelist->setPicFromIndex(Pic_Edge, index);
else if (arg1 == "Eternity")
enginelist->setPicFromIndex(Pic_Eternity, index);
- else if (arg1 == "GZDoom")
+ else if (arg1 == "GZdoom")
enginelist->setPicFromIndex(Pic_GZdoom, index);
else if (arg1 == "Legacy")
enginelist->setPicFromIndex(Pic_Legacy, index);
@@ -200,6 +265,8 @@ void RocketLauncher2::on_combo_EngPic_currentTextChanged(const QString &arg1)
enginelist->setPicFromIndex(Pic_ZDaemon, index);
else if (arg1 == "Zdoom")
enginelist->setPicFromIndex(Pic_Zdoom, index);
+ else if (arg1 == "LZdoom")
+ enginelist->setPicFromIndex(Pic_LZdoom, index);
SetEnginePic(enginelist->getCurrentEngine()->EngineImage);
}
diff --git a/hyp_commonfunc.cpp b/hyp_commonfunc.cpp
index d0ca98a..40a0d57 100644
--- a/hyp_commonfunc.cpp
+++ b/hyp_commonfunc.cpp
@@ -57,7 +57,6 @@ void removeSelectedFromDnDListView(DndFileSystemListView *listview, QStandardIte
listview->setUpdatesEnabled(true);
}
-
void removeSelectedFromDnDListViewSave(DndFileSystemListView *listview, QStandardItemModel *model, QString ArrayName, QString key, QSettings &settings)
{
listview->setUpdatesEnabled(false);
@@ -95,6 +94,7 @@ bool updateDndListView(QString filepath, QStandardItemModel *model, bool checkab
item->setData(file.fileName(),Qt::DisplayRole);
item->setData(file.absoluteFilePath(),Qt::UserRole);
+ item->setToolTip(file.absoluteFilePath());
item->setDragEnabled(true);
item->setDropEnabled(false);
@@ -133,7 +133,6 @@ void copyItemToDndListView(DndFileSystemListView *source, QStandardItemModel *De
for (int i = indexes.count() - 1; i > -1; --i)
updateDndListView(indexes.at(i).data(Qt::UserRole).toString(), DestinationModel, checkable);
}
-
void copyItemToDndListViewSave(DndFileSystemListView *source, QStandardItemModel *DestinationModel, bool checkable, QString array, QString key, QSettings &settings)
{
QModelIndexList indexes = source->selectionModel()->selectedIndexes();
@@ -146,6 +145,85 @@ void copyItemToDndListViewSave(DndFileSystemListView *source, QStandardItemModel
}
}
+void moveItemWithinDndListView(DndFileSystemListView *source, QStandardItemModel *DestinationModel, bool moveDown = false)
+{
+ source->setUpdatesEnabled(false);
+ QModelIndexList indexes = source->selectionModel()->selectedIndexes();
+ qSort(indexes.begin(), indexes.end());
+
+ QList rows;
+ if (moveDown){
+ for (int i = indexes.count() - 1; i > -1; --i)
+ {
+ if ((indexes.at(i).sibling(indexes.at(i).row()+1,indexes.at(i).column()).isValid()) == false){break;}
+ rows = DestinationModel->takeRow(indexes.at(i).row());
+ qDebug() << indexes.at(i).row();
+ DestinationModel->insertRow(indexes.at(i).row()+1,rows);
+ source->setCurrentIndex(source->model()->index(indexes.at(i).row()+1,0));
+ }
+
+ } else {
+ for (int i = indexes.count() - 1; i > -1; --i)
+ {
+ if (indexes.at(i).row()-1 < 0){break;}
+ rows = DestinationModel->takeRow(indexes.at(i).row());
+ qDebug() << indexes.at(i).row();
+ DestinationModel->insertRow(indexes.at(i).row()-1,rows);
+ source->setCurrentIndex(source->model()->index(indexes.at(i).row()-1,0));
+ }
+ }
+
+ source->setUpdatesEnabled(true);
+}
+void moveItemWithinDndListViewSave(DndFileSystemListView *source, QStandardItemModel *DestinationModel, QString array, QString key, QSettings &settings, bool moveDown)
+{
+ source->setUpdatesEnabled(false);
+ QModelIndexList indexes = source->selectionModel()->selectedIndexes();
+ qSort(indexes.begin(), indexes.end());
+
+ QList rows;
+
+ if (moveDown){
+ for (int i = indexes.count() - 1; i > -1; --i)
+ {
+ if ((indexes.at(i).sibling(indexes.at(i).row()+1,indexes.at(i).column()).isValid()) == false){break;}
+ rows = DestinationModel->takeRow(indexes.at(i).row());
+ qDebug() << indexes.at(i).row();
+ DestinationModel->insertRow(indexes.at(i).row()+1,rows);
+ source->setCurrentIndex(source->model()->index(indexes.at(i).row()+1,0));
+ settings.beginWriteArray(array);
+ settings.remove("");
+ for (int i = 0; i < DestinationModel->rowCount(); i++)
+ {
+ settings.setArrayIndex(i);
+ settings.setValue(key, DestinationModel->item(i)->data(Qt::UserRole).toString());
+ }
+ settings.endArray();
+
+ }
+ } else {
+ for (int i = indexes.count() - 1; i > -1; --i)
+ {
+ if (indexes.at(i).row()-1 < 0){break;}
+ rows = DestinationModel->takeRow(indexes.at(i).row());
+ qDebug() << indexes.at(i).row();
+ DestinationModel->insertRow(indexes.at(i).row()-1,rows);
+ source->setCurrentIndex(source->model()->index(indexes.at(i).row()-1,0));
+ settings.beginWriteArray(array);
+ settings.remove("");
+ for (int i = 0; i < DestinationModel->rowCount(); i++)
+ {
+ settings.setArrayIndex(i);
+ settings.setValue(key, DestinationModel->item(i)->data(Qt::UserRole).toString());
+ }
+ settings.endArray();
+
+ }
+ }
+
+ source->setUpdatesEnabled(true);
+}
+
QString returnSelectedDndViewItemData(DndFileSystemListView *listview, int role)
{
QModelIndexList indexes = listview->selectionModel()->selectedIndexes();
@@ -159,7 +237,7 @@ QString returnSelectedDndViewItemData(DndFileSystemListView *listview, int role)
QModelIndex getIndexOfDisplayText(QAbstractItemModel *model, QString text)
{
- QModelIndexList indexes = model->match(model->index(0,0), Qt::DisplayRole,QVariant::fromValue(text));
+ QModelIndexList indexes = model->match(model->index(0,0), Qt::DisplayRole,QVariant::fromValue(text),1,Qt::MatchExactly);
if (indexes.count()> 0)
return indexes.at(0);
diff --git a/hyp_commonfunc.h b/hyp_commonfunc.h
index d59027f..b78aff6 100644
--- a/hyp_commonfunc.h
+++ b/hyp_commonfunc.h
@@ -42,9 +42,10 @@ void saveListviewPath(QString ArrayName, QString key, QString Path, QSettings &s
void removeSelectedFromDnDListViewSave(DndFileSystemListView *listview, QStandardItemModel *model, QString ArrayName, QString key, QSettings &settings);
void copyItemToDndListView(DndFileSystemListView *source, QStandardItemModel *DestinationModel, bool checkable);
+void moveItemWithinDndListView(DndFileSystemListView *source, QStandardItemModel *DestinationModel, bool moveDown);
void copyItemToDndListViewSave(DndFileSystemListView *source, QStandardItemModel *DestinationModel, bool checkable, QString array, QString key, QSettings &settings);
-
+void moveItemWithinDndListViewSave(DndFileSystemListView *source, QStandardItemModel *DestinationModel, QString array, QString key, QSettings &settings, bool moveDown = false);
QString returnSelectedDndViewItemData(DndFileSystemListView *listview, int role = Qt::UserRole);
QModelIndex getIndexOfDisplayText(QAbstractItemModel *model, QString text);
diff --git a/img/GZDLogo.png b/img/GZDLogo.png
index 8154027..63dd52c 100644
Binary files a/img/GZDLogo.png and b/img/GZDLogo.png differ
diff --git a/img/LZDLogo.png b/img/LZDLogo.png
new file mode 100644
index 0000000..83aae2c
Binary files /dev/null and b/img/LZDLogo.png differ
diff --git a/img/ZDoomlogo.png b/img/ZDoomlogo.png
index 5f29c8e..93ab991 100644
Binary files a/img/ZDoomlogo.png and b/img/ZDoomlogo.png differ
diff --git a/resources.qrc b/resources.qrc
index 24257b8..d97c497 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -15,5 +15,6 @@
img/rocket.ico
img/vavoom2.png
img/Zdaemonlogo.png
+ img/LZDLogo.png
diff --git a/rocketlauncher2.cpp b/rocketlauncher2.cpp
index d899390..7686dff 100644
--- a/rocketlauncher2.cpp
+++ b/rocketlauncher2.cpp
@@ -1,4 +1,4 @@
-/* This file (rocketlauncher2.cpp) is part of Rocket Launcher 2.0 - A cross platform
+/* This file (rocketlauncher2.cpp) is part of Rocket Launcher 2.0 - A cross platform
* front end for all DOOM engine source ports.
*
* Copyright (C) Hypnotoad
@@ -31,11 +31,15 @@
#include
#include
#include
+#include
+#include
+#include
#include "dndfilesystemlistview.h"
#include "rocketlauncher2.h"
#include "ui_rocketlauncher2.h"
#include "hyp_commonfunc.h"
+#include "commandlinedialog.h"
//==========Initialization==========
@@ -43,7 +47,8 @@ RocketLauncher2::RocketLauncher2(QWidget *parent, int argc, char *argv[]) :
QMainWindow(parent),
ui(new Ui::RocketLauncher2),
settings(QSettings::IniFormat,QSettings::UserScope,"RocketLauncher2","settings"),
- ConfigSettings(QSettings::IniFormat,QSettings::UserScope,"RocketLauncher2","SavedConfigs")
+ ConfigSettings(QSettings::IniFormat,QSettings::UserScope,"RocketLauncher2","SavedConfigs"),
+ AutoLoad(QSettings::IniFormat,QSettings::UserScope,"RocketLauncher2","AutoLoad")
{
//settings = QSettings(QSettings::IniFormat,QSettings::UserScope,"RocketLauncher2","settings");
qDebug() << settings.fileName();
@@ -52,10 +57,12 @@ RocketLauncher2::RocketLauncher2(QWidget *parent, int argc, char *argv[]) :
m_settingsfile = m_mainAppPath.filePath("settings.ini");
m_wadextfilters << "*.wad" << "*.pk3" << ".pk7";
ui->setupUi(this);
+ setupAdditionalUi();
initListViews();
-
+ connect(ui->button_enginename, SIGNAL(pressed()), this, SLOT(on_input_selEngName_returnPressed()));
+ connect(ui->listbox_configFavs, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_button_loadFavConfig_clicked()));
connect(ui->listbox_pwadload, SIGNAL(fileSystemPathDropped(QString)), this, SLOT(addpwad(QString)));
connect(enginelist, SIGNAL(updateCombo(const QString)), this, SLOT(setEngineSelection(const QString)));
connect(enginelist, SIGNAL(updateComboIndex(int)), this, SLOT(setEngineSelectionIndex(int)));
@@ -64,12 +71,15 @@ RocketLauncher2::RocketLauncher2(QWidget *parent, int argc, char *argv[]) :
connect(ui->listbox_pwadload, SIGNAL(internalItemDropped(QDropEvent*)), this, SLOT(copyItemToPwads(QDropEvent*)));
connect(ui->listbox_IWADs, SIGNAL(internalItemDropped(QDropEvent*)), this, SLOT(copyItemToIwads(QDropEvent*)));
connect(ui->listbox_IWADs, SIGNAL(fileSystemPathDropped(QString)), this, SLOT(addToIWADs(const QString)));
- connect(ui->listbox_res, SIGNAL(fileSystemPathDropped(QString)), this, SLOT(addToRes(const QString)));
- connect(ui->listbox_res, SIGNAL(internalItemDropped(QDropEvent*)), this, SLOT(copyItemToRes(QDropEvent*)));
+ connect(ui->listbox_fav, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayListRightClickMenu_Favs(const QPoint)));
+ connect(ui->listbox_IWADs, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayListRightClickMenu_Iwads(const QPoint)));
+ connect(ui->listbox_pwadload, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayListRightClickMenu_Pwads(const QPoint)));
+
initPixmaps();
initConfigs();
loadsettings();
enginelist->LoadEngineData();
+ autoLoadConfig();
if (enginelist->DoomExePath != "" && enginelist->DoomExePath != NULL)
ui->input_idExePath->setText(enginelist->DoomExePath);
@@ -77,18 +87,26 @@ RocketLauncher2::RocketLauncher2(QWidget *parent, int argc, char *argv[]) :
parseCmdLine(argc,argv);
//ui->listbox_pwadload->setDragDropOverwriteMode(false);
- pwadFilter = tr("WAD/PK3/ZIP/PK7/PKZ/P7Z "
- "(*.wad *.pk3 *.zip *.pk7 *.pkz)"
- ";;WAD Files (*.wad)"
- ";;PK3 Files (*.pk3)"
- ";;Patch Files (*.bex *.deh)"
- ";;PK7 Files (*.pk7)"
- ";;PKZ Files (*.pkz)"
- ";;P7Z Files (*.p7z)"
- ";;zip Files (*.zip)"
- ";;Any files (*)");
+ pwadFilter = tr("Any files (*)"
+ ";;WAD/PK3/ZIP/PK7/PKZ/P7Z "
+ "(*.wad *.pk3 *.zip *.pk7 *.pkz *.WAD *.PK3 *.ZIP *.PK7 *.PKZ *.P7Z)"
+ ";;WAD Files (*.wad *.WAD)"
+ ";;PK3 Files (*.pk3 *.PK3)"
+ ";;Patch Files (*.bex *.deh *.BEX *.DEH)"
+ ";;PK7 Files (*.pk7 *.PK7)"
+ ";;PKZ Files (*.pkz *.PKZ)"
+ ";;P7Z Files (*.p7z *.P7Z)"
+ ";;zip Files (*.zip *.ZIP)");
+}
+
+void RocketLauncher2::closeEvent(QCloseEvent* event){
+ //Rocket AutoRocket
+ RocketLauncher2::saveToAutoLoad();
+ settings.setValue("size", size());
+ QMainWindow::closeEvent(event);
}
+
RocketLauncher2::~RocketLauncher2()
{
delete ui;
@@ -111,15 +129,55 @@ void RocketLauncher2::initPixmaps()
enginepics->append((QPixmap(":/engine/img/retrologo.png").scaled(105,105,Qt::KeepAspectRatio))); //11 RetroDoom
enginepics->append((QPixmap(":/engine/img/vavoom2.png").scaled(105,105,Qt::KeepAspectRatio))); //12 Vavoom
enginepics->append((QPixmap(":/engine/img/ddlogo.png").scaled(105,105,Qt::KeepAspectRatio))); //13 DoomsDay
+ enginepics->append((QPixmap(":/engine/img/LZDLogo.png").scaled(105,105,Qt::KeepAspectRatio))); //14 LZDoom
ui->img_engine->setPixmap(enginepics->at(0));
}
+void RocketLauncher2::setupAdditionalUi(){
+ RLMenu = new QMenu(this);
+ rlmCmdLne = new QAction("Show Command Line",this);
+ rlmLoadRocket = new QAction("Load .rocket (Ctrl+O)",this);
+ rlmSaveRocket = new QAction("Save .rocket (Ctrl+S)",this);
+ rlmCmdLne->setObjectName("Show Command Line");
+ rlmLoadRocket->setObjectName("Load .rocket");
+ rlmSaveRocket->setObjectName("Save .rocket");
+ RLMenu->addAction(rlmCmdLne);
+ RLMenu->addAction(rlmLoadRocket);
+ RLMenu->addAction(rlmSaveRocket);
+ ui->button_rocketmenu->setMenu(RLMenu);
+ connect(rlmCmdLne,SIGNAL(triggered()),this,SLOT(showCommandLine()));
+ connect(rlmLoadRocket,SIGNAL(triggered()),this,SLOT(on_button_loadConfigExt_clicked()));
+ connect(rlmSaveRocket,SIGNAL(triggered()),this,SLOT(on_button_saveConfigExt_clicked()));
+
+ ModListboxMenu = new QMenu(this);
+ mlmOpenFileBrowser = new QAction("Show in File Browser",this);
+ mlmMoveUp = new QAction("Move Up",this);
+ mlmMoveDown = new QAction("Move Down",this);
+ mlmRemove = new QAction("Remove",this);
+ ModListboxMenu->addAction(mlmOpenFileBrowser);
+ ModListboxMenu->addAction(mlmMoveUp);
+ ModListboxMenu->addAction(mlmMoveDown);
+ ModListboxMenu->addAction(mlmRemove);
+
+ adjustSize();
+
+ RLOpenShortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open")), this);
+ connect(RLOpenShortcut,SIGNAL(activated()),this,SLOT(on_button_loadConfigExt_clicked()));
+ RLSaveShortcut = new QShortcut(QKeySequence(tr("Ctrl+S", "File|Save")), this);
+ connect(RLSaveShortcut,SIGNAL(activated()),this,SLOT(on_button_saveConfigExt_clicked()));
+}
+
void RocketLauncher2::initListViews()
{
enginelist = new EngineListModel();
ui->combo_Engines->setModel(enginelist);
ui->listbox_engines->setModel(enginelist);
+ ui->listbox_engines->setAcceptDrops(true);
+ ui->listbox_engines->setDropIndicatorShown(true);
+ ui->listbox_engines->setDragDropMode(QAbstractItemView::InternalMove);
+ ui->listbox_engines->setDefaultDropAction(Qt::MoveAction);
+
pwadloadlist = new QStandardItemModel;
ui->listbox_pwadload->setModel(pwadloadlist);
ui->listbox_pwadload->setDragEnabled(true);
@@ -142,13 +200,6 @@ void RocketLauncher2::initListViews()
ui->listbox_IWADs->setDropIndicatorShown(true);
ui->listbox_IWADs->setDragDropMode(QAbstractItemView::InternalMove);
ui->listbox_IWADs->setDefaultDropAction(Qt::MoveAction);
-
- reslist = new QStandardItemModel;
- ui->listbox_res->setModel(reslist);
- ui->listbox_res->setAcceptDrops(true);
- ui->listbox_res->setDropIndicatorShown(true);
- ui->listbox_res->setDragDropMode(QAbstractItemView::InternalMove);
- ui->listbox_res->setDefaultDropAction(Qt::MoveAction);
}
//==========LOAD==========
@@ -182,18 +233,6 @@ void RocketLauncher2::loadsettings()
}
}
- settings.endArray();
- fsize = settings.beginReadArray("resfiles");
-
- if (fsize > 0)
- {
- for (int i = 0; i < fsize; i++)
- {
- settings.setArrayIndex(i);
- updateres(settings.value("resfile_path").toString(), false);
- }
- }
-
settings.endArray();
if (settings.contains("lastIwadIndex"))
@@ -201,6 +240,13 @@ void RocketLauncher2::loadsettings()
QModelIndex index = iwadlist->index( settings.value("lastIwadIndex").toInt(), 0);
ui->listbox_IWADs->setCurrentIndex(index);
}
+
+ if (settings.contains("size"))
+ {
+ QSize size = settings.value("size", QSize(400, 400)).toSize();
+ this->resize(size);
+ }
+
}
void RocketLauncher2::parseCmdLine(int argc, char *argv[])
@@ -237,9 +283,40 @@ void RocketLauncher2::parseCmdLine(int argc, char *argv[])
}
}
+void RocketLauncher2::showCommandLine(){
+ QString enginefile;
+ if (!enginelist->EngineSet)
+ {
+ QMessageBox::information(this,"Error" ,"Please select or add an engine (source port).");
+ return;
+ }
+
+ enginefile = enginelist->getCurrentEngine()->path;
+ QStringList cmd = genCommandline(true);
+
+ if (cmd[1] == "fail_IWADSELECT")
+ {
+ QMessageBox::information(this,"Error" ,"Please select your IWAD");
+ return;
+ }
+ else if (cmd[0] == "fail_DOOMEXE")
+ {
+ QMessageBox::information(this,"Error" , "Could not find original Doom Executable for DOSBox");
+ return;
+ }
+
+ QString showargs;
+ showargs = enginefile+" "+cmd.join(' ');
+ CommandLineDialog *cmdDialog = new CommandLineDialog();
+ cmdDialog->setWindowTitle("Command Line");
+ cmdDialog->setTextBox(showargs);
+ cmdDialog->show();
+
+}
+
//==========LAUNCH ENGINE==========
-QStringList RocketLauncher2::genCommandline()
+QStringList RocketLauncher2::genCommandline(bool displayOnly=false)
{
if (enginelist->getCurrentEngine()->type == Engine_DosBox)
{
@@ -256,23 +333,10 @@ QStringList RocketLauncher2::genCommandline()
ret << "fail_IWADSELECT";
return ret;
}
-
- ret << iwadpath;
-
- if (reslist->rowCount() > 0)
- {
- for (int i = 0; i < reslist->rowCount(); i++)
- {
- if (reslist->item(i)->checkState() == Qt::Checked)
- {
- if (!filesadded)
- {
- ret << "-file";
- filesadded = true;
- }
- ret << reslist->item(i)->data(Qt::UserRole).toString();
- }
- }
+ if (displayOnly == true){
+ ret << '"'+iwadpath+'"';
+ } else {
+ ret << iwadpath;
}
if (pwadloadlist->rowCount() > 0)
@@ -286,7 +350,11 @@ QStringList RocketLauncher2::genCommandline()
ret << "-file";
filesadded = true;
}
- ret << pwadloadlist->item(i)->data(Qt::UserRole).toString();
+ if (displayOnly == true){
+ ret << '"'+pwadloadlist->item(i)->data(Qt::UserRole).toString()+'"';
+ } else {
+ ret << pwadloadlist->item(i)->data(Qt::UserRole).toString();
+ }
}
}
}
@@ -353,22 +421,6 @@ QStringList RocketLauncher2::genDOSBoxcmd()
ret << "aspect = true";
bool filesadded = false;
- if (reslist->rowCount() > 0)
- {
- for (int i = 0; i < reslist->rowCount(); i++)
- {
- if (reslist->item(i)->checkState() == Qt::Checked)
- {
- if (!filesadded)
- {
- dosTemp << "-file";
- filesadded = true;
- }
- dosTemp << reslist->item(i)->data(Qt::UserRole).toString();
- }
- }
- }
-
if (pwadloadlist->rowCount() > 0)
{
for (int i = 0; i < pwadloadlist->rowCount(); i++ )
@@ -440,19 +492,14 @@ void RocketLauncher2::on_pushButton_3_clicked() //RUN
return;
}
- if (ui->check_showcmdline->isChecked())
- {
- QString showargs;
- showargs = cmd.join("\n");
- QMessageBox::information(this,"Command Line" ,showargs);
- }
-
QFileInfo engineDir(enginefile);
QDir::setCurrent(engineDir.absolutePath());
process = new QProcess();
+ process->setProcessChannelMode(QProcess::ForwardedChannels);
try
{
+ qDebug() << cmd;
process->start(enginefile,cmd);
}
catch(QException &e)
@@ -460,7 +507,6 @@ void RocketLauncher2::on_pushButton_3_clicked() //RUN
QMessageBox::warning(this,"Error" ,"Engine failed to start.");
}
}
-
//==========ENGINE SELECTION HANDLING=========
void RocketLauncher2::on_pushButton_2_clicked() //Select Engine
@@ -511,6 +557,8 @@ void RocketLauncher2::SetEnginePic(EnginePic pic)
ui->img_engine->setPixmap(enginepics->at(12));
else if (pic == Pic_Doomsday)
ui->img_engine->setPixmap(enginepics->at(13));
+ else if (pic == Pic_LZdoom)
+ ui->img_engine->setPixmap(enginepics->at(14));
}
@@ -531,9 +579,9 @@ void RocketLauncher2::setEngineSelectionIndex(int index)
//==========WAD LISTVIEW HANDLING==========
-void RocketLauncher2::addpwad(QString filepath)
+bool RocketLauncher2::addpwad(QString filepath)
{
- updateDndListView(filepath, pwadloadlist, true);
+ return updateDndListView(filepath, pwadloadlist, true);
}
void RocketLauncher2::addToFavorites(const QString filepath)
@@ -593,6 +641,83 @@ void RocketLauncher2::on_button_favremove_clicked()
this->setUpdatesEnabled(true);
}
+void RocketLauncher2::displayListRightClickMenu_Favs(const QPoint& pPoint){
+ displayListRightClickMenu(pPoint, ui->listbox_fav);
+}
+void RocketLauncher2::displayListRightClickMenu_Pwads(const QPoint& pPoint){
+ displayListRightClickMenu(pPoint, ui->listbox_pwadload);
+}
+void RocketLauncher2::displayListRightClickMenu_Iwads(const QPoint& pPoint){
+ displayListRightClickMenu(pPoint, ui->listbox_IWADs);
+}
+void RocketLauncher2::displayListRightClickMenu(const QPoint& pPoint, DndFileSystemListView *listview){
+ QPoint globalpos = listview->mapToGlobal(pPoint);
+ QModelIndexList indexes = listview->selectionModel()->selectedIndexes();
+ if (indexes.empty()) return;
+ QString filePath = returnSelectedDndViewItemData(listview,Qt::UserRole);
+ if (filePath.length() < 1) return;
+ if (!fileExists(filePath)) return;
+ QAction* selectedAction;
+ selectedAction = ModListboxMenu->exec(globalpos);
+ if(selectedAction) {
+ if(selectedAction == mlmOpenFileBrowser) {
+ qDebug() << "File Browser";
+ qDebug() << filePath;
+ QDir d = QFileInfo(filePath).absoluteDir();
+ QString absolute=d.absolutePath();
+ QDesktopServices::openUrl(QUrl::fromLocalFile(absolute));
+ } else if(selectedAction == mlmMoveUp) {
+ qDebug() << "Up";
+
+ if (listview == ui->listbox_fav){
+ qDebug() << "favourites";
+ moveItemWithinDndListViewSave(ui->listbox_fav, favlist,
+ "pwad_favs", "fav_path", settings);
+ }
+ else if (listview == ui->listbox_IWADs){
+ qDebug() << "iwads";
+ moveItemWithinDndListViewSave(ui->listbox_IWADs, iwadlist,
+ "iwads", "iwad_path", settings, false);
+ }
+ else if (listview == ui->listbox_pwadload){
+ qDebug() << "pwads";
+ moveItemWithinDndListView(ui->listbox_pwadload, pwadloadlist, false);
+ }
+ } else if(selectedAction == mlmMoveDown) {
+ qDebug() << "down";
+ if (listview == ui->listbox_fav){
+ qDebug() << "favourites";
+ moveItemWithinDndListViewSave(ui->listbox_fav, favlist,
+ "pwad_favs", "fav_path", settings, true);
+ }
+ else if (listview == ui->listbox_IWADs){
+ qDebug() << "iwads";
+ moveItemWithinDndListViewSave(ui->listbox_IWADs, iwadlist,
+ "iwads", "iwad_path", settings, true);
+ }
+ else if (listview == ui->listbox_pwadload){
+ qDebug() << "pwads";
+ moveItemWithinDndListView(ui->listbox_pwadload, pwadloadlist, true);
+ }
+ } else if(selectedAction == mlmRemove) {
+ qDebug() << "remove";
+
+ if (listview == ui->listbox_fav){
+ qDebug() << "favourites";
+ on_button_favremove_clicked();
+ }
+ if (listview == ui->listbox_pwadload){
+ qDebug() << "pwads";
+ on_button_remove_clicked();
+ }
+ if (listview == ui->listbox_IWADs){
+ qDebug() << "iwads";
+ on_button_deliwad_clicked();
+ }
+ }
+ }
+}
+
void RocketLauncher2::copyItemToPwads(QDropEvent* pEvent)
{
@@ -610,12 +735,12 @@ void RocketLauncher2::copyItemToFav(QDropEvent* pEvent)
}
void RocketLauncher2::on_button_addiwad_clicked()
-{
+{
QString title = tr("Locate an IWAD to add to the list.");
- QString filter = tr("WAD/pk3/zip (*.WAD *.pk3 *.zip)"
- ";;WAD Files (*.WAD)"
- ";;pk3 Files (*.pk3)"
- ";;zip Files (*.zip)"
+ QString filter = tr("WAD/pk3/zip (*.wad *.pk3 *.zip *.WAD *.PK3 *.ZIP)"
+ ";;WAD Files (*.wad *.WAD)"
+ ";;PK3 Files (*.pk3 *.PK3)"
+ ";;zip Files (*.zip *.ZIP)"
";;All files (*)");
updateIWADs(QFileDialog::getOpenFileName(this,title,"",filter), true);
}
@@ -649,40 +774,6 @@ void RocketLauncher2::addToIWADs(const QString filepath)
updateIWADs(filepath, true);
}
-void RocketLauncher2::on_button_addres_clicked()
-{
- QString title = tr("Locate a common resource file to add to the list.");
- updateres(QFileDialog::getOpenFileName(this,title,"",pwadFilter), true);
-}
-
-void RocketLauncher2::updateres(QString filepath, bool save)
-{
- bool noMatch = updateDndListView(filepath, reslist, true, false);
-
- if (save)
- {
- if (noMatch)
- saveListviewPath("resfiles", "resfile_path", filepath, settings);
- }
-}
-
-void RocketLauncher2::on_button_delres_clicked()
-{
- removeSelectedFromDnDListViewSave(ui->listbox_res, reslist, "resfiles", "resfile_path", settings);
-}
-
-void RocketLauncher2::addToRes(const QString filepath)
-{
- updateres(filepath, true);
-}
-
-void RocketLauncher2::copyItemToRes(QDropEvent* pEvent)
-{
- this->setUpdatesEnabled(false);
- copyItemToDndListViewSave(qobject_cast(pEvent->source()), reslist, true, "resfiles", "resfile_path", settings);
- this->setUpdatesEnabled(true);
-}
-
void RocketLauncher2::on_listbox_IWADs_clicked(const QModelIndex &index)
{
settings.setValue("lastIwadIndex",index.row());
diff --git a/rocketlauncher2.h b/rocketlauncher2.h
index d085729..5216c4e 100644
--- a/rocketlauncher2.h
+++ b/rocketlauncher2.h
@@ -29,7 +29,10 @@
#include
#include
#include
+#include
#include "configs.h"
+#include "commandlinedialog.h"
+#include "dndfilesystemlistview.h"
namespace Ui {
class RocketLauncher2;
@@ -43,6 +46,9 @@ class RocketLauncher2 : public QMainWindow
explicit RocketLauncher2(QWidget *parent = 0, int argc = 0, char *argv[] = 0);
~RocketLauncher2();
+protected:
+ void closeEvent(QCloseEvent *event);
+
private slots:
void on_pushButton_3_clicked();
@@ -51,7 +57,7 @@ private slots:
void on_combo_Engines_currentIndexChanged(int index);
- void addpwad(QString filepath);
+ bool addpwad(QString filepath);
void on_button_add_clicked();
@@ -67,8 +73,6 @@ private slots:
void addToIWADs(const QString filepath);
- void addToRes(const QString filepath);
-
//void deleteFromFavorites(const int index);
void on_button_favadd_clicked();
@@ -81,16 +85,16 @@ private slots:
void copyItemToIwads(QDropEvent* pEvent);
- void copyItemToRes(QDropEvent* pEvent);
+
+ void displayListRightClickMenu_Pwads(const QPoint& pPoint);
+ void displayListRightClickMenu_Iwads(const QPoint& pPoint);
+ void displayListRightClickMenu_Favs(const QPoint& pPoint);
+ void displayListRightClickMenu(const QPoint& pPoint, DndFileSystemListView *listview);
void on_button_addiwad_clicked();
void on_button_deliwad_clicked();
- void on_button_addres_clicked();
-
- void on_button_delres_clicked();
-
void on_listbox_IWADs_clicked(const QModelIndex &index);
void on_button_helpmap_clicked();
@@ -123,6 +127,12 @@ private slots:
void on_button_idExeBrowse_clicked();
+ void showCommandLine();
+
+ void on_button_moveEngineUp_clicked();
+
+ void on_button_moveEngineDown_clicked();
+
private:
Ui::RocketLauncher2 *ui;
QString m_settingsfile;
@@ -135,19 +145,30 @@ private slots:
EngineListModel *enginelist;
QStandardItemModel *pwadloadlist;
QStandardItemModel *favlist;
- QStandardItemModel *reslist;
ConfigListModel *conflist;
- QStringList genCommandline();
+ CommandLineDialog *cmdDialog;
+ QStringList genCommandline(bool displayOnly);
QProcess *process;
void SetEnginePic(EnginePic pic);
void initPixmaps();
QList *enginepics;
QSettings settings;
+ QMenu *RLMenu;
+ QMenu *ModListboxMenu;
+ QShortcut *RLOpenShortcut;
+ QShortcut *RLSaveShortcut;
+ QAction *rlmCmdLne;
+ QAction *rlmLoadRocket;
+ QAction *rlmSaveRocket;
+ QAction *mlmOpenFileBrowser;
+ QAction *mlmMoveUp;
+ QAction *mlmMoveDown;
+ QAction *mlmRemove;
void parseCmdLine(int argc, char *argv[]);
void updateFavs(QString filepath, bool save);
void updateIWADs(QString filepath, bool save);
- void updateres(QString filepath, bool save);
void initListViews();
+ void setupAdditionalUi();
QStringList genDOSBoxcmd();
//configs
@@ -155,10 +176,13 @@ private slots:
void loadExtConfig(QString path);
void applyConfig(RocketFile *rocket);
void initConfigs();
+ void autoLoadConfig();
void saveToGlobal(RocketFile &rocket);
+ void saveToAutoLoad();
void saveToGlobalFromList(RocketFile *rocket, int index);
void saveToExternal(RocketFile &rocket, QString name);
QSettings ConfigSettings;
+ QSettings AutoLoad;
QString pwadFilter;
};
diff --git a/rocketlauncher2.ui b/rocketlauncher2.ui
index 944ea3a..07f9c33 100644
--- a/rocketlauncher2.ui
+++ b/rocketlauncher2.ui
@@ -6,8 +6,8 @@
0
0
- 696
- 501
+ 896
+ 637
@@ -23,12 +23,22 @@
- Rocket Launcher 2.0
+ Rocket Launcher
+
+
+
+ :/engine/img/rocket.ico:/engine/img/rocket.ico
-
+
+
+ 0
+ 0
+
+
@@ -36,10 +46,31 @@
0
+
+
+ 0
+ 0
+
+
Launch Wad
+
+ 10
+
+
+ 10
+
+
+ 10
+
+
+ 6
+
+
+ 0
+
-
-
@@ -145,7 +176,7 @@
Launch Engine!
-
+
-
-
@@ -358,7 +389,7 @@
0
- 75
+ 0
@@ -373,17 +404,28 @@
-
-
-
-
- 0
- 0
-
-
-
- Show Command Line
-
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Rocket Menu
+
+
+
+
@@ -400,7 +442,11 @@
-
-
+
+
+ Qt::CustomContextMenu
+
+
-
@@ -441,10 +487,40 @@
-
+
+ true
+
+
+
+ 0
+ 0
+
+
- Files To Load (external and internal drag and drop supported)
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
+
+ false
+
+
+
+ 6
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
-
@@ -458,12 +534,16 @@
-
-
+
+
+ Qt::CustomContextMenu
+
+
-
- 20
+ 10
-
@@ -501,67 +581,14 @@
- -
-
-
-
-
-
- <html><head/><body><p align="center"><span style=" font-size:10pt; font-weight:600;">Common Resources</span></p></body></html>
-
-
-
- -
-
-
- -
-
-
- 64
-
-
-
-
-
-
- 100
- 0
-
-
-
-
- 80
- 16777215
-
-
-
- Add Resource
-
-
-
- -
-
-
-
- 30
- 0
-
-
-
-
- 30
- 16777215
-
-
-
- Del
-
-
-
-
-
-
-
-
+
+ 0
+
+
+ 0
+
-
@@ -571,6 +598,21 @@
-
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ Qt::CustomContextMenu
+
true
@@ -607,7 +649,7 @@
- 88
+ 100
20
@@ -711,14 +753,36 @@
60
-
-
+
-
Save
-
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+ <html><head/><body><p align="center"><span style=" font-size:10pt; font-weight:600;">Name Your Config</span></p></body></html>
+
+
+
+ -
+
+
+ -
+
+
+ 0
+ 0
+
+
100
@@ -731,7 +795,7 @@ External File
- -
+
-
@@ -751,22 +815,6 @@ Favorites
- -
-
-
-
- 0
- 0
-
-
-
- <html><head/><body><p align="center"><span style=" font-size:10pt; font-weight:600;">Name Your Config</span></p></body></html>
-
-
-
- -
-
-
@@ -817,7 +865,7 @@ External File
0
- -
+
-
-
@@ -827,7 +875,90 @@ External File
-
-
+
+
-
+
+
+ -
+
+
+ 6
+
+
+ QLayout::SetDefaultConstraint
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 30
+ 16777215
+
+
+
+ ▲
+
+
+
+ 0
+ 16
+
+
+
+ false
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 30
+ 16777215
+
+
+
+ ▼
+
+
+
+ 0
+ 16
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
-
@@ -856,20 +987,7 @@ External File
- -
-
-
-
- 40
- 0
-
-
-
- Qt::Horizontal
-
-
-
- -
+
-
false
@@ -1019,12 +1137,24 @@ External File
Doomsday
+ -
+
+ LZdoom
+
+
+
+
+ -
+
+
+ Save
+
- -
+
-
iD Executable (for DOSBox)
@@ -1069,6 +1199,8 @@ External File
-
+
+
+