Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 165ac92

Browse files
committed
added "copy filename" context entry
1 parent 765b86c commit 165ac92

18 files changed

+109
-0
lines changed

src/rammanagerwidgets/itemmanagerwidget.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,10 @@ void ItemManagerWidget::setupUi()
903903

904904
ui_contextMenu->addSeparator();
905905

906+
ui_actionCopyFileName = new QAction(tr("Copy file name"));
907+
ui_actionCopyFileName->setIcon(QIcon(":/icons/filename"));
908+
ui_contextMenu->addAction(ui_actionCopyFileName);
909+
906910
ui_actionCopyPath = new QAction(tr("Copy folder path"));
907911
ui_actionCopyPath->setIcon(QIcon(":/icons/path"));
908912
ui_contextMenu->addAction(ui_actionCopyPath);
@@ -967,6 +971,7 @@ void ItemManagerWidget::connectEvents()
967971
connect(ui_cutComment, SIGNAL(triggered()), this, SLOT(cutComment()));
968972
connect(ui_pasteComment, SIGNAL(triggered()), this, SLOT(pasteComment()));
969973
// other context menu
974+
connect(ui_actionCopyFileName, SIGNAL(triggered()), ui_table, SLOT(copyFileName()));
970975
connect(ui_actionCopyPath, SIGNAL(triggered()), ui_table, SLOT(copyPath()));
971976
connect(ui_actionCopyUuid, SIGNAL(triggered()), ui_table, SLOT(copyUuid()));
972977
// search

src/rammanagerwidgets/itemmanagerwidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ private slots:
161161
RamObjectMenu *ui_changeStateContextMenu;
162162
QAction *ui_actionCopyUuid;
163163
QAction *ui_actionCopyPath;
164+
QAction *ui_actionCopyFileName;
164165

165166
RamProject *m_project = nullptr;
166167
RamStep::Type m_productionType;

src/ramobjects/ramabstractobject.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ QVariant RamAbstractObject::roleData(int role) const
401401
case RamAbstractObject::Difficulty: return 0;
402402
case RamAbstractObject::Duration: return 0;
403403
case RamAbstractObject::Order: return order();
404+
case RamAbstractObject::FileName: return fileName();
404405
}
405406

406407
return this->uuid();
@@ -460,6 +461,11 @@ QString RamAbstractObject::path(SubFolder subFolder, QString subPath, bool creat
460461
return QDir::cleanPath(p);
461462
}
462463

464+
QString RamAbstractObject::fileName() const
465+
{
466+
return "";
467+
}
468+
463469
QStringList RamAbstractObject::listFiles(RamObject::SubFolder subFolder, QString subPath) const
464470
{
465471
QDir dir( path(subFolder) + "/" + subPath);

src/ramobjects/ramabstractobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class RamAbstractObject
4242
Duration = Qt::UserRole+24,
4343
Pointer = Qt::UserRole+25,
4444
Order = Qt::UserRole+26,
45+
FileName = Qt::UserRole+27,
4546
};
4647
/**
4748
* @brief The ObjectType enum lists all types of RamObjects
@@ -239,6 +240,7 @@ class RamAbstractObject
239240

240241
QString path(SubFolder subFolder = NoFolder, bool create = false) const;
241242
QString path(SubFolder subFolder, QString subPath, bool create = false) const;
243+
virtual QString fileName() const;
242244
QStringList listFiles(SubFolder subFolder = NoFolder, QString subPath = "") const;
243245
QFileInfoList listFileInfos(SubFolder subFolder = NoFolder, QString subPath = "") const;
244246
QStringList listFolders(SubFolder subFolder = NoFolder) const;

src/ramobjects/ramasset.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ bool RamAsset::hasTag(QString tag)
117117
return arr.contains(tag);
118118
}
119119

120+
QString RamAsset::fileName() const
121+
{
122+
RamProject *proj = this->project();
123+
if (!proj) return RamAbstractObject::fileName();
124+
return proj->shortName() + "_A_" + this->shortName();
125+
}
126+
120127
QString RamAsset::filterUuid() const
121128
{
122129
return getData("assetGroup").toString();

src/ramobjects/ramasset.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class RamAsset : public RamAbstractItem
3131
void removeTag(QString tag);
3232
bool hasTag(QString tag);
3333

34+
virtual QString fileName() const override;
35+
3436
QString filterUuid() const override;
3537

3638
virtual QString details() const override;

src/ramobjects/ramproject.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,11 @@ QStringList RamProject::filterListUuids() const
459459
return userUuids;
460460
}
461461

462+
QString RamProject::fileName() const
463+
{
464+
return this->shortName() + "_";
465+
}
466+
462467
// PUBLIC SLOTS //
463468

464469
void RamProject::updatePath()

src/ramobjects/ramproject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ class RamProject : public RamObject
112112

113113
virtual QStringList filterListUuids() const override;
114114

115+
virtual QString fileName() const override;
116+
115117
signals:
116118
void completionRatioChanged(int);
117119
void latenessRatioChanged(float);

src/ramobjects/ramshot.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ QVariant RamShot::roleData(int role) const
134134
return RamObject::roleData(role);
135135
}
136136

137+
QString RamShot::fileName() const
138+
{
139+
RamProject *proj = this->project();
140+
if (!proj) return RamAbstractObject::fileName();
141+
return proj->shortName() + "_S_" + this->shortName();
142+
}
143+
137144
// PUBLIC SLOTS //
138145

139146
void RamShot::edit(bool show)

src/ramobjects/ramshot.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class RamShot : public RamAbstractItem
4141

4242
virtual QVariant roleData(int role) const override;
4343

44+
virtual QString fileName() const override;
45+
4446
public slots:
4547
virtual void edit(bool show = true) override;
4648

0 commit comments

Comments
 (0)