(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

@ -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,7 +945,12 @@ 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);
@ -955,14 +962,9 @@ 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
{ {