Reorganize all the screenshot files
This commit is contained in:
@ -5,12 +5,12 @@
|
||||
#include <QJsonObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include "logic/lists/ScreenshotList.h"
|
||||
#include "URLConstants.h"
|
||||
#include "logic/screenshots//ScreenshotList.h"
|
||||
#include "logic/net/URLConstants.h"
|
||||
#include "MultiMC.h"
|
||||
#include "logger/QsLog.h"
|
||||
|
||||
ImgurAlbumCreation::ImgurAlbumCreation(QList<ScreenShot *> screenshots) : NetAction(), m_screenshots(screenshots)
|
||||
ImgurAlbumCreation::ImgurAlbumCreation(QList<ScreenshotPtr> screenshots) : NetAction(), m_screenshots(screenshots)
|
||||
{
|
||||
m_url = URLConstants::IMGUR_BASE_URL + "album.json";
|
||||
m_status = Job_NotStarted;
|
@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
#include "NetAction.h"
|
||||
#include "logic/net/NetAction.h"
|
||||
#include "Screenshot.h"
|
||||
|
||||
class ScreenShot;
|
||||
typedef std::shared_ptr<class ImgurAlbumCreation> ImgurAlbumCreationPtr;
|
||||
class ImgurAlbumCreation : public NetAction
|
||||
{
|
||||
public:
|
||||
explicit ImgurAlbumCreation(QList<ScreenShot *> screenshots);
|
||||
static ImgurAlbumCreationPtr make(QList<ScreenShot *> screenshots)
|
||||
explicit ImgurAlbumCreation(QList<ScreenshotPtr> screenshots);
|
||||
static ImgurAlbumCreationPtr make(QList<ScreenshotPtr> screenshots)
|
||||
{
|
||||
return ImgurAlbumCreationPtr(new ImgurAlbumCreation(screenshots));
|
||||
}
|
||||
@ -35,7 +35,7 @@ slots:
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
QList<ScreenShot *> m_screenshots;
|
||||
QList<ScreenshotPtr> m_screenshots;
|
||||
|
||||
QString m_deleteHash;
|
||||
QString m_id;
|
@ -8,12 +8,12 @@
|
||||
#include <QFile>
|
||||
#include <QUrl>
|
||||
|
||||
#include "logic/lists/ScreenshotList.h"
|
||||
#include "URLConstants.h"
|
||||
#include "logic/screenshots/ScreenshotList.h"
|
||||
#include "logic/net/URLConstants.h"
|
||||
#include "MultiMC.h"
|
||||
#include "logger/QsLog.h"
|
||||
|
||||
ImgurUpload::ImgurUpload(ScreenShot *shot) : NetAction(), m_shot(shot)
|
||||
ImgurUpload::ImgurUpload(ScreenshotPtr shot) : NetAction(), m_shot(shot)
|
||||
{
|
||||
m_url = URLConstants::IMGUR_BASE_URL + "upload.json";
|
||||
m_status = Job_NotStarted;
|
@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
#include "NetAction.h"
|
||||
#include "logic/net/NetAction.h"
|
||||
#include "Screenshot.h"
|
||||
|
||||
class ScreenShot;
|
||||
typedef std::shared_ptr<class ImgurUpload> ImgurUploadPtr;
|
||||
class ImgurUpload : public NetAction
|
||||
{
|
||||
public:
|
||||
explicit ImgurUpload(ScreenShot *shot);
|
||||
static ImgurUploadPtr make(ScreenShot *shot)
|
||||
explicit ImgurUpload(ScreenshotPtr shot);
|
||||
static ImgurUploadPtr make(ScreenshotPtr shot)
|
||||
{
|
||||
return ImgurUploadPtr(new ImgurUpload(shot));
|
||||
}
|
||||
@ -26,5 +26,5 @@ slots:
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
ScreenShot *m_shot;
|
||||
ScreenshotPtr m_shot;
|
||||
};
|
15
logic/screenshots/Screenshot.h
Normal file
15
logic/screenshots/Screenshot.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <memory>
|
||||
|
||||
struct ScreenShot
|
||||
{
|
||||
QDateTime timestamp;
|
||||
QString file;
|
||||
QString url;
|
||||
QString imgurId;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<ScreenShot> ScreenshotPtr;
|
@ -69,13 +69,13 @@ void ScreenshotLoadTask::executeTask()
|
||||
return;
|
||||
}
|
||||
dir.setNameFilters(QStringList() << "*.png");
|
||||
this->m_results = QList<ScreenShot *>();
|
||||
this->m_results.clear();
|
||||
for (auto file : dir.entryList())
|
||||
{
|
||||
ScreenShot *shot = new ScreenShot();
|
||||
shot->timestamp = QDateTime::fromString(file, "yyyy-MM-dd_HH.mm.ss.png");
|
||||
shot->file = dir.absoluteFilePath(file);
|
||||
m_results.append(shot);
|
||||
m_results.append(ScreenshotPtr(shot));
|
||||
}
|
||||
m_list->loadShots(m_results);
|
||||
emitSucceeded();
|
||||
@ -91,7 +91,7 @@ void ScreenshotList::deleteSelected(ScreenshotDialog *dialog)
|
||||
QList<std::shared_ptr<ScreenShot>>::const_iterator it;
|
||||
for (it = screens.cbegin(); it != screens.cend(); it++)
|
||||
{
|
||||
std::shared_ptr<ScreenShot> = *it;
|
||||
auto shot = *it;
|
||||
if (!QFile(shot->file).remove())
|
||||
{
|
||||
CustomMessageBox::selectable(dialog, tr("Error!"),
|
@ -4,14 +4,7 @@
|
||||
#include "logic/BaseInstance.h"
|
||||
#include "logic/tasks/Task.h"
|
||||
|
||||
class ScreenShot
|
||||
{
|
||||
public:
|
||||
QDateTime timestamp;
|
||||
QString file;
|
||||
QString url;
|
||||
QString imgurId;
|
||||
};
|
||||
#include "Screenshot.h"
|
||||
|
||||
class ScreenshotList : public QAbstractListModel
|
||||
{
|
||||
@ -28,12 +21,12 @@ public:
|
||||
|
||||
Task *load();
|
||||
|
||||
void loadShots(QList<ScreenShot *> shots)
|
||||
void loadShots(QList<ScreenshotPtr> shots)
|
||||
{
|
||||
m_screenshots = shots;
|
||||
}
|
||||
|
||||
QList<ScreenShot *> screenshots() const
|
||||
QList<ScreenshotPtr> screenshots() const
|
||||
{
|
||||
return m_screenshots;
|
||||
}
|
||||
@ -51,7 +44,7 @@ public
|
||||
slots:
|
||||
|
||||
private:
|
||||
QList<ScreenShot *> m_screenshots;
|
||||
QList<ScreenshotPtr> m_screenshots;
|
||||
BaseInstance *m_instance;
|
||||
};
|
||||
|
||||
@ -63,7 +56,7 @@ public:
|
||||
explicit ScreenshotLoadTask(ScreenshotList *list);
|
||||
~ScreenshotLoadTask();
|
||||
|
||||
QList<ScreenShot *> screenShots() const
|
||||
QList<ScreenshotPtr> screenShots() const
|
||||
{
|
||||
return m_results;
|
||||
}
|
||||
@ -73,5 +66,5 @@ protected:
|
||||
|
||||
private:
|
||||
ScreenshotList *m_list;
|
||||
QList<ScreenShot *> m_results;
|
||||
QList<ScreenshotPtr> m_results;
|
||||
};
|
Reference in New Issue
Block a user