#
#
# patch "res/i18n/guitone_de.ts"
# from [55a48b4908e326e9351e91f91a9b4e6c96886abb]
# to [28df3a8930a831bd29eacda9ad0bbc50f63b29b0]
#
# patch "src/model/Inventory.cpp"
# from [6395dc12854496612343450d0583d2ced674774f]
# to [f3b42c78c986862bcbd557789a815aaf197b3027]
#
# patch "src/model/InventoryItem.cpp"
# from [7ead79fdb2fd3c8af68e11744d67ceba834d001e]
# to [f027da1cc5b1a8b7e287a418328e4419aca1518c]
#
# patch "src/model/InventoryItem.h"
# from [f65c9e6a2f1d7469365ce83bd13fb12e001fa0c6]
# to [e7dca303a32e11ca9023fcdb2b2ea747d889b9e9]
#
============================================================
--- res/i18n/guitone_de.ts 55a48b4908e326e9351e91f91a9b4e6c96886abb
+++ res/i18n/guitone_de.ts 28df3a8930a831bd29eacda9ad0bbc50f63b29b0
@@ -199,6 +199,13 @@
+ Inventory
+
+ one level up
+ ein Verzeichnis höher
+
+
+
InventoryItem
File
@@ -210,7 +217,7 @@
one level up
- ein Verzeichnis höher
+ ein Verzeichnis höher
Rename Source
============================================================
--- src/model/Inventory.cpp 6395dc12854496612343450d0583d2ced674774f
+++ src/model/Inventory.cpp f3b42c78c986862bcbd557789a815aaf197b3027
@@ -156,6 +156,7 @@ void Inventory::parseOutput(AutomateComm
// FIXME: we shouldn't really add a workspace root item here, but
// mtn automate inventory currently doesn't print the root workspace dir
InventoryItem* workspace = new InventoryItem(rootItem, ".", 0, true);
+ workspace->setLabel(workspaceDir->path());
rootItem->appendChild(workspace);
workspace->setChildren(buildTreeRecursive(tempItems, NULL));
@@ -175,7 +176,6 @@ QList Inventory::buildTr
{
QList finalItems;
- InventoryItem *currentItem;
QString parentPath = "";
int parentStatus = 0;
@@ -186,8 +186,16 @@ QList Inventory::buildTr
}
// add pseudo item "cd up" for each directory
- items.prepend(new InventoryItem(parentItem, parentPath+QString("/.."), parentStatus, true));
+ InventoryItem *cdUp = new InventoryItem(
+ parentItem,
+ parentPath + QString("/.."),
+ parentStatus,
+ true
+ );
+ cdUp->setLabel(tr("one level up"));
+ items.prepend(cdUp);
+ InventoryItem *currentItem;
while (items.size() > 0)
{
currentItem = items.front();
============================================================
--- src/model/InventoryItem.cpp 7ead79fdb2fd3c8af68e11744d67ceba834d001e
+++ src/model/InventoryItem.cpp f027da1cc5b1a8b7e287a418328e4419aca1518c
@@ -34,6 +34,7 @@ InventoryItem::InventoryItem()
{
parentItem = this;
path = "";
+ label = "";
status = 0;
dirFlag = false;
childDirFlag = false;
@@ -55,6 +56,18 @@ InventoryItem::~InventoryItem()
qDeleteAll(children);
}
+
+void InventoryItem::setLabel(const QString & l)
+{
+ label = l;
+}
+
+QString InventoryItem::getLabel() const
+{
+ if (label.size() > 0) return label;
+ return getFilename();
+}
+
void InventoryItem::deleteAllChildren(void)
{
parentItem = this;
@@ -162,20 +175,10 @@ QVariant InventoryItem::data(int column,
}
}
- if (this->isCdUp())
- {
- switch (column)
- {
- case 0: return QVariant(tr("one level up"));
- case 1: return QVariant();
- default: return QVariant();
- }
- }
-
- switch (column)
+ switch (column)
{
- case 0: return QVariant(getFilename());
- case 1: return QVariant(statusString());
+ case 0: return QVariant(getLabel());
+ case 1: return QVariant(getStatusString());
default: return QVariant();
}
}
@@ -192,9 +195,16 @@ QString InventoryItem::getFilename() con
QString InventoryItem::getFilename() const
{
int pos = path.lastIndexOf('/');
- return pos == -1 ? path : path.right(path.length() - pos - 1);
+ return pos == -1 ? path : path.right(path.length() - pos - 1);
}
+QString InventoryItem::getRelativePath(const QString & part) const
+{
+ int partLen = part.length();
+ Q_ASSERT(path.left(partLen).compare(part) == 0);
+ return path.right(path.length() - partLen);
+}
+
bool InventoryItem::hasStatus(int statusBits) const
{
return (status & statusBits) == statusBits;
@@ -205,8 +215,11 @@ bool InventoryItem::hasNotStatus(int sta
return (status & statusBits) == 0;
}
-QString InventoryItem::statusString() const
+QString InventoryItem::getStatusString() const
{
+ // do not return the status for
+ if (isCdUp()) return "";
+
QStringList list;
if (this->hasStatus(InventoryItem::RenamedFrom))
============================================================
--- src/model/InventoryItem.h f65c9e6a2f1d7469365ce83bd13fb12e001fa0c6
+++ src/model/InventoryItem.h e7dca303a32e11ca9023fcdb2b2ea747d889b9e9
@@ -41,13 +41,17 @@ class InventoryItem : public QObject
void setChildren(QList);
inline QList getChildren(void) const { return children; };
inline QString getPath(void) const { return path; };
+ QString getRelativePath(const QString&) const;
QString getFilename(void) const;
inline bool isCdUp() const { return getFilename() == ".."; };
inline bool isTracked() const { return hasNotStatus(Ignored | Unknown); };
+ void setLabel(const QString &);
+ QString getLabel() const;
+
bool hasStatus(int) const;
bool hasNotStatus(int) const;
- QString statusString(void) const;
+ QString getStatusString(void) const;
inline bool isDirectory(void) const { return dirFlag; };
inline bool isRootDirectory(void) const { return rootFlag; };
inline bool hasChildDirs(void) const { return childDirFlag; };
@@ -82,6 +86,7 @@ class InventoryItem : public QObject
bool childDirFlag;
bool rootFlag;
QString path;
+ QString label;
};
#endif