# # # add_file "res/forms/nodeinfo.ui" # content [c2766c125292ec98781c1c9521e956fd9193476b] # # add_file "src/view/panels/NodeInfo.cpp" # content [e2798816f4b28773989a7f5ff536a4ae315e9132] # # add_file "src/view/panels/NodeInfo.h" # content [9568daf40a6cad3c88304cf386a3c3dea5128652] # # patch "guitone.pro" # from [e1976f62071aa2a2997a89659b4f2a6dbb529498] # to [b4504e1c8b09451c98c0d97ccda277952dcac220] # # patch "src/model/InventoryItem.cpp" # from [8655d1aa49754ba6086412b51272c7ae348c3d7e] # to [4eeca24b970f4f00a7919338bdef557bd77845ba] # # patch "src/model/InventoryItem.h" # from [f54099a6b7833ec7559ea50cca52b7a5ecdd8bed] # to [3feae8474b4f0c1f7aa260c68af2ab1591c26333] # # patch "src/view/WorkspaceWindow.cpp" # from [ade47c546f628f21ee7457e923e57d4a910370c4] # to [121685050690adafb696a7fcee69e8fdaf879b9e] # # patch "src/view/WorkspaceWindow.h" # from [a463caf3a560c81ada20f1cd3eae8677644018b8] # to [0e579fb5361b3c5cd4a71ce7ef907b903810d182] # ============================================================ --- res/forms/nodeinfo.ui c2766c125292ec98781c1c9521e956fd9193476b +++ res/forms/nodeinfo.ui c2766c125292ec98781c1c9521e956fd9193476b @@ -0,0 +1,176 @@ + + NodeInfo + + + + 0 + 0 + 536 + 242 + + + + Form + + + + + + + + + 0 + 0 + + + + + 64 + 64 + + + + + + + + + + + + + + + %1 + + + + + + + in: %1 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + Status: %1 + + + + + + + + + + + Node Info + + + + + + Old Path: %1 + + + + + + + Qt::Vertical + + + + + + + Recorded Base Type: %1 + + + + + + + New Path: %1 + + + + + + + Recorded New Type: %1 + + + + + + + Added in: %1 + + + + + + + Disk Type: %1 + + + + + + + + + + + + + 0 + 0 + + + + File Size: %1 + + + + + + + + 0 + 0 + + + + Last Modified: %1 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + ============================================================ --- src/view/panels/NodeInfo.cpp e2798816f4b28773989a7f5ff536a4ae315e9132 +++ src/view/panels/NodeInfo.cpp e2798816f4b28773989a7f5ff536a4ae315e9132 @@ -0,0 +1,86 @@ +/*************************************************************************** + * Copyright (C) 2008 by Thomas Keller * + * address@hidden * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +#include "NodeInfo.h" + +#include +#include + +NodeInfo::NodeInfo(QWidget * parent) : QDockWidget(parent) +{ + setVisible(false); + + QWidget * parentWidget = new QWidget(this); + setupUi(parentWidget); + setWidget(parentWidget); + + resetInfo(); + + setWindowTitle(tr("Node info")); + setFloating(true); + setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); +} + +NodeInfo::~NodeInfo() {} + +void NodeInfo::setWorkspacePath(const WorkspacePath & wp) +{ + workspacePath = wp; +} + +void NodeInfo::readAndSetInfo(const InventoryItem * item) +{ + I(item); + I(!workspacePath.isEmpty()); + + QString strFileSize("-"); + QString strFileLastModified("-"); + if (item->getFSType() == InventoryItem::File) + { + QFileInfo fileInfo(workspacePath + "/" + item->getPath()); + I(fileInfo.exists()); + strFileSize = QString("%1Kbytes").arg(fileInfo.size()); + strFileLastModified = fileInfo.lastModified().toString(); + } + + fileName->setText(item->getFilename()); + filePath->setText(tr("in: %1").arg(item->getBaseDirectory())); + fileStatus->setText(tr("Status: %1").arg(item->getStatusString())); + fileOldPath->setText(tr("Old Path: %1").arg(item->getRenameSource())); + fileNewPath->setText(tr("New Path: %1").arg(item->getRenameTarget())); + fileBirthRev->setText(tr("Added in: %1").arg(item->getBirthRevision())); + fileSize->setText(tr("File Size: %1").arg(strFileSize)); + fileBaseType->setText(tr("Recorded Base Type: %1").arg(item->getOldType())); + fileNewType->setText(tr("Recorded New Type: %1").arg(item->getNewType())); + fileLastModified->setText(tr("Last Modified: %1").arg("-")); +} + +void NodeInfo::resetInfo() +{ + fileName->setText("-"); + filePath->setText(tr("in: %1").arg("-")); + fileStatus->setText(tr("Status: %1").arg("-")); + fileOldPath->setText(tr("Old Path: %1").arg("-")); + fileNewPath->setText(tr("New Path: %1").arg("-")); + fileBirthRev->setText(tr("Added in: %1").arg("-")); + fileSize->setText(tr("File Size: %1").arg("-")); + fileBaseType->setText(tr("Recorded Base Type: %1").arg("-")); + fileNewType->setText(tr("Recorded New Type: %1").arg("-")); + fileLastModified->setText(tr("Last Modified: %1").arg("-")); +} + ============================================================ --- src/view/panels/NodeInfo.h 9568daf40a6cad3c88304cf386a3c3dea5128652 +++ src/view/panels/NodeInfo.h 9568daf40a6cad3c88304cf386a3c3dea5128652 @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2008 by Thomas Keller * + * address@hidden * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +#ifndef NODE_INFO_H +#define NODE_INFO_H + +#include "ui_nodeinfo.h" +#include "InventoryItem.h" + +#include + +class NodeInfo : public QDockWidget, private Ui::NodeInfo +{ + Q_OBJECT +public: + NodeInfo(QWidget *); + ~NodeInfo(); + void setWorkspacePath(const WorkspacePath &); + +public slots: + void readAndSetInfo(const InventoryItem *); + void resetInfo(); + +private: + WorkspacePath workspacePath; +}; + +#endif ============================================================ --- guitone.pro e1976f62071aa2a2997a89659b4f2a6dbb529498 +++ guitone.pro b4504e1c8b09451c98c0d97ccda277952dcac220 @@ -58,6 +58,7 @@ HEADERS = src/view/TreeView.h \ src/view/dialogs/AddEditDatabaseVariable.h \ src/view/panels/IconHelp.h \ src/view/panels/DatabaseVariables.h \ + src/view/panels/NodeInfo.h \ src/monotone/FileExporter.h \ src/monotone/WorkspaceCreator.h \ src/monotone/WorkspaceCommitter.h \ @@ -138,6 +139,7 @@ SOURCES += src/view/TreeView.cpp \ src/view/dialogs/AddEditDatabaseVariable.cpp \ src/view/panels/IconHelp.cpp \ src/view/panels/DatabaseVariables.cpp \ + src/view/panels/NodeInfo.cpp \ src/monotone/FileExporter.cpp \ src/monotone/WorkspaceCreator.cpp \ src/monotone/WorkspaceCommitter.cpp \ @@ -202,7 +204,8 @@ FORMS += res/forms/select_revision.ui res/forms/open_prompt.ui \ res/forms/icon_help.ui \ res/forms/db_variables.ui \ - res/forms/add_edit_variables.ui + res/forms/add_edit_variables.ui \ + res/forms/nodeinfo.ui UI_DIR = tmp OBJECTS_DIR = tmp ============================================================ --- src/model/InventoryItem.cpp 8655d1aa49754ba6086412b51272c7ae348c3d7e +++ src/model/InventoryItem.cpp 4eeca24b970f4f00a7919338bdef557bd77845ba @@ -268,6 +268,11 @@ InventoryItem::InventoryItem(const Stanz } continue; } + if (en.sym == "birth") + { + I(!en.hash.isEmpty()); + birthRev = en.hash; + } } // we should have received at least a path, status and fs_type entry @@ -286,6 +291,7 @@ InventoryItem::InventoryItem(const Inven old_type = other->getOldType(); new_type = other->getNewType(); + birthRev = other->getBirthRevision(); status = other->getStatus(); } ============================================================ --- src/model/InventoryItem.h f54099a6b7833ec7559ea50cca52b7a5ecdd8bed +++ src/model/InventoryItem.h 3feae8474b4f0c1f7aa260c68af2ab1591c26333 @@ -83,14 +83,15 @@ public: InventoryItem(const Stanza &); InventoryItem(const InventoryItem *); - inline QString getRenameSource() const { return old_path; } - inline QString getRenameTarget() const { return new_path; } - inline FileType getFSType() const { return fs_type; } - inline FileType getOldType() const { return old_type; } - inline FileType getNewType() const { return new_type; } - inline QString getPath() const { return path; } - inline int getStatus() const { return status; } - inline bool isDirectory() const { return fs_type == Directory || + inline QString getRenameSource() const { return old_path; } + inline QString getRenameTarget() const { return new_path; } + inline FileType getFSType() const { return fs_type; } + inline FileType getOldType() const { return old_type; } + inline FileType getNewType() const { return new_type; } + inline QString getPath() const { return path; } + inline int getStatus() const { return status; } + inline QString getBirthRevision() const { return birthRev; } + inline bool isDirectory() const { return fs_type == Directory || old_type == Directory || new_type == Directory; } @@ -142,6 +143,8 @@ private: FileType old_type; FileType new_type; + QString birthRev; + int status; bool expanded; bool aboutToBeExpanded; ============================================================ --- src/view/WorkspaceWindow.cpp ade47c546f628f21ee7457e923e57d4a910370c4 +++ src/view/WorkspaceWindow.cpp 121685050690adafb696a7fcee69e8fdaf879b9e @@ -27,8 +27,8 @@ WorkspaceWindow::WorkspaceWindow() : Dat #include "WorkspaceDialogManager.h" WorkspaceWindow::WorkspaceWindow() : DatabaseWindow(), mainSplitter(0), - listSplitter(0), treeView(0), listView(0), attrView(0), statusBar(0), - iconHelp(0), invModel(0), attrModel(0), proxyModelFolderTree(0), + listSplitter(0), itemTabber(0), treeView(0), listView(0), attrView(0), + statusBar(0), iconHelp(0), invModel(0), attrModel(0), proxyModelFolderTree(0), proxyModelFileList(0), invWatcher(0) { setObjectName("WorkspaceWindow"); @@ -44,6 +44,7 @@ WorkspaceWindow::~WorkspaceWindow() if (treeView) delete treeView; if (listView) delete listView; if (attrView) delete attrView; + if (itemTabber) delete itemTabber; if (listSplitter) delete listSplitter; if (mainSplitter) delete mainSplitter; if (statusBar) delete statusBar; @@ -110,6 +111,9 @@ void WorkspaceWindow::setup() listView->setEditTriggers(QAbstractItemView::EditKeyPressed); listView->setSelectionMode(QAbstractItemView::ExtendedSelection); + itemTabber = new QTabWidget(listSplitter); + //itemTabber->setTabPosition(QTabWidget::South); + attrView = new AttributesView(listSplitter, "AttributesView"); attrView->setAlternatingRowColors(true); @@ -178,8 +182,9 @@ void WorkspaceWindow::setup() treeView, SLOT(expandAllNodes(bool)) ); + itemTabber->addTab(attrView, tr("Attributes")); listSplitter->addWidget(listView); - listSplitter->addWidget(attrView); + listSplitter->addWidget(itemTabber); mainSplitter->addWidget(treeView); mainSplitter->addWidget(listSplitter); @@ -272,6 +277,12 @@ void WorkspaceWindow::setup() dynamic_cast(menuBar) ->addDockWidgetAction(iconHelp->toggleViewAction()); + + nodeInfo = new NodeInfo(this); + + dynamic_cast(menuBar) + ->addDockWidgetAction(nodeInfo->toggleViewAction()); + } void WorkspaceWindow::load(const QString & path) @@ -291,6 +302,7 @@ void WorkspaceWindow::load(const QString invModel->setWorkspacePath(workspacePath); invWatcher->setWorkspacePath(workspacePath); attrModel->setWorkspacePath(workspacePath); + nodeInfo->setWorkspacePath(workspacePath); // read the inventory invModel->refresh(); ============================================================ --- src/view/WorkspaceWindow.h a463caf3a560c81ada20f1cd3eae8677644018b8 +++ src/view/WorkspaceWindow.h 0e579fb5361b3c5cd4a71ce7ef907b903810d182 @@ -30,8 +30,10 @@ #include "AttributesView.h" #include "Splitter.h" #include "IconHelp.h" +#include "NodeInfo.h" #include +#include class WorkspaceWindow: public DatabaseWindow { @@ -50,11 +52,13 @@ protected: Splitter * mainSplitter; Splitter * listSplitter; + QTabWidget * itemTabber; InventoryView * treeView; InventoryView * listView; AttributesView * attrView; QStatusBar * statusBar; IconHelp * iconHelp; + NodeInfo * nodeInfo; InventoryModel * invModel; GetAttributes * attrModel;