update gui

This commit is contained in:
Logan McNaughton committed 2021-11-21 16:14:59 -07:00
1 parent 7e4ef64406
commit 8a6fa8d3cc
3 files changed
+25 -103

No files matched your search

+15 -19
View File
@@ -41,8 +41,11 @@ m64p_video_extension_functions vidExtFunctions = {14,
void MainWindow::updatePlugins()
{
QString pluginPath = settings->value("pluginDirPath").toString();
pluginPath.replace("$APP_PATH$", QCoreApplication::applicationDirPath());
#ifdef PLUGIN_DIR_PATH
QString pluginPath = PLUGIN_DIR_PATH;
#else
QString pluginPath = QCoreApplication::applicationDirPath();
#endif
QDir PluginDir(pluginPath);
PluginDir.setFilter(QDir::Files);
QStringList Filter;
@@ -366,19 +369,9 @@ MainWindow::MainWindow(QWidget *parent) :
updateDD(ui);
updatePIF(ui);
if (!settings->contains("coreLibPath"))
settings->setValue("coreLibPath", "$APP_PATH$");
if (!settings->contains("pluginDirPath"))
settings->setValue("pluginDirPath", "$APP_PATH$");
if (!settings->contains("configDirPath"))
settings->setValue("configDirPath", "$CONFIG_PATH$");
#ifdef CORE_LIBRARY_PATH
settings->setValue("coreLibPath", CORE_LIBRARY_PATH);
#endif
#ifdef PLUGIN_DIR_PATH
settings->setValue("pluginDirPath", PLUGIN_DIR_PATH);
#endif
#ifdef CONFIG_DIR_PATH
settings->setValue("configDirPath", CONFIG_DIR_PATH);
#endif
@@ -1010,9 +1003,11 @@ void MainWindow::closeCoreLib()
void MainWindow::loadCoreLib()
{
QString corePath = settings->value("coreLibPath").toString();
corePath.replace("$APP_PATH$", QCoreApplication::applicationDirPath());
#ifdef CORE_LIBRARY_PATH
QString corePath = CORE_LIBRARY_PATH;
#else
QString corePath = QCoreApplication::applicationDirPath();
#endif
m64p_error res = osal_dynlib_open(&coreLib, QDir(corePath).filePath(OSAL_DEFAULT_DYNLIB_FILENAME).toUtf8().constData());
if (res != M64ERR_SUCCESS)
@@ -1098,10 +1093,11 @@ void MainWindow::loadPlugins()
ptr_PluginGetVersion PluginGetVersion;
m64p_error res;
QMessageBox msgBox;
QString pluginPath = settings->value("pluginDirPath").toString();
pluginPath.replace("$APP_PATH$", QCoreApplication::applicationDirPath());
#ifdef PLUGIN_DIR_PATH
QString pluginPath = PLUGIN_DIR_PATH;
#else
QString pluginPath = QCoreApplication::applicationDirPath();
#endif
QString file_path;
QString plugin_path;
+10 -78
View File
@@ -7,31 +7,6 @@
#include <QFileDialog>
#include <QMessageBox>
void SettingsDialog::handleCoreButton()
{
QString fileName = QFileDialog::getExistingDirectory(this,
tr("Locate Core Library"), NULL, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if (!fileName.isNull()) {
corePath->setText(fileName);
w->getSettings()->setValue("coreLibPath", fileName);
}
}
void SettingsDialog::handlePluginButton()
{
QString fileName = QFileDialog::getExistingDirectory(this, tr("Locate Plugin Directory"),
NULL,
QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks);
if (!fileName.isNull()) {
pluginPath->setText(fileName);
w->getSettings()->setValue("pluginDirPath", fileName);
w->getSettings()->remove("inputPlugin");
w->updatePlugins();
}
}
void SettingsDialog::handleConfigButton()
{
QString fileName = QFileDialog::getExistingDirectory(this, tr("Set Config Directory"),
@@ -50,19 +25,6 @@ void SettingsDialog::handleClearConfigButton()
w->getSettings()->remove("configDirPath");
}
void SettingsDialog::handleCoreEdit()
{
w->getSettings()->setValue("coreLibPath", corePath->text());
}
void SettingsDialog::handlePluginEdit()
{
w->getSettings()->setValue("pluginDirPath", pluginPath->text());
w->getSettings()->remove("inputPlugin");
w->updatePlugins();
}
void SettingsDialog::handleConfigEdit()
{
w->getSettings()->setValue("configDirPath", configPath->text());
@@ -72,38 +34,6 @@ void SettingsDialog::initStuff()
{
layout = new QGridLayout(this);
QLabel *coreLabel = new QLabel("Core Library Path", this);
corePath = new QLineEdit(this);
corePath->setText(w->getSettings()->value("coreLibPath").toString());
QPushButton *coreButton = new QPushButton("Set Path", this);
connect(coreButton, SIGNAL (released()),this, SLOT (handleCoreButton()));
connect(corePath, SIGNAL (editingFinished()),this, SLOT (handleCoreEdit()));
corePath->setStyleSheet("border: 1px solid; padding: 10px");
layout->addWidget(coreLabel,0,0);
layout->addWidget(corePath,0,1);
layout->addWidget(coreButton,0,2);
#ifdef CORE_LIBRARY_PATH
corePath->setEnabled(false);
coreButton->setEnabled(false);
#endif
QLabel *pluginLabel = new QLabel("Plugin Dir Path", this);
pluginPath = new QLineEdit(this);
pluginPath->setText(w->getSettings()->value("pluginDirPath").toString());
QPushButton *pluginButton = new QPushButton("Set Path", this);
connect(pluginButton, SIGNAL (released()),this, SLOT (handlePluginButton()));
connect(pluginPath, SIGNAL (editingFinished()),this, SLOT (handlePluginEdit()));
pluginPath->setStyleSheet("border: 1px solid; padding: 10px");
layout->addWidget(pluginLabel,1,0);
layout->addWidget(pluginPath,1,1);
layout->addWidget(pluginButton,1,2);
#ifdef PLUGIN_DIR_PATH
pluginPath->setEnabled(false);
pluginButton->setEnabled(false);
#endif
QLabel *note = new QLabel("Note: If you change the Config Path, you need to close and re-open mupen64plus-gui before it will take effect.", this);
QLabel *configLabel = new QLabel("Config Dir Path", this);
configPath = new QLineEdit(this);
@@ -114,20 +44,22 @@ void SettingsDialog::initStuff()
QPushButton *clearConfigButton = new QPushButton("Clear", this);
connect(clearConfigButton, SIGNAL (released()),this, SLOT (handleClearConfigButton()));
configPath->setStyleSheet("border: 1px solid; padding: 10px");
layout->addWidget(note,2,0,1,-1);
layout->addWidget(configLabel,3,0);
layout->addWidget(configPath,3,1);
layout->addWidget(configButton,3,2);
layout->addWidget(clearConfigButton,3,3);
layout->addWidget(note,0,0,1,-1);
layout->addWidget(configLabel,1,0);
layout->addWidget(configPath,1,1);
layout->addWidget(configButton,1,2);
layout->addWidget(clearConfigButton,1,3);
#ifdef CONFIG_DIR_PATH
configPath->setEnabled(false);
configButton->setEnabled(false);
clearConfigButton->setEnabled(false);
#endif
QString pluginPath = w->getSettings()->value("pluginDirPath").toString();
pluginPath.replace("$APP_PATH$", QCoreApplication::applicationDirPath());
#ifdef PLUGIN_DIR_PATH
QString pluginPath = PLUGIN_DIR_PATH;
#else
QString pluginPath = QCoreApplication::applicationDirPath();
#endif
QDir PluginDir(pluginPath);
QStringList Filter;
Filter.append("");
-6
View File
@@ -16,17 +16,11 @@ public:
protected:
void closeEvent(QCloseEvent *event);
private slots:
void handleCoreButton();
void handlePluginButton();
void handleConfigButton();
void handleClearConfigButton();
void handleCoreEdit();
void handlePluginEdit();
void handleConfigEdit();
private:
void initStuff();
QLineEdit *corePath;
QLineEdit *pluginPath;
QLineEdit *configPath;
QGridLayout *layout = nullptr;
};