mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 13:20:43 +00:00
Qt: C89 changes and other cleanups.
This commit is contained in:
parent
f5840ae6f2
commit
95ed844d81
@ -27,17 +27,17 @@ void ThumbnailDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opt
|
|||||||
|
|
||||||
initStyleOption(&opt, index);
|
initStyleOption(&opt, index);
|
||||||
|
|
||||||
// draw the background
|
/* draw the background */
|
||||||
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, widget);
|
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, widget);
|
||||||
|
|
||||||
// draw the image
|
/* draw the image */
|
||||||
if (!pixmap.isNull())
|
if (!pixmap.isNull())
|
||||||
{
|
{
|
||||||
QPixmap pixmapScaled = pixmap.scaled(adjusted.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
QPixmap pixmapScaled = pixmap.scaled(adjusted.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
style->drawItemPixmap(painter, adjusted, Qt::AlignHCenter | Qt::AlignBottom, pixmapScaled);
|
style->drawItemPixmap(painter, adjusted, Qt::AlignHCenter | Qt::AlignBottom, pixmapScaled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the text
|
/* draw the text */
|
||||||
if (!opt.text.isEmpty())
|
if (!opt.text.isEmpty())
|
||||||
{
|
{
|
||||||
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||||
@ -195,6 +195,7 @@ void GridView::scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint)
|
|||||||
viewport()->update();
|
viewport()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: Make this more efficient by changing m_rectForRow for another data structure. Look at how Qt's own views do it. */
|
||||||
QModelIndex GridView::indexAt(const QPoint &point_) const
|
QModelIndex GridView::indexAt(const QPoint &point_) const
|
||||||
{
|
{
|
||||||
QPoint point(point_);
|
QPoint point(point_);
|
||||||
@ -298,6 +299,7 @@ void GridView::scrollContentsBy(int dx, int dy)
|
|||||||
emit(visibleItemsChangedMaybe());
|
emit(visibleItemsChangedMaybe());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: Maybe add a way to get the previous/next visible indexes. */
|
||||||
QVector<QModelIndex> GridView::visibleIndexes() const {
|
QVector<QModelIndex> GridView::visibleIndexes() const {
|
||||||
return m_visibleIndexes;
|
return m_visibleIndexes;
|
||||||
}
|
}
|
||||||
@ -340,12 +342,16 @@ QRegion GridView::visualRegionForSelection(const QItemSelection &selection) cons
|
|||||||
{
|
{
|
||||||
QRegion region;
|
QRegion region;
|
||||||
QItemSelectionRange range;
|
QItemSelectionRange range;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
foreach(range, selection)
|
for (i; i < selection.size(); i++)
|
||||||
{
|
{
|
||||||
for (int row = range.top(); row <= range.bottom(); ++row)
|
range = selection.at(i);
|
||||||
|
int row = range.top();
|
||||||
|
for (row; row <= range.bottom(); ++row)
|
||||||
{
|
{
|
||||||
for (int column = range.left(); column < range.right(); ++column)
|
int column = range.left();
|
||||||
|
for (column; column < range.right(); ++column)
|
||||||
{
|
{
|
||||||
QModelIndex index = model()->index(row, column, rootIndex());
|
QModelIndex index = model()->index(row, column, rootIndex());
|
||||||
region += visualRect(index);
|
region += visualRect(index);
|
||||||
|
@ -71,4 +71,4 @@ private:
|
|||||||
mutable bool m_hashIsDirty;
|
mutable bool m_hashIsDirty;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GRIDVIEW_H
|
#endif
|
||||||
|
@ -1177,7 +1177,6 @@ void MainWindow::reloadPlaylists()
|
|||||||
QString MainWindow::getCurrentPlaylistPath()
|
QString MainWindow::getCurrentPlaylistPath()
|
||||||
{
|
{
|
||||||
QListWidgetItem *playlistItem = m_listWidget->currentItem();
|
QListWidgetItem *playlistItem = m_listWidget->currentItem();
|
||||||
QHash<QString, QString> contentHash;
|
|
||||||
QString playlistPath;
|
QString playlistPath;
|
||||||
|
|
||||||
if (!playlistItem)
|
if (!playlistItem)
|
||||||
|
@ -191,7 +191,6 @@ void MainWindow::onThumbnailPackDownloadFinished()
|
|||||||
|
|
||||||
reply->disconnect();
|
reply->disconnect();
|
||||||
reply->close();
|
reply->close();
|
||||||
//reply->deleteLater();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onThumbnailPackDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
void MainWindow::onThumbnailPackDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
||||||
|
@ -247,7 +247,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
QMainWindow(parent)
|
QMainWindow(parent)
|
||||||
,m_loadCoreWindow(new LoadCoreWindow(this))
|
,m_loadCoreWindow(new LoadCoreWindow(this))
|
||||||
,m_timer(new QTimer(this))
|
,m_timer(new QTimer(this))
|
||||||
,m_thumbnailTimer(new QTimer(this))
|
|
||||||
,m_currentCore()
|
,m_currentCore()
|
||||||
,m_currentCoreVersion()
|
,m_currentCoreVersion()
|
||||||
,m_statusLabel(new QLabel(this))
|
,m_statusLabel(new QLabel(this))
|
||||||
@ -322,6 +321,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
,m_failedThumbnails(0)
|
,m_failedThumbnails(0)
|
||||||
,m_playlistThumbnailDownloadWasCanceled(false)
|
,m_playlistThumbnailDownloadWasCanceled(false)
|
||||||
,m_pendingDirScrollPath()
|
,m_pendingDirScrollPath()
|
||||||
|
,m_thumbnailTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
QDir playlistDir(settings->paths.directory_playlist);
|
QDir playlistDir(settings->paths.directory_playlist);
|
||||||
@ -338,8 +338,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
QLabel *gridProgressLabel = NULL;
|
QLabel *gridProgressLabel = NULL;
|
||||||
QHBoxLayout *gridFooterLayout = NULL;
|
QHBoxLayout *gridFooterLayout = NULL;
|
||||||
|
|
||||||
//QApplication::setStyle(QStyleFactory::create("windowsvista"));
|
|
||||||
|
|
||||||
qRegisterMetaType<QPointer<ThumbnailWidget> >("ThumbnailWidget");
|
qRegisterMetaType<QPointer<ThumbnailWidget> >("ThumbnailWidget");
|
||||||
qRegisterMetaType<retro_task_callback_t>("retro_task_callback_t");
|
qRegisterMetaType<retro_task_callback_t>("retro_task_callback_t");
|
||||||
|
|
||||||
@ -1514,11 +1512,6 @@ QHash<QString, QString> MainWindow::getCurrentContentHash()
|
|||||||
return getCurrentContentIndex().data(PlaylistModel::HASH).value<QHash<QString, QString> >();
|
return getCurrentContentIndex().data(PlaylistModel::HASH).value<QHash<QString, QString> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onContentItemDoubleClicked(QTableWidgetItem*)
|
|
||||||
{
|
|
||||||
onRunClicked();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::onContentItemDoubleClicked(const QModelIndex &index)
|
void MainWindow::onContentItemDoubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
|
@ -422,7 +422,6 @@ private slots:
|
|||||||
void onSearchEnterPressed();
|
void onSearchEnterPressed();
|
||||||
void onSearchLineEditEdited(const QString &text);
|
void onSearchLineEditEdited(const QString &text);
|
||||||
void onContentItemDoubleClicked(const QModelIndex &index);
|
void onContentItemDoubleClicked(const QModelIndex &index);
|
||||||
void onContentItemDoubleClicked(QTableWidgetItem *item);
|
|
||||||
void onCoreLoadWindowClosed();
|
void onCoreLoadWindowClosed();
|
||||||
void onTreeViewItemsSelected(QModelIndexList selectedIndexes);
|
void onTreeViewItemsSelected(QModelIndexList selectedIndexes);
|
||||||
void onSearchResetClicked();
|
void onSearchResetClicked();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user