(Qt) Style nits

This commit is contained in:
twinaphex 2020-07-20 22:05:12 +02:00
parent 9ecc30a501
commit 4ca1692174
2 changed files with 34 additions and 30 deletions

View File

@ -55,12 +55,14 @@ public:
QString categoryIconName() const { return m_categoryIconName; } QString categoryIconName() const { return m_categoryIconName; }
virtual void load() virtual void load()
{ {
for (int i = 0; i < m_pages.size(); i++) size_t size = m_pages.size();
for (int i = 0; i < size; i++)
m_pages.at(i)->load(); m_pages.at(i)->load();
} }
virtual void apply() virtual void apply()
{ {
for (int i = 0; i < m_pages.size(); i++) size_t size = m_pages.size();
for (int i = 0; i < size; i++)
m_pages.at(i)->apply(); m_pages.at(i)->apply();
} }
protected: protected:

View File

@ -92,16 +92,16 @@ extern "C" {
#include "shaderparamsdialog.h" #include "shaderparamsdialog.h"
#include "../../../AUTHORS.h" #include "../../../AUTHORS.h"
#define TIMER_MSEC 1000 /* periodic timer for gathering statistics */ #define TIMER_MSEC 1000 /* periodic timer for gathering statistics */
#define STATUS_MSG_THROTTLE_MSEC 250 #define STATUS_MSG_THROTTLE_MSEC 250
#define GENERIC_FOLDER_ICON "/xmb/dot-art/png/folder.png" #define GENERIC_FOLDER_ICON "/xmb/dot-art/png/folder.png"
#define HIRAGANA_START 0x3041U #define HIRAGANA_START 0x3041U
#define HIRAGANA_END 0x3096U #define HIRAGANA_END 0x3096U
#define KATAKANA_START 0x30A1U #define KATAKANA_START 0x30A1U
#define KATAKANA_END 0x30F6U #define KATAKANA_END 0x30F6U
#define HIRA_KATA_OFFSET (KATAKANA_START - HIRAGANA_START) #define HIRA_KATA_OFFSET (KATAKANA_START - HIRAGANA_START)
#define DOCS_URL "http://docs.libretro.com/" #define DOCS_URL "http://docs.libretro.com/"
static ui_window_qt_t ui_window = {0}; static ui_window_qt_t ui_window = {0};
@ -126,8 +126,8 @@ static const QPixmap getInvader(void)
static void scan_finished_handler(retro_task_t *task, static void scan_finished_handler(retro_task_t *task,
void *task_data, void *user_data, const char *err) void *task_data, void *user_data, const char *err)
{ {
bool dontAsk = false; bool dontAsk = false;
bool answer = false; bool answer = false;
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_ctx_environment_t menu_environ; menu_ctx_environment_t menu_environ;
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST; menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;
@ -759,8 +759,9 @@ void MainWindow::updateVisibleItems()
{ {
unsigned i; unsigned i;
QVector<QModelIndex> indexes = m_gridView->visibleIndexes(); QVector<QModelIndex> indexes = m_gridView->visibleIndexes();
size_t size = indexes.size();
for (i = 0; i < indexes.size(); i++) for (i = 0; i < size; i++)
m_playlistModel->loadThumbnail(m_proxyModel->mapToSource(indexes.at(i))); m_playlistModel->loadThumbnail(m_proxyModel->mapToSource(indexes.at(i)));
} }
} }
@ -799,8 +800,9 @@ QVector<QPair<QString, QString> > MainWindow::getPlaylists()
{ {
unsigned i; unsigned i;
QVector<QPair<QString, QString> > playlists; QVector<QPair<QString, QString> > playlists;
size_t size = m_listWidget->count();
for (i = 0; i < m_listWidget->count(); i++) for (i = 0; i < size; i++)
{ {
QString label, path; QString label, path;
QPair<QString, QString> pair; QPair<QString, QString> pair;
@ -943,10 +945,15 @@ bool MainWindow::setCustomThemeFile(QString filePath)
{ {
bool opened = file.open(QIODevice::ReadOnly); bool opened = file.open(QIODevice::ReadOnly);
if (opened) if (!opened)
{
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED));
return false;
}
{ {
QByteArray fileArray = file.readAll(); QByteArray fileArray = file.readAll();
QString fileStr = QString::fromUtf8(fileArray); QString fileStr = QString::fromUtf8(fileArray);
file.close(); file.close();
@ -955,13 +962,8 @@ bool MainWindow::setCustomThemeFile(QString filePath)
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY)); QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY));
return false; return false;
} }
else
setCustomThemeString(fileStr); setCustomThemeString(fileStr);
}
else
{
QMessageBox::critical(this, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED));
return false;
} }
} }
else else
@ -1060,7 +1062,7 @@ void MainWindow::onFileBrowserTreeContextMenuRequested(const QPoint&)
if (currentDirString.isEmpty()) if (currentDirString.isEmpty())
return; return;
dir = currentDirString; dir = currentDirString;
if (!dir.exists()) if (!dir.exists())
return; return;
@ -1071,13 +1073,13 @@ void MainWindow::onFileBrowserTreeContextMenuRequested(const QPoint&)
actions.append(scanAction.data()); actions.append(scanAction.data());
action = QMenu::exec(actions, QCursor::pos(), NULL, m_dirTree); action = QMenu::exec(actions, QCursor::pos(), NULL, m_dirTree);
if (!action) if (!action)
return; return;
dirArray = currentDirString.toUtf8(); dirArray = currentDirString.toUtf8();
fullpath = dirArray.constData(); fullpath = dirArray.constData();
task_push_dbscan( task_push_dbscan(
path_dir_playlist, path_dir_playlist,
@ -1110,10 +1112,10 @@ void MainWindow::onGotStatusMessage(
return; return;
if (screen) if (screen)
msecDuration = (duration / screen->refreshRate()) * 1000; msecDuration = (duration / screen->refreshRate()) * 1000;
if (msecDuration <= 0) if (msecDuration <= 0)
msecDuration = 1000; msecDuration = 1000;
if (status->currentMessage().isEmpty() || flush) if (status->currentMessage().isEmpty() || flush)
{ {