# # # patch "NEWS" # from [090be857a0a7d1aa94b9578da0bbca8d80843024] # to [f5a241b516d0b4b08f480d728fe6ca358e8ad859] # # patch "res/forms/nodeinfo.ui" # from [c2766c125292ec98781c1c9521e956fd9193476b] # to [b4d5c81b4c49819097fd46bc7e84e24cdff03753] # # patch "res/forms/select_revision.ui" # from [03e8e5245a8259df4d0e43880ce006638c79da0a] # to [cf30007ed49402f892ed011ef71659126c44febb] # # patch "src/model/InventoryItem.cpp" # from [4eeca24b970f4f00a7919338bdef557bd77845ba] # to [c9df0dc20579742325d9ecff27ef0cbaf00a42ec] # # patch "src/model/InventoryItem.h" # from [3feae8474b4f0c1f7aa260c68af2ab1591c26333] # to [0d5f6eaa88eabf56459ed348fc653e2ac08b802c] # # patch "src/model/InventoryModel.cpp" # from [028ac6e66b46adf8c754ce35f4ad01be36019c70] # to [d957fdce854d8b0b59565817d5dc14d5bb390be9] # # patch "src/view/WorkspaceWindow.cpp" # from [121685050690adafb696a7fcee69e8fdaf879b9e] # to [8fc4a170d11e051a165b0118859d550c3f0509df] # # patch "src/view/WorkspaceWindow.h" # from [0e579fb5361b3c5cd4a71ce7ef907b903810d182] # to [99c36a0a442928d9c0653e3fe12fc0d4fef92de7] # # patch "src/view/dialogs/SelectRevision.cpp" # from [59edae38fa0c050495462308b2c279224a7f9357] # to [25d263e20ee95bc907a0aff23e9909a207396f35] # # patch "src/view/dialogs/SelectRevision.h" # from [b9d7c86fcc38c8e035a24a251d6cc922ae7a717e] # to [7b0eb080172fc538ab62dfd6328914f3e584dae8] # # patch "src/view/panels/NodeInfo.cpp" # from [e2798816f4b28773989a7f5ff536a4ae315e9132] # to [b97b0450019a459b36291b038217461d85b0607b] # # patch "src/view/panels/NodeInfo.h" # from [9568daf40a6cad3c88304cf386a3c3dea5128652] # to [ad838bffdec60eb1afdef99a1de88e753fb38505] # ============================================================ --- NEWS 090be857a0a7d1aa94b9578da0bbca8d80843024 +++ NEWS f5a241b516d0b4b08f480d728fe6ca358e8ad859 @@ -1,10 +1,15 @@ ????-??-?? (0.9) + - new: panel to inspect an selected workspace item - shows several mtn and + fs-specific data on the item and links to the birth revision of the node, + if any - new: possibility to select the file encoding of a file in the diff dialog; the preference can be saved to the special file attribute "guitone:file-encoding" which is read out next time you diff the file. Note that you need a checked-out workspace for this; if you diff a not-checked-out file, the attribute must already be present in the manifest of the base revision and an encoding change cannot be saved there. + - improved: UI of select revision dialog slightly revamped, now by default the + first found revision is automatically selected and queried for certs - bugfix: if you change the selection of items in the workspace view the attribute view should now get properly updated properly under all circumstances ============================================================ --- res/forms/nodeinfo.ui c2766c125292ec98781c1c9521e956fd9193476b +++ res/forms/nodeinfo.ui b4d5c81b4c49819097fd46bc7e84e24cdff03753 @@ -5,170 +5,174 @@ 0 0 - 536 - 242 + 161 + 405 + + + 0 + 0 + + Form - - - - - - 0 - 0 - - - - - 64 - 64 - - - - - - - - - - - - - - - %1 - - - - - - - in: %1 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Status: %1 - - - - - - - - - - - Node Info + + + QFrame::Panel - - - + + QFrame::Sunken + + + + + + + + + 0 + 0 + + + + + 64 + 64 + + + + + 64 + 64 + + + + + + + + + + + %1 + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + - Old Path: %1 + Status: %1 - - + + - Qt::Vertical + Qt::Horizontal - - + + - Recorded Base Type: %1 + Added in: %1 - - + + + + + 0 + 0 + + - New Path: %1 + Last Modified: %1 - - + + + + Qt::Horizontal + + + + + - Recorded New Type: %1 + Current Path: %1 - - + + - Added in: %1 + Old Path: %1 - + + + + New Path: %1 + + + + + + + Qt::Horizontal + + + + Disk Type: %1 + + + + Old Type: %1 + + + + + + + New Type: %1 + + + - - - - - - - 0 - 0 - - - - File Size: %1 - - - - - - - - 0 - 0 - - - - Last Modified: %1 - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - ============================================================ --- res/forms/select_revision.ui 03e8e5245a8259df4d0e43880ce006638c79da0a +++ res/forms/select_revision.ui cf30007ed49402f892ed011ef71659126c44febb @@ -5,170 +5,140 @@ 0 0 - 558 - 364 + 644 + 417 Select Revision - :/icons/guitone.png + + :/icons/guitone.png:/icons/guitone.png - + - + - + + + + + + contains + + + selectorValue + + + + + + + + + + Find + + + + + + + + + Qt::Vertical + + + - - - - - - contains + + + false - - selectorValue + + false - - - - - - Find - - - - - - - - - Qt::Vertical - - - + - - + + false - + + Select as first revision + + + + + + false + + Select as second revision + - - - - - false - - - Select as first revision - - - - - - - false - - - Select as second revision - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - Show differences - - - - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + false + + + Show differences + + + - - - - true - - - QAbstractItemView::NoSelection - - - QAbstractItemView::ScrollPerPixel - - - 10 - - - false - - - false - - - - - - - - - - Qt::Horizontal - - - - 131 - 31 - - - - - - - Cancel - - - - - - - OK - - - true - - - - - + + + + true + + + QAbstractItemView::NoSelection + + + QAbstractItemView::ScrollPerPixel + + + 10 + + + false + + + false + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + @@ -188,58 +158,56 @@ selectorBox selectorValue searchRevsBtn - okButton - cancelButton - okButton - clicked() - SelectRevision - accept() + selectorValue + returnPressed() + searchRevsBtn + click() - 544 - 344 + 281 + 27 - 96 - 254 + 631 + 35 - cancelButton - clicked() + buttonBox + accepted() SelectRevision - reject() + accept() - 463 - 344 + 502 + 391 - 179 - 282 + 637 + 334 - selectorValue - returnPressed() - searchRevsBtn - click() + buttonBox + rejected() + SelectRevision + reject() - 281 - 27 + 588 + 389 - 503 - 22 + 638 + 361 ============================================================ --- src/model/InventoryItem.cpp 4eeca24b970f4f00a7919338bdef557bd77845ba +++ src/model/InventoryItem.cpp c9df0dc20579742325d9ecff27ef0cbaf00a42ec @@ -123,7 +123,6 @@ QVariant ModelItem::data(int column, int { case 0: return QVariant(QString(tr("File"))); case 1: return QVariant(QString(tr("Status"))); - case 2: return QVariant(QString(tr("Additional info"))); default: return QVariant(); } } @@ -161,6 +160,17 @@ const int InventoryItem::AttributesChang const int InventoryItem::ContentsChanged = 512; const int InventoryItem::AttributesChanged = 1024; +QString InventoryItem::translateFileType(const FileType & t) +{ + switch (t) + { + case File: return tr("File"); + case Directory: return tr("Directory"); + case None: return tr("None"); + default: return "-"; + } +} + InventoryItem::InventoryItem(const Stanza & stanza) : ModelItem(), fs_type(Undefined), old_type(Undefined), new_type(Undefined), status(0), expanded(false), aboutToBeExpanded(false) @@ -303,7 +313,6 @@ QVariant InventoryItem::data(int column, { case 0: return QVariant(getLabel()); case 1: return QVariant(getStatusString()); - case 2: return QVariant(getRenameInfo()); default: return QVariant(); } } @@ -500,21 +509,6 @@ QString InventoryItem::getStatusString() return list.join(", "); } -QString InventoryItem::getRenameInfo() const -{ - QStringList strings; - if (hasStatus(RenameSource)) - { - strings << tr("new name: %1").arg(new_path); - } - - if (hasStatus(RenameTarget)) - { - strings << tr("old name: %1").arg(old_path); - } - return strings.join(", "); -} - void InventoryItem::setExpanded() { expanded = true; ============================================================ --- src/model/InventoryItem.h 3feae8474b4f0c1f7aa260c68af2ab1591c26333 +++ src/model/InventoryItem.h 0d5f6eaa88eabf56459ed348fc653e2ac08b802c @@ -79,6 +79,7 @@ public: // default for nodes which are not tracked by mtn, thus have no old_node // and no new_node stanza enum FileType { Undefined = 1, File, Directory, None }; + static QString translateFileType(const FileType &); InventoryItem(const Stanza &); InventoryItem(const InventoryItem *); ============================================================ --- src/model/InventoryModel.cpp 028ac6e66b46adf8c754ce35f4ad01be36019c70 +++ src/model/InventoryModel.cpp d957fdce854d8b0b59565817d5dc14d5bb390be9 @@ -167,7 +167,7 @@ void InventoryModel::maybeResetModel(con emit dataChanged( index(workspaceRootRow, 0, QModelIndex()), - index(workspaceRootRow, 2, QModelIndex()) + index(workspaceRootRow, 1, QModelIndex()) ); } } @@ -208,7 +208,7 @@ int InventoryModel::columnCount(const QM int InventoryModel::columnCount(const QModelIndex & parent) const { Q_UNUSED(parent); - return 3; + return 2; } QVariant InventoryModel::data(const QModelIndex & index, int role) const ============================================================ --- src/view/WorkspaceWindow.cpp 121685050690adafb696a7fcee69e8fdaf879b9e +++ src/view/WorkspaceWindow.cpp 8fc4a170d11e051a165b0118859d550c3f0509df @@ -27,8 +27,8 @@ WorkspaceWindow::WorkspaceWindow() : Dat #include "WorkspaceDialogManager.h" WorkspaceWindow::WorkspaceWindow() : DatabaseWindow(), mainSplitter(0), - listSplitter(0), itemTabber(0), treeView(0), listView(0), attrView(0), - statusBar(0), iconHelp(0), invModel(0), attrModel(0), proxyModelFolderTree(0), + listSplitter(0), treeView(0), listView(0), attrView(0), statusBar(0), + iconHelp(0), invModel(0), attrModel(0), proxyModelFolderTree(0), proxyModelFileList(0), invWatcher(0) { setObjectName("WorkspaceWindow"); @@ -44,7 +44,6 @@ 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; @@ -111,19 +110,16 @@ 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); connect( treeView, SIGNAL(selectedRows(const QModelIndexList &)), - this, SLOT(maybeReadAttributes(const QModelIndexList &)) + this, SLOT(maybeReadNodeInfo(const QModelIndexList &)) ); connect( listView, SIGNAL(selectedRows(const QModelIndexList &)), - this, SLOT(maybeReadAttributes(const QModelIndexList &)) + this, SLOT(maybeReadNodeInfo(const QModelIndexList &)) ); connect( @@ -182,9 +178,8 @@ void WorkspaceWindow::setup() treeView, SLOT(expandAllNodes(bool)) ); - itemTabber->addTab(attrView, tr("Attributes")); listSplitter->addWidget(listView); - listSplitter->addWidget(itemTabber); + listSplitter->addWidget(attrView); mainSplitter->addWidget(treeView); mainSplitter->addWidget(listSplitter); @@ -274,15 +269,19 @@ void WorkspaceWindow::setup() attrView->setModel(attrModel); iconHelp = new IconHelp(this); - + iconHelp->toggleViewAction()->setShortcut(QKeySequence(tr("Shift+F1"))); dynamic_cast(menuBar) ->addDockWidgetAction(iconHelp->toggleViewAction()); nodeInfo = new NodeInfo(this); - + nodeInfo->toggleViewAction()->setShortcut(QKeySequence(tr("Ctrl+I"))); dynamic_cast(menuBar) ->addDockWidgetAction(nodeInfo->toggleViewAction()); + connect( + nodeInfo, SIGNAL(showSelectRevision(const QString &)), + dialogManager, SLOT(showSelectRevision(const QString &)) + ); } void WorkspaceWindow::load(const QString & path) @@ -313,12 +312,14 @@ void WorkspaceWindow::openFile(const QSt Platform::openFile(workspacePath + "/" + filePath); } -void WorkspaceWindow::maybeReadAttributes(const QModelIndexList & indexes) +void WorkspaceWindow::maybeReadNodeInfo(const QModelIndexList & indexes) { + attrModel->revert(); + nodeInfo->resetInfo(); + if (indexes.size() != 1) { D("multiple or no items selected"); - attrModel->revert(); return; } @@ -332,14 +333,14 @@ void WorkspaceWindow::maybeReadAttribute if (!invitem) { D("selected item is not inventory item"); - attrModel->revert(); return; } + nodeInfo->readAndSetInfo(invitem); + if (invitem->isOldNode() || !invitem->isTracked()) { D("selected item is old node or not tracked"); - attrModel->revert(); return; } ============================================================ --- src/view/WorkspaceWindow.h 0e579fb5361b3c5cd4a71ce7ef907b903810d182 +++ src/view/WorkspaceWindow.h 99c36a0a442928d9c0653e3fe12fc0d4fef92de7 @@ -33,7 +33,6 @@ #include "NodeInfo.h" #include -#include class WorkspaceWindow: public DatabaseWindow { @@ -52,7 +51,6 @@ protected: Splitter * mainSplitter; Splitter * listSplitter; - QTabWidget * itemTabber; InventoryView * treeView; InventoryView * listView; AttributesView * attrView; @@ -67,7 +65,7 @@ private slots: InventoryWatcher * invWatcher; private slots: - void maybeReadAttributes(const QModelIndexList &); + void maybeReadNodeInfo(const QModelIndexList &); void invalidWorkspaceFormat(const QString &); void openFile(const QString &); }; ============================================================ --- src/view/dialogs/SelectRevision.cpp 59edae38fa0c050495462308b2c279224a7f9357 +++ src/view/dialogs/SelectRevision.cpp 25d263e20ee95bc907a0aff23e9909a207396f35 @@ -50,6 +50,11 @@ SelectRevision::SelectRevision(QWidget * // toposort revisions sortModel->setSourceModel(selectorModel); + connect( + sortModel, SIGNAL(sortingFinished()), + this, SLOT(trySelectFirstRow()) + ); + // set initial completer setCompleter(0); @@ -125,7 +130,7 @@ SelectRevision::SelectRevision(QWidget * ); // disable the OK button unless we have a valid selected revision - okButton->setEnabled(false); + buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); } SelectRevision::~SelectRevision() @@ -195,18 +200,18 @@ void SelectRevision::enableDisableOkButt { if (!index.isValid()) { - okButton->setEnabled(false); + buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); return; } QString rev(index.data().toString()); if (rev.size() == 0) { - okButton->setEnabled(false); + buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); return; } - okButton->setEnabled(true); + buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); } void SelectRevision::setCompleter(int index) @@ -380,4 +385,14 @@ void SelectRevision::accept() done(0); } +void SelectRevision::trySelectFirstRow() +{ + if (sortModel->rowCount() > 0) + { + QModelIndex idx = sortModel->index(0, 0); + revisionList->setCurrentIndex(idx); + readCerts(idx); + enableDisableOkButton(idx); + } +} ============================================================ --- src/view/dialogs/SelectRevision.h b9d7c86fcc38c8e035a24a251d6cc922ae7a717e +++ src/view/dialogs/SelectRevision.h 7b0eb080172fc538ab62dfd6328914f3e584dae8 @@ -72,6 +72,7 @@ private slots: void readCerts(const QModelIndex &); void revListDoubleClicked(const QModelIndex &); void contextMenuRequested(const QModelIndexList &, const QPoint &); + void trySelectFirstRow(); }; #endif ============================================================ --- src/view/panels/NodeInfo.cpp e2798816f4b28773989a7f5ff536a4ae315e9132 +++ src/view/panels/NodeInfo.cpp b97b0450019a459b36291b038217461d85b0607b @@ -19,6 +19,7 @@ #include "NodeInfo.h" #include +#include #include NodeInfo::NodeInfo(QWidget * parent) : QDockWidget(parent) @@ -29,11 +30,16 @@ NodeInfo::NodeInfo(QWidget * parent) : Q setupUi(parentWidget); setWidget(parentWidget); + connect( + fileBirthRev, SIGNAL(linkActivated(const QString &)), + this, SIGNAL(showSelectRevision(const QString &)) + ); + resetInfo(); setWindowTitle(tr("Node info")); setFloating(true); - setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); + setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); } NodeInfo::~NodeInfo() {} @@ -50,37 +56,76 @@ void NodeInfo::readAndSetInfo(const Inve QString strFileSize("-"); QString strFileLastModified("-"); - if (item->getFSType() == InventoryItem::File) + + IconProvider * ourIconProvider = IconProvider::singleton(); + if (item->isDirectory()) { - QFileInfo fileInfo(workspacePath + "/" + item->getPath()); - I(fileInfo.exists()); - strFileSize = QString("%1Kbytes").arg(fileInfo.size()); - strFileLastModified = fileInfo.lastModified().toString(); + fileIcon->setPixmap(ourIconProvider->getPlainFolderIcon().pixmap(64, 64)); } + else + { + if (item->getFSType() == InventoryItem::File) + { + QFileInfo fileInfo(workspacePath + "/" + item->getPath()); + I(fileInfo.exists()); + strFileSize = QString("%1 KB").arg(fileInfo.size() / 1024); + strFileLastModified = fileInfo.lastModified().toString(Qt::DefaultLocaleShortDate); + QFileIconProvider iconProvider; + fileIcon->setPixmap(iconProvider.icon(fileInfo).pixmap(64, 64)); + } + else + { + fileIcon->setPixmap(ourIconProvider->getPlainFileIcon().pixmap(64, 64)); + } + } - fileName->setText(item->getFilename()); - filePath->setText(tr("in: %1").arg(item->getBaseDirectory())); + filePath->setText(tr("File Path: %1").arg(item->getPath())); 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("-")); + + QString renameSource = item->getRenameSource(); + if (renameSource.isEmpty()) renameSource = "-"; + fileOldPath->setText(tr("Old Path: %1").arg(renameSource)); + + QString renameTarget = item->getRenameTarget(); + if (renameTarget.isEmpty()) renameTarget = "-"; + fileNewPath->setText(tr("New Path: %1").arg(renameTarget)); + + QString birthRev = item->getBirthRevision(); + if (!birthRev.isEmpty()) + { + fileBirthRev->setText(tr("Added in: %2..."). + arg(birthRev). + arg(birthRev.left(12))); + } + else + { + fileBirthRev->setText(tr("Added in: %1").arg("-")); + } + + fileSize->setText(tr("%1").arg(strFileSize)); + fileBaseType->setText(tr("Base Type: %1"). + arg(InventoryItem::translateFileType(item->getOldType()))); + fileNewType->setText(tr("New Type: %1"). + arg(InventoryItem::translateFileType(item->getNewType()))); + fileDiskType->setText(tr("Disk Type: %1"). + arg(InventoryItem::translateFileType(item->getFSType()))); + fileLastModified->setText(tr("Last Modified: %1").arg(strFileLastModified)); } void NodeInfo::resetInfo() { - fileName->setText("-"); - filePath->setText(tr("in: %1").arg("-")); + IconProvider * ourIconProvider = IconProvider::singleton(); + fileIcon->setPixmap(ourIconProvider->getPlainFileIcon().pixmap(64, 64)); + + filePath->setText(tr("File Path: %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("-")); + fileSize->setText(tr("%1").arg("-")); + fileBaseType->setText(tr("Base Type: %1").arg("-")); + fileNewType->setText(tr("New Type: %1").arg("-")); + fileDiskType->setText(tr("Disk Type: %1").arg("-")); fileLastModified->setText(tr("Last Modified: %1").arg("-")); } ============================================================ --- src/view/panels/NodeInfo.h 9568daf40a6cad3c88304cf386a3c3dea5128652 +++ src/view/panels/NodeInfo.h ad838bffdec60eb1afdef99a1de88e753fb38505 @@ -32,6 +32,9 @@ public: ~NodeInfo(); void setWorkspacePath(const WorkspacePath &); +signals: + void showSelectRevision(const QString &); + public slots: void readAndSetInfo(const InventoryItem *); void resetInfo();