various improvements to import process and project management

This commit is contained in:
itsmattkc
2019-07-01 15:40:09 -07:00
parent 8f6cb7a2cb
commit 0966b62f29
14 changed files with 104 additions and 20 deletions
+3 -1
View File
@@ -20,9 +20,11 @@
#include "folder.h"
#include "ui/icons/icons.h"
Folder::Folder()
{
set_icon(olive::icon::Folder);
}
Item::Type Folder::type() const
+23 -7
View File
@@ -20,9 +20,11 @@
#include "footage.h"
Footage::Footage()
{
#include "ui/icons/icons.h"
Footage::Footage() :
status_(kUnprobed)
{
}
Footage::~Footage()
@@ -30,14 +32,28 @@ Footage::~Footage()
ClearStreams();
}
bool Footage::ready()
const Footage::Status& Footage::status()
{
return ready_;
return status_;
}
void Footage::set_ready(const bool &ready)
void Footage::set_status(const Footage::Status &status)
{
ready_ = ready;
status_ = status;
switch (status_) {
case kUnprobed:
// FIXME Set a waiting icon
set_icon(QIcon());
break;
case kReady:
// FIXME Set a ready icon
set_icon(QIcon());
break;
case kInvalid:
set_icon(olive::icon::Error);
break;
}
}
void Footage::Clear()
@@ -46,7 +62,7 @@ void Footage::Clear()
ClearStreams();
// Reset ready state
set_ready(false);
set_status(kUnprobed);
}
const QString &Footage::filename()
+9 -3
View File
@@ -31,6 +31,12 @@
class Footage : public Item
{
public:
enum Status {
kUnprobed,
kReady,
kInvalid
};
/**
* @brief Footage Constructor
*/
@@ -70,14 +76,14 @@ public:
*
* If the Footage has been successfully probed, this will return TRUE.
*/
bool ready();
const Status& status();
/**
* @brief Set ready state
*
* This should only be set by olive::ProbeMedia. Sets the ready state (see ready()).
*/
void set_ready(const bool& ready);
void set_status(const Status& status);
/**
* @brief Reset Footage state ready for running through Probe() again
@@ -190,7 +196,7 @@ private:
/**
* @brief Internal ready setting
*/
bool ready_;
Status status_;
};
#endif // FOOTAGE_H
+10
View File
@@ -73,6 +73,16 @@ void Item::set_name(const QString &n)
name_ = n;
}
const QIcon &Item::icon()
{
return icon_;
}
void Item::set_icon(const QIcon &icon)
{
icon_ = icon;
}
Item *Item::parent() const
{
return parent_;
+8 -1
View File
@@ -21,8 +21,9 @@
#ifndef ITEM_H
#define ITEM_H
#include <QString>
#include <QIcon>
#include <QList>
#include <QString>
class Item
{
@@ -73,6 +74,9 @@ public:
const QString& name() const;
void set_name(const QString& n);
const QIcon& icon();
void set_icon(const QIcon& icon);
Item *parent() const;
void set_parent(Item *p);
@@ -82,6 +86,9 @@ private:
Item* parent_;
QString name_;
QIcon icon_;
};
#endif // ITEM_H
+16 -4
View File
@@ -122,21 +122,33 @@ int ProjectViewModel::columnCount(const QModelIndex &parent) const
QVariant ProjectViewModel::data(const QModelIndex &index, int role) const
{
if (role == Qt::DisplayRole) {
Item* internal_item = static_cast<Item*>(index.internalPointer());
switch (role) {
case Qt::DisplayRole:
{
// Standard text role
ColumnType column_type = columns_.at(index.column());
switch (column_type) {
case kName:
return static_cast<Item*>(index.internalPointer())->name();
return internal_item->name();
case kDuration:
// FIXME Return actual information
return "00:00:00;00";
case kRate:
// FIXME Return actual information
return "29.97 FPS";
}
}
// TODO Add DecorationRole to column 1 for icons
break;
case Qt::DecorationRole:
// If this is the first column, return the Item's icon
if (index.column() == 0) {
return internal_item->icon();
}
break;
}
return QVariant();
}