qt: Adds a global option in preferences to use usr_path as the default
open directory for image file selection.
This commit is contained in:
@@ -183,6 +183,7 @@ int confirm_save = 1; /* (C) enable save confirmation */
|
|||||||
int enable_discord = 0; /* (C) enable Discord integration */
|
int enable_discord = 0; /* (C) enable Discord integration */
|
||||||
int pit_mode = -1; /* (C) force setting PIT mode */
|
int pit_mode = -1; /* (C) force setting PIT mode */
|
||||||
int fm_driver = 0; /* (C) select FM sound driver */
|
int fm_driver = 0; /* (C) select FM sound driver */
|
||||||
|
int open_dir_usr_path = 0; /* default file open dialog directory of usr_path */
|
||||||
|
|
||||||
/* Statistics. */
|
/* Statistics. */
|
||||||
extern int mmuflush;
|
extern int mmuflush;
|
||||||
|
|||||||
@@ -611,6 +611,8 @@ load_general(void)
|
|||||||
|
|
||||||
enable_discord = !!config_get_int(cat, "enable_discord", 0);
|
enable_discord = !!config_get_int(cat, "enable_discord", 0);
|
||||||
|
|
||||||
|
open_dir_usr_path = config_get_int(cat, "open_dir_usr_path", 0);
|
||||||
|
|
||||||
video_framerate = config_get_int(cat, "video_gl_framerate", -1);
|
video_framerate = config_get_int(cat, "video_gl_framerate", -1);
|
||||||
video_vsync = config_get_int(cat, "video_gl_vsync", 0);
|
video_vsync = config_get_int(cat, "video_gl_vsync", 0);
|
||||||
strncpy(video_shader, config_get_string(cat, "video_gl_shader", ""), sizeof(video_shader));
|
strncpy(video_shader, config_get_string(cat, "video_gl_shader", ""), sizeof(video_shader));
|
||||||
@@ -2380,6 +2382,11 @@ save_general(void)
|
|||||||
else
|
else
|
||||||
config_delete_var(cat, "enable_discord");
|
config_delete_var(cat, "enable_discord");
|
||||||
|
|
||||||
|
if (open_dir_usr_path)
|
||||||
|
config_set_int(cat, "open_dir_usr_path", open_dir_usr_path);
|
||||||
|
else
|
||||||
|
config_delete_var(cat, "open_dir_usr_path");
|
||||||
|
|
||||||
if (video_framerate != -1)
|
if (video_framerate != -1)
|
||||||
config_set_int(cat, "video_gl_framerate", video_framerate);
|
config_set_int(cat, "video_gl_framerate", video_framerate);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ extern int fm_driver; /* (C) select FM sound driver */
|
|||||||
extern char exe_path[2048]; /* path (dir) of executable */
|
extern char exe_path[2048]; /* path (dir) of executable */
|
||||||
extern char usr_path[1024]; /* path (dir) of user data */
|
extern char usr_path[1024]; /* path (dir) of user data */
|
||||||
extern char cfg_path[1024]; /* full path of config file */
|
extern char cfg_path[1024]; /* full path of config file */
|
||||||
|
extern int open_dir_usr_path; /* default file open dialog directory of usr_path */
|
||||||
#ifndef USE_NEW_DYNAREC
|
#ifndef USE_NEW_DYNAREC
|
||||||
extern FILE *stdlog; /* file to log output to */
|
extern FILE *stdlog; /* file to log output to */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#include <86box/86box.h>
|
||||||
#include <86box/config.h>
|
#include <86box/config.h>
|
||||||
#include <86box/device.h>
|
#include <86box/device.h>
|
||||||
#include <86box/timer.h>
|
#include <86box/timer.h>
|
||||||
@@ -173,7 +174,7 @@ void MediaMenu::cassetteNewImage() {
|
|||||||
void MediaMenu::cassetteSelectImage(bool wp) {
|
void MediaMenu::cassetteSelectImage(bool wp) {
|
||||||
auto filename = QFileDialog::getOpenFileName(parentWidget,
|
auto filename = QFileDialog::getOpenFileName(parentWidget,
|
||||||
QString(),
|
QString(),
|
||||||
QString(),
|
getMediaOpenDirectory(),
|
||||||
tr("Cassette images") %
|
tr("Cassette images") %
|
||||||
util::DlgFilter({ "pcm","raw","wav","cas" }) %
|
util::DlgFilter({ "pcm","raw","wav","cas" }) %
|
||||||
tr("All files") %
|
tr("All files") %
|
||||||
@@ -247,7 +248,7 @@ void MediaMenu::cartridgeSelectImage(int i) {
|
|||||||
auto filename = QFileDialog::getOpenFileName(
|
auto filename = QFileDialog::getOpenFileName(
|
||||||
parentWidget,
|
parentWidget,
|
||||||
QString(),
|
QString(),
|
||||||
QString(),
|
getMediaOpenDirectory(),
|
||||||
tr("Cartridge images") %
|
tr("Cartridge images") %
|
||||||
util::DlgFilter({ "a","b","jrc" }) %
|
util::DlgFilter({ "a","b","jrc" }) %
|
||||||
tr("All files") %
|
tr("All files") %
|
||||||
@@ -291,7 +292,7 @@ void MediaMenu::floppySelectImage(int i, bool wp) {
|
|||||||
auto filename = QFileDialog::getOpenFileName(
|
auto filename = QFileDialog::getOpenFileName(
|
||||||
parentWidget,
|
parentWidget,
|
||||||
QString(),
|
QString(),
|
||||||
QString(),
|
getMediaOpenDirectory(),
|
||||||
tr("All images") %
|
tr("All images") %
|
||||||
util::DlgFilter({ "0??","1??","??0","86f","bin","cq?","d??","flp","hdm","im?","json","td0","*fd?","mfm","xdf" }) %
|
util::DlgFilter({ "0??","1??","??0","86f","bin","cq?","d??","flp","hdm","im?","json","td0","*fd?","mfm","xdf" }) %
|
||||||
tr("Advanced sector images") %
|
tr("Advanced sector images") %
|
||||||
@@ -400,7 +401,7 @@ void MediaMenu::cdromMount(int i) {
|
|||||||
auto filename = QFileDialog::getOpenFileName(
|
auto filename = QFileDialog::getOpenFileName(
|
||||||
parentWidget,
|
parentWidget,
|
||||||
QString(),
|
QString(),
|
||||||
QString(),
|
getMediaOpenDirectory(),
|
||||||
tr("CD-ROM images") %
|
tr("CD-ROM images") %
|
||||||
util::DlgFilter({ "iso","cue" }) %
|
util::DlgFilter({ "iso","cue" }) %
|
||||||
tr("All files") %
|
tr("All files") %
|
||||||
@@ -571,7 +572,7 @@ void MediaMenu::moSelectImage(int i, bool wp) {
|
|||||||
auto filename = QFileDialog::getOpenFileName(
|
auto filename = QFileDialog::getOpenFileName(
|
||||||
parentWidget,
|
parentWidget,
|
||||||
QString(),
|
QString(),
|
||||||
QString(),
|
getMediaOpenDirectory(),
|
||||||
tr("MO images") %
|
tr("MO images") %
|
||||||
util::DlgFilter({ "im?", "mdi" }) %
|
util::DlgFilter({ "im?", "mdi" }) %
|
||||||
tr("All files") %
|
tr("All files") %
|
||||||
@@ -656,6 +657,13 @@ void MediaMenu::moUpdateMenu(int i) {
|
|||||||
menu->setTitle(QString::asprintf(tr("MO %i (%ls): %ls").toUtf8().constData(), i + 1, busName.toStdU16String().data(), name.isEmpty() ? tr("(empty)").toStdU16String().data() : name.toStdU16String().data()));
|
menu->setTitle(QString::asprintf(tr("MO %i (%ls): %ls").toUtf8().constData(), i + 1, busName.toStdU16String().data(), name.isEmpty() ? tr("(empty)").toStdU16String().data() : name.toStdU16String().data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MediaMenu::getMediaOpenDirectory() {
|
||||||
|
QString openDirectory;
|
||||||
|
if (open_dir_usr_path > 0) {
|
||||||
|
openDirectory = QString::fromUtf8(usr_path);
|
||||||
|
}
|
||||||
|
return openDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
// callbacks from 86box C code
|
// callbacks from 86box C code
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ private:
|
|||||||
QMap<int, QMenu*> zipMenus;
|
QMap<int, QMenu*> zipMenus;
|
||||||
QMap<int, QMenu*> moMenus;
|
QMap<int, QMenu*> moMenus;
|
||||||
|
|
||||||
|
QString getMediaOpenDirectory();
|
||||||
|
|
||||||
int cassetteRecordPos;
|
int cassetteRecordPos;
|
||||||
int cassettePlayPos;
|
int cassettePlayPos;
|
||||||
int cassetteRewindPos;
|
int cassetteRewindPos;
|
||||||
|
|||||||
@@ -113,12 +113,14 @@ ProgSettings::ProgSettings(QWidget *parent) :
|
|||||||
|
|
||||||
mouseSensitivity = mouse_sensitivity;
|
mouseSensitivity = mouse_sensitivity;
|
||||||
ui->horizontalSlider->setValue(mouseSensitivity * 100.);
|
ui->horizontalSlider->setValue(mouseSensitivity * 100.);
|
||||||
|
ui->openDirUsrPath->setChecked(open_dir_usr_path > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgSettings::accept()
|
void ProgSettings::accept()
|
||||||
{
|
{
|
||||||
strcpy(icon_set, ui->comboBox->currentData().toString().toUtf8().data());
|
strcpy(icon_set, ui->comboBox->currentData().toString().toUtf8().data());
|
||||||
lang_id = ui->comboBoxLanguage->currentData().toUInt();
|
lang_id = ui->comboBoxLanguage->currentData().toUInt();
|
||||||
|
open_dir_usr_path = ui->openDirUsrPath->isChecked() ? 1 : 0;
|
||||||
|
|
||||||
loadTranslators(QCoreApplication::instance());
|
loadTranslators(QCoreApplication::instance());
|
||||||
reloadStrings();
|
reloadStrings();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>458</width>
|
<width>458</width>
|
||||||
<height>303</height>
|
<height>374</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -29,24 +29,14 @@
|
|||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetFixedSize</enum>
|
<enum>QLayout::SetFixedSize</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0" colspan="2">
|
||||||
<spacer name="horizontalSpacer">
|
<widget class="QComboBox" name="comboBox">
|
||||||
<property name="orientation">
|
<property name="editable">
|
||||||
<enum>Qt::Horizontal</enum>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="QComboBox" name="comboBoxLanguage">
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>(System Default)</string>
|
<string>(Default)</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -58,30 +48,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Default</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="0" colspan="2">
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QPushButton" name="pushButtonLanguage">
|
|
||||||
<property name="text">
|
|
||||||
<string>Default</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -89,8 +55,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<widget class="QPushButton" name="pushButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Default</string>
|
<string>Default</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -109,25 +75,15 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="12" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="text">
|
|
||||||
<string>Language:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="standardButtons">
|
||||||
<size>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="7" column="0" colspan="2">
|
||||||
<widget class="QSlider" name="horizontalSlider">
|
<widget class="QSlider" name="horizontalSlider">
|
||||||
@@ -151,18 +107,72 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QComboBox" name="comboBox">
|
<widget class="QComboBox" name="comboBoxLanguage">
|
||||||
<property name="editable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>(Default)</string>
|
<string>(System Default)</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Language:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QPushButton" name="pushButtonLanguage">
|
||||||
|
<property name="text">
|
||||||
|
<string>Default</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Default</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<widget class="QCheckBox" name="openDirUsrPath">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Select media images from program working directory</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
Reference in New Issue
Block a user