(QT/UI) Cleanups
This commit is contained in:
parent
1dc0fa83ff
commit
254c48707d
|
@ -520,9 +520,9 @@ void UIntComboBox::populate(double min, double max)
|
|||
{
|
||||
float i;
|
||||
unsigned orig_value = *m_setting->value.target.unsigned_integer;
|
||||
float step = m_setting->step;
|
||||
bool checked_found = false;
|
||||
unsigned count = 0;
|
||||
float step = m_setting->step;
|
||||
bool checked_found = false;
|
||||
unsigned count = 0;
|
||||
|
||||
if (m_setting->get_string_representation)
|
||||
{
|
||||
|
@ -722,31 +722,27 @@ UIntRadioButtons::UIntRadioButtons(rarch_setting_t *setting, QWidget *parent) :
|
|||
/* from menu_displaylist */
|
||||
float i;
|
||||
unsigned orig_value = *setting->value.target.unsigned_integer;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : UINT_MAX;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : UINT_MAX;
|
||||
|
||||
bool checked_found = false;
|
||||
bool checked_found = false;
|
||||
|
||||
if (setting->get_string_representation)
|
||||
{
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
char val_s[256];
|
||||
//int val = (int)i;
|
||||
|
||||
*setting->value.target.unsigned_integer = i;
|
||||
|
||||
setting->get_string_representation(setting, val_s, sizeof(val_s));
|
||||
|
||||
//m_hash[i] = QString(val_s);
|
||||
|
||||
QRadioButton *button = new QRadioButton(QString(val_s), this);
|
||||
|
||||
m_buttonGroup->addButton(button, i);
|
||||
|
||||
layout->addWidget(button);
|
||||
//addItem(m_hash[i], i);
|
||||
|
||||
if (!checked_found && i == orig_value)
|
||||
{
|
||||
|
@ -1091,23 +1087,24 @@ ColorButton::ColorButton(msg_hash_enums red, msg_hash_enums green, msg_hash_enum
|
|||
/* Stolen from Qt Creator's QtColorButton */
|
||||
void ColorButton::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
const int pixSize = 10;
|
||||
const int corr = 5;
|
||||
const QColor frameColor1(0, 0, 0, 26);
|
||||
const QColor frameColor2(0, 0, 0, 51);
|
||||
|
||||
QToolButton::paintEvent(event);
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
const int pixSize = 10;
|
||||
QBrush br(color());
|
||||
|
||||
QPainter p(this);
|
||||
const int corr = 5;
|
||||
QRect r = rect().adjusted(corr, corr, -corr, -corr);
|
||||
p.setBrushOrigin((r.width() % pixSize + pixSize) / 2 + corr, (r.height() % pixSize + pixSize) / 2 + corr);
|
||||
p.fillRect(r, br);
|
||||
|
||||
const QColor frameColor1(0, 0, 0, 26);
|
||||
p.setPen(frameColor1);
|
||||
p.drawRect(r.adjusted(1, 1, -2, -2));
|
||||
const QColor frameColor2(0, 0, 0, 51);
|
||||
p.setPen(frameColor2);
|
||||
p.drawRect(r.adjusted(0, 0, -1, -1));
|
||||
}
|
||||
|
@ -1126,9 +1123,9 @@ void UIntColorButton::onColorChanged(const QColor &color)
|
|||
{
|
||||
if (color.isValid())
|
||||
{
|
||||
*m_red->value.target.unsigned_integer = color.red();
|
||||
*m_red->value.target.unsigned_integer = color.red();
|
||||
*m_green->value.target.unsigned_integer = color.green();
|
||||
*m_blue->value.target.unsigned_integer = color.blue();
|
||||
*m_blue->value.target.unsigned_integer = color.blue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1149,9 +1146,9 @@ void FloatColorButton::onColorChanged(const QColor &color)
|
|||
{
|
||||
if (color.isValid())
|
||||
{
|
||||
*m_red->value.target.fraction = color.red() / 255.0f;
|
||||
*m_red->value.target.fraction = color.red() / 255.0f;
|
||||
*m_green->value.target.fraction = color.green() / 255.0f;
|
||||
*m_blue->value.target.fraction = color.blue() / 255.0f;
|
||||
*m_blue->value.target.fraction = color.blue() / 255.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -255,15 +255,11 @@ void LogTextEdit::appendMessage(const QString& text)
|
|||
/* only accept indexes from current path. https://www.qtcentre.org/threads/50700-QFileSystemModel-and-QSortFilterProxyModel-don-t-work-well-together */
|
||||
bool FileSystemProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
QModelIndex rootIndex;
|
||||
|
||||
QFileSystemModel *sm = qobject_cast<QFileSystemModel*>(sourceModel());
|
||||
rootIndex = sm->index(sm->rootPath());
|
||||
QFileSystemModel *sm = qobject_cast<QFileSystemModel*>(sourceModel());
|
||||
QModelIndex rootIndex = sm->index(sm->rootPath());
|
||||
|
||||
if (sourceParent == rootIndex)
|
||||
{
|
||||
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -360,24 +356,24 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
,m_itemsCountLiteral(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ITEMS_COUNT))
|
||||
,m_itemsCountLabel(new QLabel(this))
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
QString configDir = QFileInfo(path_get(RARCH_PATH_CONFIG)).dir().absolutePath();
|
||||
QToolButton *searchResetButton = NULL;
|
||||
QHBoxLayout *zoomLayout = new QHBoxLayout();
|
||||
QLabel *zoomLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ZOOM), m_zoomWidget);
|
||||
QPushButton *thumbnailTypePushButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_TYPE), m_zoomWidget);
|
||||
QMenu *thumbnailTypeMenu = new QMenu(thumbnailTypePushButton);
|
||||
QAction *thumbnailTypeBoxartAction = NULL;
|
||||
QString configDir = QFileInfo(path_get(RARCH_PATH_CONFIG)).dir().absolutePath();
|
||||
QToolButton *searchResetButton = NULL;
|
||||
QHBoxLayout *zoomLayout = new QHBoxLayout();
|
||||
QLabel *zoomLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ZOOM), m_zoomWidget);
|
||||
QPushButton *thumbnailTypePushButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_TYPE), m_zoomWidget);
|
||||
QMenu *thumbnailTypeMenu = new QMenu(thumbnailTypePushButton);
|
||||
QAction *thumbnailTypeBoxartAction = NULL;
|
||||
QAction *thumbnailTypeScreenshotAction = NULL;
|
||||
QAction *thumbnailTypeTitleAction = NULL;
|
||||
QPushButton *viewTypePushButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW), m_zoomWidget);
|
||||
QMenu *viewTypeMenu = new QMenu(viewTypePushButton);
|
||||
QAction *viewTypeIconsAction = NULL;
|
||||
QAction *viewTypeListAction = NULL;
|
||||
QHBoxLayout *gridProgressLayout = new QHBoxLayout();
|
||||
QLabel *gridProgressLabel = NULL;
|
||||
QHBoxLayout *gridFooterLayout = NULL;
|
||||
QAction *thumbnailTypeTitleAction = NULL;
|
||||
QPushButton *viewTypePushButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW), m_zoomWidget);
|
||||
QMenu *viewTypeMenu = new QMenu(viewTypePushButton);
|
||||
QAction *viewTypeIconsAction = NULL;
|
||||
QAction *viewTypeListAction = NULL;
|
||||
QHBoxLayout *gridProgressLayout = new QHBoxLayout();
|
||||
QLabel *gridProgressLabel = NULL;
|
||||
QHBoxLayout *gridFooterLayout = NULL;
|
||||
|
||||
qRegisterMetaType<QPointer<ThumbnailWidget> >("ThumbnailWidget");
|
||||
qRegisterMetaType<retro_task_callback_t>("retro_task_callback_t");
|
||||
|
@ -389,14 +385,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
m_playlistThumbnailDownloadProgressDialog->cancel();
|
||||
|
||||
m_gridProgressWidget = new QWidget();
|
||||
gridProgressLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PROGRESS), m_gridProgressWidget);
|
||||
gridProgressLabel = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_PROGRESS), m_gridProgressWidget);
|
||||
|
||||
thumbnailTypePushButton->setObjectName("thumbnailTypePushButton");
|
||||
thumbnailTypePushButton->setFlat(true);
|
||||
|
||||
thumbnailTypeBoxartAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART));
|
||||
thumbnailTypeBoxartAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART));
|
||||
thumbnailTypeScreenshotAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT));
|
||||
thumbnailTypeTitleAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN));
|
||||
thumbnailTypeTitleAction = thumbnailTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN));
|
||||
|
||||
thumbnailTypePushButton->setMenu(thumbnailTypeMenu);
|
||||
|
||||
|
@ -404,7 +400,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
viewTypePushButton->setFlat(true);
|
||||
|
||||
viewTypeIconsAction = viewTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_ICONS));
|
||||
viewTypeListAction = viewTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST));
|
||||
viewTypeListAction = viewTypeMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST));
|
||||
|
||||
viewTypePushButton->setMenu(viewTypeMenu);
|
||||
|
||||
|
@ -466,7 +462,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
m_gridProgressWidget->hide();
|
||||
|
||||
m_playlistModel = new PlaylistModel(this);
|
||||
m_proxyModel = new QSortFilterProxyModel(this);
|
||||
m_proxyModel = new QSortFilterProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_playlistModel);
|
||||
m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
||||
|
@ -510,8 +506,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
m_defaultPalette = QApplication::palette();
|
||||
|
||||
/* ViewOptionsDialog needs m_settings set before it's constructed */
|
||||
m_settings = new QSettings(configDir + "/retroarch_qt.cfg", QSettings::IniFormat, this);
|
||||
m_viewOptionsDialog = new ViewOptionsDialog(this, 0);
|
||||
m_settings = new QSettings(configDir + "/retroarch_qt.cfg", QSettings::IniFormat, this);
|
||||
m_viewOptionsDialog = new ViewOptionsDialog(this, 0);
|
||||
m_playlistEntryDialog = new PlaylistEntryDialog(this, 0);
|
||||
|
||||
/* default NULL parameter for parent wasn't added until 5.7 */
|
||||
|
@ -749,12 +745,11 @@ void MainWindow::startTimer() {
|
|||
void MainWindow::updateVisibleItems() {
|
||||
if (m_currentBrowser == BROWSER_TYPE_PLAYLISTS && m_viewType == VIEW_TYPE_ICONS)
|
||||
{
|
||||
unsigned i;
|
||||
QVector<QModelIndex> indexes = m_gridView->visibleIndexes();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < indexes.size(); i++)
|
||||
{
|
||||
m_playlistModel->loadThumbnail(m_proxyModel->mapToSource(indexes.at(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -790,23 +785,22 @@ void MainWindow::onFileBrowserTableDirLoaded(const QString &path)
|
|||
|
||||
QVector<QPair<QString, QString> > MainWindow::getPlaylists()
|
||||
{
|
||||
unsigned i;
|
||||
QVector<QPair<QString, QString> > playlists;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m_listWidget->count(); i++)
|
||||
{
|
||||
QString label, path;
|
||||
QListWidgetItem *item = m_listWidget->item(i);
|
||||
QPair<QString, QString> pair;
|
||||
QString label;
|
||||
QString path;
|
||||
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
label = item->text();
|
||||
path = item->data(Qt::UserRole).toString();
|
||||
label = item->text();
|
||||
path = item->data(Qt::UserRole).toString();
|
||||
|
||||
pair.first = label;
|
||||
pair.first = label;
|
||||
pair.second = path;
|
||||
|
||||
playlists.append(pair);
|
||||
|
@ -827,10 +821,14 @@ QString MainWindow::getSpecialPlaylistPath(SpecialPlaylist playlist)
|
|||
switch (playlist)
|
||||
{
|
||||
case SPECIAL_PLAYLIST_HISTORY:
|
||||
return (m_historyPlaylistsItem ? m_historyPlaylistsItem->data(Qt::UserRole).toString() : QString());
|
||||
if (m_historyPlaylistsItem)
|
||||
return m_historyPlaylistsItem->data(Qt::UserRole).toString();
|
||||
break;
|
||||
default:
|
||||
return QString();
|
||||
break;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
double MainWindow::lerp(double x, double y, double a, double b, double d)
|
||||
|
@ -884,8 +882,8 @@ void MainWindow::onZoomValueChanged(int zoomValue)
|
|||
|
||||
void MainWindow::showWelcomeScreen()
|
||||
{
|
||||
bool dontAsk = false;
|
||||
bool answer = false;
|
||||
bool dontAsk = false;
|
||||
bool answer = false;
|
||||
const QString welcomeText = QStringLiteral(""
|
||||
"Welcome to the RetroArch Desktop Menu!<br>\n"
|
||||
"<br>\n"
|
||||
|
@ -971,12 +969,10 @@ void MainWindow::setCustomThemeString(QString qss)
|
|||
|
||||
bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType, Qt::WindowModality modality, bool showDontAsk, bool *dontAsk)
|
||||
{
|
||||
QPointer<QMessageBox> msgBoxPtr;
|
||||
QMessageBox *msgBox = NULL;
|
||||
QCheckBox *checkBox = NULL;
|
||||
|
||||
msgBoxPtr = new QMessageBox(this);
|
||||
msgBox = msgBoxPtr.data();
|
||||
QPointer<QMessageBox> msgBoxPtr = new QMessageBox(this);
|
||||
QMessageBox *msgBox = msgBoxPtr.data();
|
||||
|
||||
msgBox->setWindowModality(modality);
|
||||
msgBox->setTextFormat(Qt::RichText);
|
||||
|
@ -992,37 +988,27 @@ bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType, Qt::WindowM
|
|||
switch (msgType)
|
||||
{
|
||||
case MSGBOX_TYPE_INFO:
|
||||
{
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_INFORMATION));
|
||||
break;
|
||||
}
|
||||
case MSGBOX_TYPE_WARNING:
|
||||
{
|
||||
msgBox->setIcon(QMessageBox::Warning);
|
||||
msgBox->setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_WARNING));
|
||||
break;
|
||||
}
|
||||
case MSGBOX_TYPE_ERROR:
|
||||
{
|
||||
msgBox->setIcon(QMessageBox::Critical);
|
||||
msgBox->setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_ERROR));
|
||||
break;
|
||||
}
|
||||
case MSGBOX_TYPE_QUESTION_YESNO:
|
||||
{
|
||||
msgBox->setIcon(QMessageBox::Question);
|
||||
msgBox->setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_QUESTION));
|
||||
msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
break;
|
||||
}
|
||||
case MSGBOX_TYPE_QUESTION_OKCANCEL:
|
||||
{
|
||||
msgBox->setIcon(QMessageBox::Question);
|
||||
msgBox->setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_QUESTION));
|
||||
msgBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1105,9 +1091,7 @@ void MainWindow::onGotStatusMessage(QString msg, unsigned priority, unsigned dur
|
|||
return;
|
||||
|
||||
if (screen)
|
||||
{
|
||||
msecDuration = (duration / screen->refreshRate()) * 1000;
|
||||
}
|
||||
|
||||
if (msecDuration <= 0)
|
||||
msecDuration = 1000;
|
||||
|
@ -1262,23 +1246,14 @@ void MainWindow::setTheme(Theme theme)
|
|||
switch(theme)
|
||||
{
|
||||
case THEME_SYSTEM_DEFAULT:
|
||||
{
|
||||
qApp->setStyleSheet(qt_theme_default_stylesheet.arg(m_settings->value("highlight_color", "palette(highlight)").toString()));
|
||||
|
||||
break;
|
||||
}
|
||||
case THEME_DARK:
|
||||
{
|
||||
qApp->setStyleSheet(qt_theme_dark_stylesheet.arg(m_settings->value("highlight_color", "palette(highlight)").toString()));
|
||||
|
||||
break;
|
||||
}
|
||||
case THEME_CUSTOM:
|
||||
{
|
||||
qApp->setStyleSheet(m_customThemeString);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1596,7 +1571,7 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
{
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE)) + ":";
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE)) + ":";
|
||||
hash["value"] = "";
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1619,50 +1594,40 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
labelText += msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MISSING);
|
||||
}
|
||||
else
|
||||
{
|
||||
labelText += msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PRESENT);
|
||||
}
|
||||
|
||||
labelText += ", ";
|
||||
|
||||
if (core_info->firmware[i].optional)
|
||||
{
|
||||
labelText += msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OPTIONAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
labelText += msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REQUIRED);
|
||||
}
|
||||
|
||||
labelText += ":";
|
||||
|
||||
if (core_info->firmware[i].desc)
|
||||
{
|
||||
valueText = core_info->firmware[i].desc;
|
||||
}
|
||||
else
|
||||
{
|
||||
valueText = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME);
|
||||
}
|
||||
|
||||
hash["key"] = labelText;
|
||||
hash["key"] = labelText;
|
||||
hash["value"] = valueText;
|
||||
|
||||
if (missing)
|
||||
{
|
||||
QString style = "font-weight: bold; color: #ff0000";
|
||||
QString style = "font-weight: bold; color: #ff0000";
|
||||
hash["label_style"] = style;
|
||||
hash["value_style"] = style;
|
||||
hash["html_key"] = "<b><font color=\"#ff0000\">" + hash["key"] + "</font></b>";
|
||||
hash["html_value"] = "<b><font color=\"#ff0000\">" + hash["value"] + "</font></b>";
|
||||
hash["html_key"] = "<b><font color=\"#ff0000\">" + hash["key"] + "</font></b>";
|
||||
hash["html_value"] = "<b><font color=\"#ff0000\">" + hash["value"] + "</font></b>";
|
||||
}
|
||||
else
|
||||
{
|
||||
QString style = "font-weight: bold; color: rgb(0, 175, 0)";
|
||||
QString style = "font-weight: bold; color: rgb(0, 175, 0)";
|
||||
hash["label_style"] = style;
|
||||
hash["value_style"] = style;
|
||||
hash["html_key"] = "<b><font color=\"#00af00\">" + hash["key"] + "</font></b>";
|
||||
hash["html_value"] = "<b><font color=\"#00af00\">" + hash["value"] + "</font></b>";
|
||||
hash["html_key"] = "<b><font color=\"#00af00\">" + hash["key"] + "</font></b>";
|
||||
hash["html_value"] = "<b><font color=\"#00af00\">" + hash["value"] + "</font></b>";
|
||||
}
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1677,7 +1642,7 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
{
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
hash["key"] = "";
|
||||
hash["key"] = "";
|
||||
hash["value"] = core_info->note_list->elems[i].data;
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1729,9 +1694,7 @@ void MainWindow::selectBrowserDir(QString path)
|
|||
m_fileTableHeaderState = m_fileTableView->horizontalHeader()->saveState();
|
||||
|
||||
if (proxyIndex.isValid())
|
||||
{
|
||||
m_fileTableView->setRootIndex(proxyIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* the directory is filtered out. Remove the filter for a moment. FIXME find a way to not have to do this (not filtering dirs is one). */
|
||||
|
@ -1764,13 +1727,9 @@ void MainWindow::onDropWidgetEnterPressed()
|
|||
QModelIndex MainWindow::getCurrentContentIndex()
|
||||
{
|
||||
if (m_viewType == VIEW_TYPE_LIST)
|
||||
{
|
||||
return m_tableView->currentIndex();
|
||||
}
|
||||
else if (m_viewType == VIEW_TYPE_ICONS)
|
||||
{
|
||||
return m_gridView->currentIndex();
|
||||
}
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
|
@ -1781,13 +1740,13 @@ QHash<QString, QString> MainWindow::getCurrentContentHash()
|
|||
|
||||
QHash<QString, QString> MainWindow::getFileContentHash(const QModelIndex &index)
|
||||
{
|
||||
QFileInfo fileInfo = m_fileModel->fileInfo(index);
|
||||
QHash<QString, QString> hash;
|
||||
QFileInfo fileInfo = m_fileModel->fileInfo(index);
|
||||
|
||||
hash["path"] = QDir::toNativeSeparators(m_fileModel->filePath(index));
|
||||
hash["label"] = hash["path"];
|
||||
hash["path"] = QDir::toNativeSeparators(m_fileModel->filePath(index));
|
||||
hash["label"] = hash["path"];
|
||||
hash["label_noext"] = fileInfo.completeBaseName();
|
||||
hash["db_name"] = fileInfo.dir().dirName();
|
||||
hash["db_name"] = fileInfo.dir().dirName();
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
@ -1810,9 +1769,7 @@ void MainWindow::onStartCoreClicked()
|
|||
path_clear(RARCH_PATH_BASENAME);
|
||||
|
||||
if (!task_push_start_current_core(&content_info))
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR), msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT));
|
||||
}
|
||||
}
|
||||
|
||||
QHash<QString, QString> MainWindow::getSelectedCore()
|
||||
|
@ -1833,20 +1790,15 @@ QHash<QString, QString> MainWindow::getSelectedCore()
|
|||
switch(coreSelection)
|
||||
{
|
||||
case CORE_SELECTION_CURRENT:
|
||||
{
|
||||
coreHash["core_path"] = path_get(RARCH_PATH_CORE);
|
||||
|
||||
break;
|
||||
}
|
||||
case CORE_SELECTION_PLAYLIST_SAVED:
|
||||
{
|
||||
if (contentHash.isEmpty() || contentHash["core_path"].isEmpty())
|
||||
break;
|
||||
|
||||
coreHash["core_path"] = contentHash["core_path"];
|
||||
|
||||
break;
|
||||
}
|
||||
case CORE_SELECTION_PLAYLIST_DEFAULT:
|
||||
{
|
||||
QVector<QHash<QString, QString> > cores;
|
||||
|
@ -1909,8 +1861,8 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
|||
|
||||
if (contentHash.contains("path"))
|
||||
{
|
||||
int lastIndex = contentHash["path"].lastIndexOf('.');
|
||||
QString extensionStr;
|
||||
int lastIndex = contentHash["path"].lastIndexOf('.');
|
||||
QByteArray pathArray = contentHash["path"].toUtf8();
|
||||
const char *pathData = pathArray.constData();
|
||||
|
||||
|
@ -1919,9 +1871,7 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
|||
extensionStr = contentHash["path"].mid(lastIndex + 1);
|
||||
|
||||
if (!extensionStr.isEmpty())
|
||||
{
|
||||
extensionFilters.append(extensionStr.toLower());
|
||||
}
|
||||
}
|
||||
|
||||
if (path_is_compressed_file(pathData))
|
||||
|
@ -1957,21 +1907,15 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
|||
switch(coreSelection)
|
||||
{
|
||||
case CORE_SELECTION_CURRENT:
|
||||
{
|
||||
corePathArray = path_get(RARCH_PATH_CORE);
|
||||
contentPathArray = contentHash["path"].toUtf8();
|
||||
corePathArray = path_get(RARCH_PATH_CORE);
|
||||
contentPathArray = contentHash["path"].toUtf8();
|
||||
contentLabelArray = contentHash["label_noext"].toUtf8();
|
||||
|
||||
break;
|
||||
}
|
||||
case CORE_SELECTION_PLAYLIST_SAVED:
|
||||
{
|
||||
corePathArray = contentHash["core_path"].toUtf8();
|
||||
contentPathArray = contentHash["path"].toUtf8();
|
||||
corePathArray = contentHash["core_path"].toUtf8();
|
||||
contentPathArray = contentHash["path"].toUtf8();
|
||||
contentLabelArray = contentHash["label_noext"].toUtf8();
|
||||
|
||||
break;
|
||||
}
|
||||
case CORE_SELECTION_PLAYLIST_DEFAULT:
|
||||
{
|
||||
QVector<QHash<QString, QString> > cores = getPlaylistDefaultCores();
|
||||
|
@ -2136,12 +2080,12 @@ void MainWindow::setCoreActions()
|
|||
|
||||
switch(m_currentBrowser)
|
||||
{
|
||||
case BROWSER_TYPE_PLAYLISTS:
|
||||
currentPlaylistFileName = hash["db_name"];
|
||||
break;
|
||||
case BROWSER_TYPE_FILES:
|
||||
currentPlaylistFileName = m_fileModel->rootDirectory().dirName();
|
||||
break;
|
||||
case BROWSER_TYPE_PLAYLISTS:
|
||||
currentPlaylistFileName = hash["db_name"];
|
||||
break;
|
||||
case BROWSER_TYPE_FILES:
|
||||
currentPlaylistFileName = m_fileModel->rootDirectory().dirName();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!currentPlaylistFileName.isEmpty())
|
||||
|
@ -2319,21 +2263,13 @@ void MainWindow::onSearchLineEditEdited(const QString &text)
|
|||
}
|
||||
|
||||
if (!foundHira && !foundKata)
|
||||
{
|
||||
m_searchRegExp = QRegExp(text, Qt::CaseInsensitive);
|
||||
}
|
||||
else if (foundHira && !foundKata)
|
||||
{
|
||||
m_searchRegExp = QRegExp(text + "|" + QString::fromUcs4(textHiraToKata.constData(), textHiraToKata.size()), Qt::CaseInsensitive);
|
||||
}
|
||||
else if (!foundHira && foundKata)
|
||||
{
|
||||
m_searchRegExp = QRegExp(text + "|" + QString::fromUcs4(textKataToHira.constData(), textKataToHira.size()), Qt::CaseInsensitive);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_searchRegExp = QRegExp(text + "|" + QString::fromUcs4(textHiraToKata.constData(), textHiraToKata.size()) + "|" + QString::fromUcs4(textKataToHira.constData(), textKataToHira.size()), Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
applySearch();
|
||||
}
|
||||
|
@ -2342,19 +2278,17 @@ void MainWindow::applySearch()
|
|||
{
|
||||
switch (m_currentBrowser)
|
||||
{
|
||||
case BROWSER_TYPE_PLAYLISTS:
|
||||
if (m_proxyModel->filterRegExp() != m_searchRegExp)
|
||||
{
|
||||
m_proxyModel->setFilterRegExp(m_searchRegExp);
|
||||
updateItemsCount();
|
||||
}
|
||||
break;
|
||||
case BROWSER_TYPE_FILES:
|
||||
if (m_proxyFileModel->filterRegExp() != m_searchRegExp)
|
||||
{
|
||||
m_proxyFileModel->setFilterRegExp(m_searchRegExp);
|
||||
}
|
||||
break;
|
||||
case BROWSER_TYPE_PLAYLISTS:
|
||||
if (m_proxyModel->filterRegExp() != m_searchRegExp)
|
||||
{
|
||||
m_proxyModel->setFilterRegExp(m_searchRegExp);
|
||||
updateItemsCount();
|
||||
}
|
||||
break;
|
||||
case BROWSER_TYPE_FILES:
|
||||
if (m_proxyFileModel->filterRegExp() != m_searchRegExp)
|
||||
m_proxyFileModel->setFilterRegExp(m_searchRegExp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2598,18 +2532,14 @@ void MainWindow::setCurrentViewType(ViewType viewType)
|
|||
switch (viewType)
|
||||
{
|
||||
case VIEW_TYPE_ICONS:
|
||||
{
|
||||
m_playlistViews->setCurrentWidget(m_gridView);
|
||||
m_zoomWidget->show();
|
||||
break;
|
||||
}
|
||||
case VIEW_TYPE_LIST:
|
||||
default:
|
||||
{
|
||||
m_playlistViews->setCurrentWidget(m_tableView);
|
||||
m_zoomWidget->hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2958,14 +2888,10 @@ QString MainWindow::getCurrentViewTypeString()
|
|||
switch (m_viewType)
|
||||
{
|
||||
case VIEW_TYPE_ICONS:
|
||||
{
|
||||
return QStringLiteral("icons");
|
||||
}
|
||||
case VIEW_TYPE_LIST:
|
||||
default:
|
||||
{
|
||||
return QStringLiteral("list");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return QStringLiteral("list");
|
||||
|
@ -2976,18 +2902,12 @@ QString MainWindow::getCurrentThumbnailTypeString()
|
|||
switch (m_thumbnailType)
|
||||
{
|
||||
case THUMBNAIL_TYPE_SCREENSHOT:
|
||||
{
|
||||
return QStringLiteral("screenshot");
|
||||
}
|
||||
case THUMBNAIL_TYPE_TITLE_SCREEN:
|
||||
{
|
||||
return QStringLiteral("title");
|
||||
}
|
||||
case THUMBNAIL_TYPE_BOXART:
|
||||
default:
|
||||
{
|
||||
return QStringLiteral("boxart");
|
||||
}
|
||||
}
|
||||
|
||||
return QStringLiteral("list");
|
||||
|
@ -3187,9 +3107,7 @@ QString MainWindow::getScrubbedString(QString str)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < chars.count(); i++)
|
||||
{
|
||||
str.replace(chars.at(i), '_');
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue