(QT/UI) Cleanups
This commit is contained in:
parent
254c48707d
commit
c662da11c3
|
@ -284,9 +284,7 @@ void CoreOptionsDialog::buildLayout()
|
|||
comboBox = new QComboBox(this);
|
||||
|
||||
for (k = 0; k < option->vals->size; k++)
|
||||
{
|
||||
comboBox->addItem(option->vals->elems[k].data, option->key);
|
||||
}
|
||||
|
||||
comboBox->setCurrentText(val);
|
||||
|
||||
|
|
|
@ -178,29 +178,32 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
|
|||
{
|
||||
if (selectedAction == addFilesAction.data())
|
||||
{
|
||||
QStringList filePaths = QFileDialog::getOpenFileNames(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SELECT_FILES));
|
||||
QStringList filePaths = QFileDialog::getOpenFileNames(
|
||||
this,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SELECT_FILES));
|
||||
|
||||
if (!filePaths.isEmpty())
|
||||
addFilesToPlaylist(filePaths);
|
||||
}
|
||||
else if (selectedAction == addEntryAction.data())
|
||||
{
|
||||
addFilesToPlaylist(QStringList());
|
||||
}
|
||||
else if (selectedAction == addFolderAction.data())
|
||||
{
|
||||
QString dirPath = QFileDialog::getExistingDirectory(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER), QString(), QFileDialog::ShowDirsOnly);
|
||||
QString dirPath = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_SELECT_FOLDER),
|
||||
QString(), QFileDialog::ShowDirsOnly);
|
||||
|
||||
if (!dirPath.isEmpty())
|
||||
addFilesToPlaylist(QStringList() << dirPath);
|
||||
}
|
||||
else if (selectedAction == editAction.data())
|
||||
{
|
||||
PlaylistEntryDialog *playlistDialog = playlistEntryDialog();
|
||||
QHash<QString, QString> selectedCore;
|
||||
QString selectedDatabase;
|
||||
QString selectedName;
|
||||
QString selectedPath;
|
||||
QHash<QString, QString> selectedCore;
|
||||
PlaylistEntryDialog *playlistDialog = playlistEntryDialog();
|
||||
QString currentPlaylistPath = getCurrentPlaylistPath();
|
||||
|
||||
if (!playlistDialog->showDialog(contentHash))
|
||||
|
@ -218,9 +221,7 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
|
|||
}
|
||||
|
||||
if (selectedDatabase.isEmpty())
|
||||
{
|
||||
selectedDatabase = QFileInfo(currentPlaylistPath).fileName().remove(file_path_str(FILE_PATH_LPL_EXTENSION));
|
||||
}
|
||||
|
||||
contentHash["label"] = selectedName;
|
||||
contentHash["path"] = selectedPath;
|
||||
|
@ -235,8 +236,6 @@ void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
|
|||
}
|
||||
}
|
||||
else if (selectedAction == deleteAction.data())
|
||||
{
|
||||
deleteCurrentPlaylistItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -430,8 +430,10 @@ QString GridView::getLayout() const
|
|||
return "anchored";
|
||||
case Centered:
|
||||
default:
|
||||
return "centered";
|
||||
break;
|
||||
}
|
||||
|
||||
return "centered";
|
||||
}
|
||||
|
||||
void GridView::setLayout(QString layout)
|
||||
|
@ -480,8 +482,10 @@ QString GridItem::getThumbnailVerticalAlign() const
|
|||
return "center";
|
||||
case Qt::AlignBottom:
|
||||
default:
|
||||
return "bottom";
|
||||
break;
|
||||
}
|
||||
|
||||
return "bottom";
|
||||
}
|
||||
|
||||
void GridItem::setThumbnailVerticalAlign(const QString valign)
|
||||
|
|
|
@ -132,10 +132,10 @@ void PlaylistEntryDialog::loadPlaylistOptions()
|
|||
|
||||
for (i = 0; i < core_info_list->count; i++)
|
||||
{
|
||||
QString ui_display_name;
|
||||
QHash<QString, QString> hash;
|
||||
const core_info_t *core = &core_info_list->list[i];
|
||||
QStringList databases = QString(core->databases).split("|");
|
||||
QHash<QString, QString> hash;
|
||||
QString ui_display_name;
|
||||
|
||||
hash["core_name"] = core->core_name;
|
||||
hash["core_display_name"] = core->display_name;
|
||||
|
@ -147,7 +147,9 @@ void PlaylistEntryDialog::loadPlaylistOptions()
|
|||
if (ui_display_name.isEmpty())
|
||||
ui_display_name = hash.value("core_display_name");
|
||||
if (ui_display_name.isEmpty())
|
||||
ui_display_name = QFileInfo(hash.value("core_path")).fileName();
|
||||
ui_display_name = QFileInfo(
|
||||
hash.value("core_path")).fileName();
|
||||
|
||||
if (ui_display_name.isEmpty())
|
||||
continue;
|
||||
|
||||
|
@ -191,7 +193,8 @@ bool PlaylistEntryDialog::nameFieldEnabled()
|
|||
return m_nameLineEdit->isEnabled();
|
||||
}
|
||||
|
||||
void PlaylistEntryDialog::setEntryValues(const QHash<QString, QString> &contentHash)
|
||||
void PlaylistEntryDialog::setEntryValues(
|
||||
const QHash<QString, QString> &contentHash)
|
||||
{
|
||||
QString db;
|
||||
QString coreName = contentHash.value("core_name");
|
||||
|
|
|
@ -293,9 +293,7 @@ void MainWindow::downloadNextPlaylistThumbnail(QString system, QString title, QS
|
|||
void MainWindow::downloadPlaylistThumbnails(QString playlistPath)
|
||||
{
|
||||
QFile playlistFile(playlistPath);
|
||||
QString system;
|
||||
QString title;
|
||||
QString type;
|
||||
QString system, title, type;
|
||||
settings_t *settings = config_get_ptr();
|
||||
int i;
|
||||
int count;
|
||||
|
|
|
@ -94,7 +94,8 @@ Qt::ItemFlags PlaylistModel::flags(const QModelIndex &index) const
|
|||
|
||||
bool PlaylistModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (index.isValid() && role == Qt::EditRole) {
|
||||
if (index.isValid() && role == Qt::EditRole)
|
||||
{
|
||||
QHash<QString, QString> hash = m_contents.at(index.row());
|
||||
|
||||
hash["label"] = value.toString();
|
||||
|
@ -114,7 +115,6 @@ QVariant PlaylistModel::headerData(int section, Qt::Orientation orientation, int
|
|||
|
||||
if (orientation == Qt::Horizontal)
|
||||
return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NAME);
|
||||
else
|
||||
return section + 1;
|
||||
}
|
||||
|
||||
|
@ -151,10 +151,8 @@ bool PlaylistModel::isSupportedImage(const QString path) const
|
|||
extensionStr = path.mid(lastIndex + 1);
|
||||
|
||||
if (!extensionStr.isEmpty())
|
||||
{
|
||||
extension = extensionStr.toLower().toUtf8();
|
||||
}
|
||||
}
|
||||
|
||||
if (!extension.isEmpty() && m_imageFormats.contains(extension))
|
||||
return true;
|
||||
|
@ -174,10 +172,9 @@ QString PlaylistModel::getThumbnailPath(const QHash<QString, QString> &hash, QSt
|
|||
/* use thumbnail widgets to show regular image files */
|
||||
return hash["path"];
|
||||
}
|
||||
else
|
||||
{
|
||||
return getPlaylistThumbnailsDir(hash.value("db_name")) + "/" + type + "/" + getSanitizedThumbnailName(hash["label_noext"]);
|
||||
}
|
||||
|
||||
return getPlaylistThumbnailsDir(hash.value("db_name"))
|
||||
+ "/" + type + "/" + getSanitizedThumbnailName(hash["label_noext"]);
|
||||
}
|
||||
|
||||
QString PlaylistModel::getCurrentTypeThumbnailPath(const QModelIndex &index) const
|
||||
|
@ -191,13 +188,16 @@ QString PlaylistModel::getCurrentTypeThumbnailPath(const QModelIndex &index) con
|
|||
case THUMBNAIL_TYPE_TITLE_SCREEN:
|
||||
return getThumbnailPath(index, THUMBNAIL_TITLE);
|
||||
default:
|
||||
return QString();
|
||||
break;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void PlaylistModel::reloadThumbnail(const QModelIndex &index)
|
||||
{
|
||||
if (index.isValid()) {
|
||||
if (index.isValid())
|
||||
{
|
||||
reloadThumbnailPath(getCurrentTypeThumbnailPath(index));
|
||||
loadThumbnail(index);
|
||||
}
|
||||
|
@ -281,16 +281,16 @@ bool MainWindow::addDirectoryFilesToList(QProgressDialog *dialog, QStringList &l
|
|||
if (dialog->wasCanceled())
|
||||
return false;
|
||||
|
||||
/* Needed to update progress dialog while doing
|
||||
* a lot of stuff on the main thread. */
|
||||
if (i % 25 == 0)
|
||||
{
|
||||
/* Needed to update progress dialog while doing a lot of stuff on the main thread. */
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
if (fileInfo.isDir())
|
||||
{
|
||||
QDir fileInfoDir(path);
|
||||
bool success = addDirectoryFilesToList(dialog, list, fileInfoDir, extensions);
|
||||
bool success = addDirectoryFilesToList(
|
||||
dialog, list, fileInfoDir, extensions);
|
||||
|
||||
if (!success)
|
||||
return false;
|
||||
|
@ -449,11 +449,10 @@ void MainWindow::addFilesToPlaylist(QStringList files)
|
|||
if (dialog->wasCanceled())
|
||||
return;
|
||||
|
||||
/* Needed to update progress dialog while
|
||||
* doing a lot of stuff on the main thread. */
|
||||
if (i % 25 == 0)
|
||||
{
|
||||
/* Needed to update progress dialog while doing a lot of stuff on the main thread. */
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
if (fileInfo.isDir())
|
||||
{
|
||||
|
@ -517,9 +516,11 @@ void MainWindow::addFilesToPlaylist(QStringList files)
|
|||
const char *coreNameData = NULL;
|
||||
const char *databaseData = NULL;
|
||||
|
||||
/* Cancel out of everything, the
|
||||
* current progress will not be written
|
||||
* to the playlist at all. */
|
||||
if (dialog->wasCanceled())
|
||||
{
|
||||
/* Cancel out of everything, the current progress will not be written to the playlist at all. */
|
||||
playlist_free(playlist);
|
||||
return;
|
||||
}
|
||||
|
@ -1202,9 +1203,7 @@ void MainWindow::reloadPlaylists()
|
|||
if (!foundCurrent)
|
||||
{
|
||||
if (foundInitial && initialItem)
|
||||
{
|
||||
m_listWidget->setCurrentItem(initialItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* the previous playlist must be gone now, just select the first one */
|
||||
|
@ -1218,8 +1217,8 @@ void MainWindow::reloadPlaylists()
|
|||
|
||||
QString MainWindow::getCurrentPlaylistPath()
|
||||
{
|
||||
QListWidgetItem *playlistItem = m_listWidget->currentItem();
|
||||
QString playlistPath;
|
||||
QListWidgetItem *playlistItem = m_listWidget->currentItem();
|
||||
|
||||
if (!playlistItem)
|
||||
return playlistPath;
|
||||
|
@ -1231,14 +1230,14 @@ QString MainWindow::getCurrentPlaylistPath()
|
|||
|
||||
bool MainWindow::currentPlaylistIsSpecial()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
QString playlistDirAbsPath = playlistDir.absolutePath();
|
||||
QFileInfo currentPlaylistFileInfo;
|
||||
QString currentPlaylistPath;
|
||||
QString currentPlaylistDirPath;
|
||||
QListWidgetItem *currentPlaylistItem = m_listWidget->currentItem();
|
||||
bool specialPlaylist = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
QString playlistDirAbsPath = playlistDir.absolutePath();
|
||||
QListWidgetItem *currentPlaylistItem = m_listWidget->currentItem();
|
||||
|
||||
if (!currentPlaylistItem)
|
||||
return false;
|
||||
|
@ -1247,7 +1246,8 @@ bool MainWindow::currentPlaylistIsSpecial()
|
|||
currentPlaylistFileInfo = QFileInfo(currentPlaylistPath);
|
||||
currentPlaylistDirPath = currentPlaylistFileInfo.absoluteDir().absolutePath();
|
||||
|
||||
/* Don't just compare strings in case there are case differences on Windows that should be ignored. */
|
||||
/* Don't just compare strings in case there are
|
||||
* case differences on Windows that should be ignored. */
|
||||
if (QDir(currentPlaylistDirPath) != QDir(playlistDirAbsPath))
|
||||
specialPlaylist = true;
|
||||
|
||||
|
@ -1262,7 +1262,8 @@ bool MainWindow::currentPlaylistIsAll()
|
|||
if (!currentPlaylistItem)
|
||||
return false;
|
||||
|
||||
if (currentPlaylistItem->data(Qt::UserRole).toString() == ALL_PLAYLISTS_TOKEN)
|
||||
if (currentPlaylistItem->data(Qt::UserRole).toString()
|
||||
== ALL_PLAYLISTS_TOKEN)
|
||||
all = true;
|
||||
|
||||
return all;
|
||||
|
@ -1310,10 +1311,12 @@ void MainWindow::deleteCurrentPlaylistItem()
|
|||
|
||||
QVector<QHash<QString, QString> > MainWindow::getPlaylistDefaultCores()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct string_list *playlists = string_split(settings->arrays.playlist_names, ";");
|
||||
struct string_list *cores = string_split(settings->arrays.playlist_cores, ";");
|
||||
unsigned i = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct string_list *playlists = string_split(
|
||||
settings->arrays.playlist_names, ";");
|
||||
struct string_list *cores = string_split(
|
||||
settings->arrays.playlist_cores, ";");
|
||||
QVector<QHash<QString, QString> > coreList;
|
||||
|
||||
if (!playlists || !cores)
|
||||
|
@ -1433,9 +1436,7 @@ void PlaylistModel::addPlaylistItems(const QStringList &paths, bool add)
|
|||
m_contents.clear();
|
||||
|
||||
for (i = 0; i < paths.size(); i++)
|
||||
{
|
||||
getPlaylistItems(paths.at(i));
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ static enum ui_msg_window_response ui_msg_window_qt_response(ui_msg_window_state
|
|||
return UI_MSG_RESPONSE_NA;
|
||||
}
|
||||
|
||||
static QFlags<QMessageBox::StandardButton> ui_msg_window_qt_buttons(ui_msg_window_state *state)
|
||||
static QFlags<QMessageBox::StandardButton>
|
||||
ui_msg_window_qt_buttons(ui_msg_window_state *state)
|
||||
{
|
||||
switch (state->buttons)
|
||||
{
|
||||
|
@ -74,7 +75,8 @@ static QFlags<QMessageBox::StandardButton> ui_msg_window_qt_buttons(ui_msg_windo
|
|||
return QMessageBox::NoButton;
|
||||
}
|
||||
|
||||
static enum ui_msg_window_response ui_msg_window_qt_error(ui_msg_window_state *state)
|
||||
static enum ui_msg_window_response
|
||||
ui_msg_window_qt_error(ui_msg_window_state *state)
|
||||
{
|
||||
QFlags<QMessageBox::StandardButton> flags = ui_msg_window_qt_buttons(state);
|
||||
return ui_msg_window_qt_response(state, QMessageBox::critical((QWidget*)state->window, state->title, state->text, flags));
|
||||
|
|
|
@ -730,19 +730,19 @@ MainWindow::~MainWindow()
|
|||
delete m_proxyFileModel;
|
||||
}
|
||||
|
||||
void MainWindow::startTimer() {
|
||||
void MainWindow::startTimer()
|
||||
{
|
||||
if (m_thumbnailTimer->isActive())
|
||||
{
|
||||
m_thumbnailTimer->stop();
|
||||
m_thumbnailTimer->start(50);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_thumbnailTimer->start(50);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateVisibleItems() {
|
||||
void MainWindow::updateVisibleItems()
|
||||
{
|
||||
if (m_currentBrowser == BROWSER_TYPE_PLAYLISTS && m_viewType == VIEW_TYPE_ICONS)
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -1194,14 +1194,10 @@ void MainWindow::onLaunchWithComboBoxIndexChanged(int)
|
|||
m_coreInfoLabel->setText(coreInfoText);
|
||||
|
||||
if (coreSelection == CORE_SELECTION_LOAD_CORE)
|
||||
{
|
||||
onLoadCoreClicked();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_loadCoreWindow->setProperty("last_launch_with_index", m_launchWithComboBox->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::Theme MainWindow::getThemeFromString(QString themeString)
|
||||
{
|
||||
|
@ -1286,8 +1282,8 @@ QString MainWindow::changeThumbnail(const QImage &image, QString type)
|
|||
const char *dirData = dirArray.constData();
|
||||
QByteArray thumbArray = QDir::toNativeSeparators(thumbPath).toUtf8();
|
||||
const char *thumbData = thumbArray.constData();
|
||||
QDir dir(dirString);
|
||||
int quality = -1;
|
||||
QDir dir(dirString);
|
||||
QImage scaledImage(image);
|
||||
|
||||
if (!dir.exists())
|
||||
|
@ -1325,7 +1321,8 @@ QString MainWindow::changeThumbnail(const QImage &image, QString type)
|
|||
return QString();
|
||||
}
|
||||
|
||||
void MainWindow::onThumbnailDropped(const QImage &image, ThumbnailType thumbnailType)
|
||||
void MainWindow::onThumbnailDropped(const QImage &image,
|
||||
ThumbnailType thumbnailType)
|
||||
{
|
||||
switch (thumbnailType)
|
||||
{
|
||||
|
@ -1381,11 +1378,11 @@ void MainWindow::onThumbnailDropped(const QImage &image, ThumbnailType thumbnail
|
|||
|
||||
QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
||||
{
|
||||
unsigned i;
|
||||
QVector<QHash<QString, QString> > infoList;
|
||||
QHash<QString, QString> currentCore = getSelectedCore();
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
const core_info_t *core_info = NULL;
|
||||
unsigned i = 0;
|
||||
|
||||
core_info_get_list(&core_info_list);
|
||||
|
||||
|
@ -1407,7 +1404,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
{
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
hash["key"] = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE_INFORMATION_AVAILABLE);
|
||||
hash["key"] = msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_NO_CORE_INFORMATION_AVAILABLE);
|
||||
hash["value"] = "";
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1419,7 +1417,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
{
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_NAME)) + ":";
|
||||
hash["key"] = QString(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_NAME)) + ":";
|
||||
hash["value"] = core_info->core_name;
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1429,7 +1428,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
{
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_LABEL)) + ":";
|
||||
hash["key"] = QString(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CORE_LABEL)) + ":";
|
||||
hash["value"] = core_info->display_name;
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1468,7 +1468,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
categories += ", ";
|
||||
}
|
||||
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES)) + ":";
|
||||
hash["key"] = QString(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES)) + ":";
|
||||
hash["value"] = categories;
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1487,7 +1488,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
authors += ", ";
|
||||
}
|
||||
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS)) + ":";
|
||||
hash["key"] = QString(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS)) + ":";
|
||||
hash["value"] = authors;
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1506,7 +1508,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
permissions += ", ";
|
||||
}
|
||||
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS)) + ":";
|
||||
hash["key"] = QString(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS)) + ":";
|
||||
hash["value"] = permissions;
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1525,7 +1528,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
licenses += ", ";
|
||||
}
|
||||
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES)) + ":";
|
||||
hash["key"] = QString(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES)) + ":";
|
||||
hash["value"] = licenses;
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1544,7 +1548,8 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
|||
supported_extensions += ", ";
|
||||
}
|
||||
|
||||
hash["key"] = QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS)) + ":";
|
||||
hash["key"] = QString(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS)) + ":";
|
||||
hash["value"] = supported_extensions;
|
||||
|
||||
infoList.append(hash);
|
||||
|
@ -1957,7 +1962,8 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
|||
corePath, contentPath, contentLabel, &content_info,
|
||||
NULL, NULL))
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR), msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT));
|
||||
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR),
|
||||
msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1995,7 +2001,8 @@ bool MainWindow::isContentLessCore()
|
|||
|
||||
bool MainWindow::isCoreLoaded()
|
||||
{
|
||||
if (m_currentCore.isEmpty() || m_currentCore == msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))
|
||||
if ( m_currentCore.isEmpty() ||
|
||||
m_currentCore == msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -2109,9 +2116,9 @@ void MainWindow::setCoreActions()
|
|||
{
|
||||
if (allPlaylists)
|
||||
{
|
||||
QFileInfo info;
|
||||
QListWidgetItem *listItem = m_listWidget->item(row);
|
||||
QString listItemString = listItem->data(Qt::UserRole).toString();
|
||||
QFileInfo info;
|
||||
|
||||
info.setFile(listItemString);
|
||||
|
||||
|
@ -2397,8 +2404,8 @@ void MainWindow::renamePlaylistItem(QListWidgetItem *item, QString newName)
|
|||
QFileInfo playlistInfo;
|
||||
QString playlistPath;
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
bool specialPlaylist = false;
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
@ -2407,7 +2414,8 @@ void MainWindow::renamePlaylistItem(QListWidgetItem *item, QString newName)
|
|||
playlistInfo = playlistPath;
|
||||
oldName = playlistInfo.completeBaseName();
|
||||
|
||||
/* Don't just compare strings in case there are case differences on Windows that should be ignored. */
|
||||
/* Don't just compare strings in case there are
|
||||
* case differences on Windows that should be ignored. */
|
||||
if (QDir(playlistInfo.absoluteDir()) != QDir(playlistDir))
|
||||
{
|
||||
/* special playlists like history etc. can't have an association */
|
||||
|
@ -3025,15 +3033,15 @@ void MainWindow::onShowInfoMessage(QString msg)
|
|||
|
||||
int MainWindow::onExtractArchive(QString path, QString extractionDir, QString tempExtension, retro_task_callback_t cb)
|
||||
{
|
||||
unsigned i;
|
||||
file_archive_transfer_t state;
|
||||
struct archive_extract_userdata userdata;
|
||||
QByteArray pathArray = path.toUtf8();
|
||||
QByteArray dirArray = extractionDir.toUtf8();
|
||||
const char *file = pathArray.constData();
|
||||
const char *dir = dirArray.constData();
|
||||
file_archive_transfer_t state;
|
||||
struct archive_extract_userdata userdata;
|
||||
struct string_list *file_list = file_archive_get_file_list(file, NULL);
|
||||
bool returnerr = true;
|
||||
unsigned i;
|
||||
|
||||
if (!file_list || file_list->size == 0)
|
||||
{
|
||||
|
|
|
@ -109,6 +109,7 @@ void MainWindow::onUpdateNetworkSslErrors(const QList<QSslError> &errors)
|
|||
QString string = QString("Ignoring SSL error code ") + QString::number(error.error()) + ": " + error.errorString();
|
||||
QByteArray stringArray = string.toUtf8();
|
||||
const char *stringData = stringArray.constData();
|
||||
|
||||
RARCH_ERR("[Qt]: %s\n", stringData);
|
||||
}
|
||||
|
||||
|
@ -129,7 +130,10 @@ void MainWindow::onRetroArchUpdateDownloadFinished()
|
|||
|
||||
m_updateProgressDialog->cancel();
|
||||
|
||||
/* At least on Linux, the progress dialog will refuse to hide itself and will stay on screen in a corrupted way if we happen to show an error message in this function. processEvents() will sometimes fix it, other times not... seems random. */
|
||||
/* At least on Linux, the progress dialog will refuse to hide itself and
|
||||
* will stay onscreen in a corrupted way if we happen to show an error
|
||||
* message in this function. processEvents() will sometimes fix it,
|
||||
* other times not... seems random. */
|
||||
qApp->processEvents();
|
||||
|
||||
if (!reply)
|
||||
|
@ -143,7 +147,9 @@ void MainWindow::onRetroArchUpdateDownloadFinished()
|
|||
|
||||
if (code != 200)
|
||||
{
|
||||
emit showErrorMessageDeferred(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR)) + ": HTTP Code " + QString::number(code));
|
||||
emit showErrorMessageDeferred(QString(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NETWORK_ERROR))
|
||||
+ ": HTTP Code " + QString::number(code));
|
||||
RARCH_ERR("[Qt]: RetroArch update failed with HTTP status code: %d\n", code);
|
||||
reply->disconnect();
|
||||
reply->abort();
|
||||
|
|
|
@ -70,14 +70,16 @@ private:
|
|||
void resizeEvent(QResizeEvent *event) final
|
||||
{
|
||||
QWidget *inner = widget();
|
||||
|
||||
if (inner)
|
||||
{
|
||||
int fw = frameWidth() * 2;
|
||||
QSize innerSize = event->size() - QSize(fw, fw);
|
||||
QSize innerSizeHint = inner->minimumSizeHint();
|
||||
|
||||
/* Widget wants to be bigger than available space */
|
||||
if (innerSizeHint.height() > innerSize.height())
|
||||
{ /* Widget wants to be bigger than available space */
|
||||
{
|
||||
innerSize.setWidth(innerSize.width() - scrollBarWidth());
|
||||
innerSize.setHeight(innerSizeHint.height());
|
||||
}
|
||||
|
@ -89,10 +91,12 @@ private:
|
|||
QSize minimumSizeHint() const final
|
||||
{
|
||||
QWidget *inner = widget();
|
||||
if (inner) {
|
||||
int fw = frameWidth() * 2;
|
||||
|
||||
if (inner)
|
||||
{
|
||||
int fw = frameWidth() * 2;
|
||||
QSize minSize = inner->minimumSizeHint();
|
||||
|
||||
minSize += QSize(fw, fw);
|
||||
minSize += QSize(scrollBarWidth(), 0);
|
||||
minSize.setWidth(qMin(minSize.width(), MAX_MIN_WIDTH));
|
||||
|
@ -124,20 +128,21 @@ ViewOptionsDialog::ViewOptionsDialog(MainWindow *mainwindow, QWidget *parent) :
|
|||
,m_optionsList(new QListWidget(this))
|
||||
,m_optionsStack(new QStackedLayout)
|
||||
{
|
||||
int width;
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
QLabel *m_headerLabel = new QLabel(this);
|
||||
// Header label with large font and a bit of spacing (align with group boxes)
|
||||
/* Header label with large font and a bit of spacing
|
||||
* (align with group boxes) */
|
||||
QFont headerLabelFont = m_headerLabel->font();
|
||||
const int pointSize = headerLabelFont.pointSize();
|
||||
QHBoxLayout *headerHLayout = new QHBoxLayout;
|
||||
const int leftMargin = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
int width;
|
||||
|
||||
m_optionsStack->setMargin(0);
|
||||
|
||||
headerLabelFont.setBold(true);
|
||||
|
||||
// Paranoia: Should a font be set in pixels...
|
||||
/* Paranoia: Should a font be set in pixels... */
|
||||
if (pointSize > 0)
|
||||
headerLabelFont.setPointSize(pointSize + 2);
|
||||
|
||||
|
@ -216,13 +221,11 @@ void ViewOptionsDialog::addCategory(OptionsCategory *category)
|
|||
|
||||
void ViewOptionsDialog::repaintIcons()
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < m_categoryList.size(); i++)
|
||||
{
|
||||
m_optionsList->item(i)->setIcon(getIcon(m_categoryList.at(i)));
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
@ -256,11 +259,9 @@ void ViewOptionsDialog::showDialog()
|
|||
#ifndef HAVE_MENU
|
||||
m_viewOptionsWidget->loadViewOptions();
|
||||
#else
|
||||
int i;
|
||||
unsigned i;
|
||||
for (i = 0; i < m_categoryList.size(); i++)
|
||||
{
|
||||
m_categoryList.at(i)->load();
|
||||
}
|
||||
#endif
|
||||
show();
|
||||
activateWindow();
|
||||
|
@ -277,9 +278,7 @@ void ViewOptionsDialog::onRejected()
|
|||
int i;
|
||||
|
||||
for (i = 0; i < m_categoryList.size(); i++)
|
||||
{
|
||||
m_categoryList.at(i)->apply();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -395,13 +394,13 @@ void ViewOptionsWidget::onHighlightColorChoose()
|
|||
|
||||
void ViewOptionsWidget::loadViewOptions()
|
||||
{
|
||||
int i;
|
||||
int themeIndex = 0;
|
||||
int playlistIndex = 0;
|
||||
QColor highlightColor = m_settings->value("highlight_color", QApplication::palette().highlight().color()).value<QColor>();
|
||||
QPixmap highlightPixmap(m_highlightColorPushButton->iconSize());
|
||||
QVector<QPair<QString, QString> > playlists = m_mainwindow->getPlaylists();
|
||||
QString initialPlaylist = m_settings->value("initial_playlist", m_mainwindow->getSpecialPlaylistPath(SPECIAL_PLAYLIST_HISTORY)).toString();
|
||||
int themeIndex = 0;
|
||||
int playlistIndex = 0;
|
||||
int i;
|
||||
|
||||
m_saveGeometryCheckBox->setChecked(m_settings->value("save_geometry", false).toBool());
|
||||
m_saveDockPositionsCheckBox->setChecked(m_settings->value("save_dock_positions", false).toBool());
|
||||
|
|
Loading…
Reference in New Issue