mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-01 21:11:04 +00:00
commit
4db95d7681
@ -10443,6 +10443,7 @@ static bool setting_append_list(
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_values(list, list_info, "ttf");
|
||||
|
||||
CONFIG_FLOAT(
|
||||
list, list_info,
|
||||
@ -11468,6 +11469,7 @@ static bool setting_append_list(
|
||||
general_read_handler);
|
||||
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||
menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_REINIT);
|
||||
menu_settings_list_current_add_values(list, list_info, "ttf");
|
||||
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FONT_SELECTOR;
|
||||
|
||||
CONFIG_UINT(
|
||||
|
@ -136,12 +136,6 @@ void FormLayout::addFileSelector(rarch_setting_t *setting)
|
||||
addRow(formLabel(setting), new FileSelector(setting));
|
||||
}
|
||||
|
||||
void FormLayout::addFontSelector(rarch_setting_t *setting)
|
||||
{
|
||||
if (setting && setting->short_description)
|
||||
addRow(formLabel(setting), new FontSelector(setting));
|
||||
}
|
||||
|
||||
void FormLayout::addFloatSliderAndSpinBox(rarch_setting_t *setting)
|
||||
{
|
||||
if (setting && setting->short_description)
|
||||
@ -220,11 +214,6 @@ void SettingsGroup::addFileSelector(rarch_setting_t *setting)
|
||||
m_layout->addFileSelector(setting);
|
||||
}
|
||||
|
||||
void SettingsGroup::addFontSelector(rarch_setting_t *setting)
|
||||
{
|
||||
m_layout->addFontSelector(setting);
|
||||
}
|
||||
|
||||
void SettingsGroup::addStringLineEdit(rarch_setting_t *setting)
|
||||
{
|
||||
m_layout->addStringLineEdit(setting);
|
||||
@ -879,19 +868,29 @@ PathButton::PathButton(const char *setting, QWidget *parent) :
|
||||
{
|
||||
}
|
||||
|
||||
QString PathButton::currentPath()
|
||||
{
|
||||
QString current(m_setting->value.target.string);
|
||||
if (current.isEmpty())
|
||||
current = m_setting->default_value.string;
|
||||
return current;
|
||||
}
|
||||
|
||||
void DirectoryButton::onClicked(bool)
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
"Choose " + QString(m_setting->short_description) + " Directory",
|
||||
QString(m_setting->default_value.string));
|
||||
currentPath());
|
||||
|
||||
if (!dir.isNull())
|
||||
{
|
||||
strlcpy(m_setting->value.target.string, QDir::toNativeSeparators(dir).toUtf8().data(), m_setting->size);
|
||||
strlcpy(m_setting->value.target.string, QDir::toNativeSeparators(dir).toUtf8().data(), m_setting->size);
|
||||
|
||||
handleChange(m_setting);
|
||||
handleChange(m_setting);
|
||||
}
|
||||
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void FileButton::onClicked(bool)
|
||||
@ -899,7 +898,7 @@ void FileButton::onClicked(bool)
|
||||
QString file = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
"Choose File",
|
||||
QString(m_setting->default_value.string),
|
||||
currentPath(),
|
||||
QString(m_setting->short_description) + " (*." + QString(m_setting->values) + ")");
|
||||
|
||||
if (!file.isNull())
|
||||
@ -908,29 +907,19 @@ void FileButton::onClicked(bool)
|
||||
|
||||
handleChange(m_setting);
|
||||
}
|
||||
}
|
||||
|
||||
void FontButton::onClicked(bool)
|
||||
{
|
||||
QString file = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
"Choose Font",
|
||||
QString(m_setting->default_value.string),
|
||||
"TrueType font (*.ttf)");
|
||||
|
||||
if (!file.isNull())
|
||||
{
|
||||
strlcpy(m_setting->value.target.string, QDir::toNativeSeparators(file).toUtf8().data(), m_setting->size);
|
||||
|
||||
handleChange(m_setting);
|
||||
}
|
||||
emit changed();
|
||||
}
|
||||
|
||||
DirectorySelector::DirectorySelector(rarch_setting_t *setting, QWidget *parent) :
|
||||
QHBoxLayout(parent)
|
||||
,m_lineEdit(new StringLineEdit(setting))
|
||||
,m_button(new DirectoryButton(setting))
|
||||
{
|
||||
addWidget(new StringLineEdit(setting));
|
||||
addWidget(new DirectoryButton(setting));
|
||||
addWidget(m_lineEdit);
|
||||
addWidget(m_button);
|
||||
|
||||
connect(m_button, SIGNAL(changed()), m_lineEdit, SLOT(update()));
|
||||
}
|
||||
|
||||
FileSelector::FileSelector(const char *setting, QWidget *parent) :
|
||||
@ -940,16 +929,14 @@ FileSelector::FileSelector(const char *setting, QWidget *parent) :
|
||||
|
||||
FileSelector::FileSelector(rarch_setting_t *setting, QWidget *parent) :
|
||||
QHBoxLayout(parent)
|
||||
{
|
||||
addWidget(new StringLineEdit(setting));
|
||||
addWidget(new FileButton(setting));
|
||||
}
|
||||
,m_lineEdit(new StringLineEdit(setting))
|
||||
,m_button(new FileButton(setting))
|
||||
|
||||
FontSelector::FontSelector(rarch_setting_t *setting, QWidget *parent) :
|
||||
QHBoxLayout(parent)
|
||||
{
|
||||
addWidget(new StringLineEdit(setting));
|
||||
addWidget(new FontButton(setting));
|
||||
addWidget(m_lineEdit);
|
||||
addWidget(m_button);
|
||||
|
||||
connect(m_button, SIGNAL(changed()), m_lineEdit, SLOT(update()));
|
||||
}
|
||||
|
||||
FloatSlider::FloatSlider(const char *setting, QWidget *parent) :
|
||||
|
@ -28,8 +28,6 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
static const QString FONT_FILTER = QStringLiteral("TrueType font (*.ttf)");
|
||||
|
||||
class FormLayout : public QFormLayout
|
||||
{
|
||||
public:
|
||||
@ -44,7 +42,6 @@ public:
|
||||
void addFileSelector(rarch_setting_t *setting);
|
||||
void addDirectorySelector(rarch_setting_t *setting);
|
||||
void addFloatSliderAndSpinBox(rarch_setting_t *setting);
|
||||
void addFontSelector(rarch_setting_t *setting);
|
||||
void addUIntRadioButtons(rarch_setting_t *setting);
|
||||
void addStringComboBox(rarch_setting_t *setting);
|
||||
void addStringLineEdit(rarch_setting_t *setting);
|
||||
@ -96,9 +93,6 @@ public:
|
||||
case ST_UI_TYPE_FILE_SELECTOR:
|
||||
this->addFileSelector(setting);
|
||||
break;
|
||||
case ST_UI_TYPE_FONT_SELECTOR:
|
||||
this->addFontSelector(setting);
|
||||
break;
|
||||
case ST_UI_TYPE_STRING_COMBOBOX:
|
||||
this->addStringComboBox(setting);
|
||||
break;
|
||||
@ -185,9 +179,6 @@ public:
|
||||
case ST_UI_TYPE_FILE_SELECTOR:
|
||||
this->addFileSelector(setting);
|
||||
break;
|
||||
case ST_UI_TYPE_FONT_SELECTOR:
|
||||
this->addFontSelector(setting);
|
||||
break;
|
||||
case ST_UI_TYPE_STRING_COMBOBOX:
|
||||
this->addStringComboBox(setting);
|
||||
break;
|
||||
@ -219,7 +210,6 @@ private:
|
||||
void addFileSelector(rarch_setting_t *setting);
|
||||
void addDirectorySelector(rarch_setting_t *setting);
|
||||
void addFloatSliderAndSpinBox(rarch_setting_t *setting);
|
||||
void addFontSelector(rarch_setting_t *setting);
|
||||
void addUIntRadioButtons(rarch_setting_t *setting);
|
||||
void addStringComboBox(rarch_setting_t *setting);
|
||||
void addStringLineEdit(rarch_setting_t *setting);
|
||||
@ -422,6 +412,8 @@ class PathButton : public QPushButton
|
||||
public:
|
||||
PathButton(rarch_setting_t *setting, QWidget *parent = 0);
|
||||
PathButton(const char *setting, QWidget *parent = 0);
|
||||
signals:
|
||||
void changed();
|
||||
protected slots:
|
||||
virtual void onClicked(bool checked = false) { Q_UNUSED( checked); }
|
||||
protected:
|
||||
@ -429,6 +421,7 @@ protected:
|
||||
rarch_setting_t *m_setting;
|
||||
char *m_value;
|
||||
const char *m_dir;
|
||||
QString currentPath();
|
||||
};
|
||||
|
||||
class DirectoryButton : public PathButton
|
||||
@ -451,21 +444,14 @@ private:
|
||||
void onClicked(bool checked = false);
|
||||
};
|
||||
|
||||
class FontButton : public PathButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontButton(rarch_setting_t *setting, QWidget *parent = 0) :
|
||||
PathButton(setting, parent) {}
|
||||
private:
|
||||
void onClicked(bool checked = false);
|
||||
};
|
||||
|
||||
class DirectorySelector : public QHBoxLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DirectorySelector(rarch_setting_t *setting, QWidget *parent = 0);
|
||||
private:
|
||||
StringLineEdit *m_lineEdit;
|
||||
DirectoryButton *m_button;
|
||||
};
|
||||
|
||||
class FileSelector : public QHBoxLayout
|
||||
@ -474,13 +460,9 @@ class FileSelector : public QHBoxLayout
|
||||
public:
|
||||
FileSelector(rarch_setting_t *setting, QWidget *parent = 0);
|
||||
FileSelector(const char *setting, QWidget *parent = 0);
|
||||
};
|
||||
|
||||
class FontSelector : public QHBoxLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontSelector(rarch_setting_t *setting, QWidget *parent = 0);
|
||||
private:
|
||||
StringLineEdit *m_lineEdit;
|
||||
FileButton *m_button;
|
||||
};
|
||||
|
||||
class FloatSlider : public QSlider
|
||||
|
Loading…
Reference in New Issue
Block a user