Close to finished. Need to fix the upload part. Viewing works (in grayscale)

This commit is contained in:
robotbrain
2014-02-23 19:45:59 -05:00
parent 4a77524b05
commit 5e33da258c
9 changed files with 53 additions and 134 deletions

View File

@ -1,6 +1,6 @@
#include "ScreenshotList.h"
#include "QDir"
#include "QPixmap"
#include "QIcon"
ScreenshotList::ScreenshotList(BaseInstance *instance, QObject *parent)
: QAbstractListModel(parent), m_instance(instance)
@ -20,11 +20,7 @@ QVariant ScreenshotList::data(const QModelIndex &index, int role) const
switch (role)
{
case Qt::DecorationRole:
{
QPixmap map;
map.loadFromData(m_screenshots.at(index.row())->file);
return map;
}
return QIcon(m_screenshots.at(index.row())->file);
case Qt::DisplayRole:
return m_screenshots.at(index.row())->timestamp;
case Qt::ToolTipRole:
@ -43,7 +39,7 @@ QVariant ScreenshotList::headerData(int section, Qt::Orientation orientation, in
Qt::ItemFlags ScreenshotList::flags(const QModelIndex &index) const
{
return Qt::NoItemFlags;
return Qt::ItemIsSelectable;
}
Task *ScreenshotList::load()
@ -73,7 +69,7 @@ void ScreenshotLoadTask::executeTask()
{
ScreenShot *shot = new ScreenShot();
shot->timestamp = file.left(file.length() - 4);
shot->file = QFile(file).readAll();
shot->file = dir.absoluteFilePath(file);
m_results.append(shot);
}
m_list->loadShots(m_results);

View File

@ -8,9 +8,9 @@ class ScreenShot
{
public:
QString timestamp;
QByteArray file;
int imgurIndex;
QString file;
QString url;
int imgurIndex;
};
class ScreenshotList : public QAbstractListModel