Show marked files in file list bold
This commit is contained in:
+19
-1
@@ -3,6 +3,7 @@
|
||||
#include <QDir>
|
||||
#include "loadrunable.h"
|
||||
#include "rawimage.h"
|
||||
#include "database.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -97,9 +98,10 @@ void Image::thumbnailLoadFinish(void *rawImage)
|
||||
emit thumbnailLoaded(this);
|
||||
}
|
||||
|
||||
ImageRingList::ImageRingList(QObject *parent) : QAbstractItemModel(parent)
|
||||
ImageRingList::ImageRingList(Database *database, QObject *parent) : QAbstractItemModel(parent)
|
||||
, m_liveMode(false)
|
||||
, m_analyzeLevel(None)
|
||||
, m_database(database)
|
||||
{
|
||||
connect(&m_fileSystemWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString)));
|
||||
m_thumbPool = new QThreadPool(this);
|
||||
@@ -273,6 +275,15 @@ QStringList ImageRingList::imageNames() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ImageRingList::updateMark()
|
||||
{
|
||||
if(m_images.size())
|
||||
{
|
||||
QModelIndex idx = index(m_currImage - m_images.begin(), 0);
|
||||
emit dataChanged(idx, idx, {Qt::FontRole});
|
||||
}
|
||||
}
|
||||
|
||||
QModelIndex ImageRingList::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
return createIndex(row, column, m_images.at(row).get());
|
||||
@@ -305,6 +316,13 @@ QVariant ImageRingList::data(const QModelIndex &index, int role) const
|
||||
QFileInfo info(m_images.at(index.row())->name());
|
||||
return info.fileName();
|
||||
}
|
||||
case Qt::FontRole:
|
||||
{
|
||||
bool marked = m_database->isMarked(m_images.at(index.row())->name());
|
||||
QFont font;
|
||||
font.setBold(marked);
|
||||
return font;
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user