# # # patch "guitone/res/i18n/guitone_de.ts" # from [16410dd4e15051aedd3225d9e133b9c26123e32b] # to [55e8428a347fffd074b2c02b9e87d716c7199888] # # patch "guitone/src/model/InventoryProxyModel.cpp" # from [85566d14f7d928a4d90c804654b476a4c1b66259] # to [207c67ec7e00028a1685fb78ec373917eb60356b] # # patch "guitone/src/model/InventoryProxyModel.h" # from [afa4cda8a630600ceda0f4d1e02a18697882460e] # to [641f56aecdec3c5c5d170f7b28dc379a392c35e4] # # patch "guitone/src/view/Guitone.cpp" # from [db42effec993b8448908de78104a99e7c383901d] # to [4d9733760e5630b412d38ced2e144ad4131f6d3f] # # patch "guitone/src/view/Guitone.h" # from [9f28936da1b590f83b470db5c091b8364ed453b4] # to [1235ffbe29b3cde54be5a44e6ee8987d91f37767] # # patch "guitone/src/view/InventoryView.cpp" # from [2403be0ec75d8d3a348f3e46c96108941b0a8a81] # to [64145819868bf2bc34916de61f252985eb0838e0] # # patch "guitone/src/view/InventoryView.h" # from [89ca6e4bfe2a01af39b97963f752a96fe2f04941] # to [e27d8be7c798a13d350783fdaf5b38bc85b6e6bc] # ============================================================ --- guitone/res/i18n/guitone_de.ts 16410dd4e15051aedd3225d9e133b9c26123e32b +++ guitone/res/i18n/guitone_de.ts 55e8428a347fffd074b2c02b9e87d716c7199888 @@ -266,17 +266,17 @@ Bereit - + Select your workspace... Wählen Sie Ihren Arbeitsbereich aus... - + Loading aborted Laden abgebrochen - + Invalid workspace Ungültiger Arbeitsbereich @@ -296,7 +296,7 @@ Das Inventar konnte nicht gelesen werden. Vielleicht läuft noch ein anderer Prozess? - + Loading workspace... Lade Arbeitsbereich... @@ -313,7 +313,7 @@ STRG+Q - + The chosen directory is no monotone workspace! Das gewählte Verzeichnis ist kein monotone-Arbeitsverzeichnis! @@ -323,7 +323,7 @@ &Importiere Arbeitsbereich - + Critical Monotone Error Kritischer monotone-Fehler @@ -359,22 +359,22 @@ Arbeitsbereich &öffnen - + &%1 %2 &%1 %2 - + No previous workspaces available. Keine vorherigen Arbeitsbereiche verfügbar. - + &Workspace A&rbeitsbereich - + &Switch revision Auf andere &Revision aktualisieren @@ -389,17 +389,17 @@ &Schlüsselverwaltung - + About &Qt Über &Qt - + &Help &Hilfe - + &Database Daten&bank @@ -414,17 +414,17 @@ &Einstellungen... - + &Key Management &Schlüsselverwaltung - + Unable to execute command Konnte Kommando nicht ausführen - + Unable to execute '%1' - maybe another command is still running? Konnte '%1' nicht ausführen - eventuell läuft noch ein anderes Kommando? @@ -444,25 +444,85 @@ Der Pfad zur ausführbaren Datei von monotone ist entweder ungültig oder zeigt auf eine ältere Version von monotone. Guitone benötigt monotone Version %1 oder ein monotone mit einer Interface-Version %2 oder neuer. - + Hide &ignored files &Ignorierte Dateien verstecken Show only &changed files - Zeige nur &geänderte Dateien + Zeige nur &geänderte Dateien - + Show &ignored files &Ignorierte Dateien anzeigen Show &all files - A&lle Dateien anzeigen + A&lle Dateien anzeigen + + + Show + Zeige + + + + &All files + &Alle Dateien + + + + All &changed files + Alle &geänderten Dateien + + + + &Patched files + Dateien mit I&nhaltsänderungen + + + + A&dded files + Hin&zugefügte Dateien + + + + R&emoved files + En&tfernte Dateien + + + + &Renamed files + &Umbenannte Dateien + + + + &Missing files + &Fehlende Dateien + + + + &Unknown files + Unbe&kannte Dateien + + + + I&gnored files + I&gnorierte Dateien + + + + E&xpand tree + Baum &aufklappen + + + + Co&llapse tree + Baum zuk&lappen + Inventory @@ -543,102 +603,102 @@ InventoryView - + &Add &Hinzufügen - + Add to workspace Zum Arbeitsbereich hinzufügen - + &Remove En&tfernen - + Remove from workspace Vom Arbeitsbereich entfernen - + &Commit &Einpflegen - + Commit Einpflegen - + I&gnore Datei &ignorieren - + Ignore file Datei ignorieren - + &Unignore Datei nicht ign&orieren - + Unignore file Datei nicht mehr ignorieren - + R&evert &Zurücksetzen - + Revert uncommitted changes Nicht eingepflegte Änderungen verwerfen - + Rena&me Um&benennen - + Rename file Datei umbenennen - + D&iff U&nterschiede anzeigen - + Diff against base revision Unterschiede im Vergleich zur Basisrevision anzeigen - + &Go into &Wechseln zu - + Go into the directory Wechsle in das Verzeichnis - + &Open &Öffnen - + Open in default program In Standardprogramm öffnen ============================================================ --- guitone/src/model/InventoryProxyModel.cpp 85566d14f7d928a4d90c804654b476a4c1b66259 +++ guitone/src/model/InventoryProxyModel.cpp 207c67ec7e00028a1685fb78ec373917eb60356b @@ -36,17 +36,39 @@ bool InventoryProxyModel::filterAcceptsR QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); InventoryItem *item = static_cast(index.internalPointer()); + // display the pseudo CdUp item only in the file list regardless of the + // state of the item + if (item->isCdUp()) + { + return !folderTree; + } + bool acceptRow = true; + // check the view options + int state = item->getStatusRecursive(); + bool patched = state & InventoryItem::Patched; + bool added = state & InventoryItem::Added; + bool dropped = state & InventoryItem::Dropped; + bool renamed = state & InventoryItem::RenamedFrom || state & InventoryItem::RenamedTo; + bool unknown = state & InventoryItem::Unknown; + bool missing = state & InventoryItem::Missing; + bool ignored = state & InventoryItem::Ignored; + bool changed = patched || added || dropped || renamed; + + acceptRow &= viewOption != Changed || changed; + acceptRow &= viewOption != Patched || patched; + acceptRow &= viewOption != Added || added; + acceptRow &= viewOption != Dropped || dropped; + acceptRow &= viewOption != Renamed || renamed; + acceptRow &= viewOption != Unknown || unknown; + acceptRow &= viewOption != Missing || missing; + acceptRow &= viewOption != Ignored || ignored; + // check if we should hide ignored files - acceptRow &= !hideIgnored || !item->hasStatus(InventoryItem::Ignored); - // check if we should only display changed files - acceptRow &= !showChanged || item->hasChangedRecursive(); + acceptRow &= !hideIgnored || !ignored; // check if we should only display folders acceptRow &= !folderTree || item->isDirectory(); - // make sure we don't display pseudo "cdUp" items in the tree view - acceptRow &= !folderTree || !item->isCdUp(); - return acceptRow; } @@ -112,15 +134,10 @@ bool InventoryProxyModel::hideIgnoredFil return hideIgnored; } -void InventoryProxyModel::setShowChangedFiles(bool show) +void InventoryProxyModel::setViewOption(ViewOption opt) { - if (show == showChanged) return; - showChanged = show; + if (viewOption == opt) return; + viewOption = opt; clear(); } -bool InventoryProxyModel::showChangedFiles() const -{ - return showChanged; -} - ============================================================ --- guitone/src/model/InventoryProxyModel.h afa4cda8a630600ceda0f4d1e02a18697882460e +++ guitone/src/model/InventoryProxyModel.h 641f56aecdec3c5c5d170f7b28dc379a392c35e4 @@ -27,6 +27,9 @@ public: { public: + enum ViewOption { All, Changed, Patched, Added, Dropped, + Renamed, Missing, Unknown, Ignored }; + explicit InventoryProxyModel(QObject * parent, bool folderTree_); ~InventoryProxyModel(void); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; @@ -34,14 +37,13 @@ public: void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); void setHideIgnoredFiles(bool hide); bool hideIgnoredFiles() const; - void setShowChangedFiles(bool hide); - bool showChangedFiles() const; + void setViewOption(ViewOption opt); private: bool folderTree; int sortColumn; bool hideIgnored; - bool showChanged; + ViewOption viewOption; Qt::SortOrder sortOrder; }; ============================================================ --- guitone/src/view/Guitone.cpp db42effec993b8448908de78104a99e7c383901d +++ guitone/src/view/Guitone.cpp 4d9733760e5630b412d38ced2e144ad4131f6d3f @@ -140,12 +140,50 @@ void Guitone::buildMenu() SLOT(showHideIgnoredFiles()), Qt::CTRL + Qt::Key_H ); - actShowHideChanged = menu->addAction( - tr("Show only &changed files"), + + actGroupViewOptions = new QActionGroup(this); + actGroupViewOptions->setExclusive(true); + actGroupViewOptions->addAction(tr("Show"))->setSeparator(true); + QAction * act; + act = actGroupViewOptions->addAction(tr("&All files")); + act->setChecked(true); + act->setShortcut(Qt::Key_A); + act->setData(QVariant(InventoryProxyModel::All)); + act = actGroupViewOptions->addAction(tr("All &changed files")); + act->setShortcut(Qt::Key_C); + act->setData(QVariant(InventoryProxyModel::Changed)); + act = actGroupViewOptions->addAction(tr("&Patched files")); + act->setShortcut(Qt::Key_P); + act->setData(QVariant(InventoryProxyModel::Patched)); + act = actGroupViewOptions->addAction(tr("A&dded files")); + act->setShortcut(Qt::Key_N); + act->setData(QVariant(InventoryProxyModel::Added)); + act = actGroupViewOptions->addAction(tr("R&emoved files")); + act->setShortcut(Qt::Key_D); + act->setData(QVariant(InventoryProxyModel::Dropped)); + act = actGroupViewOptions->addAction(tr("&Renamed files")); + act->setShortcut(Qt::Key_R); + act->setData(QVariant(InventoryProxyModel::Renamed)); + act = actGroupViewOptions->addAction(tr("&Missing files")); + act->setShortcut(Qt::Key_M); + act->setData(QVariant(InventoryProxyModel::Missing)); + act = actGroupViewOptions->addAction(tr("&Unknown files")); + act->setShortcut(Qt::Key_U); + act->setData(QVariant(InventoryProxyModel::Unknown)); + act = actGroupViewOptions->addAction(tr("I&gnored files")); + act->setShortcut(Qt::Key_I); + act->setData(QVariant(InventoryProxyModel::Ignored)); + menu->addActions(actGroupViewOptions->actions()); + + menu->addAction("")->setSeparator(true); + + actExpandCollapseTree = menu->addAction( + tr("E&xpand tree"), this, - SLOT(showHideChangedFiles()), - Qt::CTRL + Qt::Key_L + SLOT(expandCollapseTree()), + Qt::CTRL + Qt::Key_T ); + actExpandCollapseTree->setData(QVariant(false)); menu = menuBar()->addMenu(tr("&Workspace")); menu->addAction( @@ -228,7 +266,7 @@ void Guitone::buildConnections() void Guitone::buildConnections() { - // the attributes are read every time a file/folder object is selected + // attributes connect( treeView, SIGNAL(clicked(const QModelIndex &)), attrModel, SLOT(readAttributes(const QModelIndex &)) @@ -237,15 +275,22 @@ void Guitone::buildConnections() listView, SIGNAL(clicked(const QModelIndex &)), attrModel, SLOT(readAttributes(const QModelIndex &)) ); - + + // filelist/tree synchronization connect( treeView, SIGNAL(directoryChanged(const QModelIndex &)), - listView, SLOT(slotChdir(const QModelIndex &)) + listView, SLOT(changeDirectory(const QModelIndex &)) ); connect( listView, SIGNAL(directoryChanged(const QModelIndex &)), - treeView, SLOT(slotChdir(const QModelIndex &)) + treeView, SLOT(changeDirectory(const QModelIndex &)) ); + + // menu actions + connect( + actGroupViewOptions, SIGNAL(triggered(QAction *)), + this, SLOT(setViewOption(QAction *)) + ); } void Guitone::criticalMtnError(const QString & msg) @@ -330,15 +375,28 @@ void Guitone::showHideIgnoredFiles() ); } -void Guitone::showHideChangedFiles() +void Guitone::setViewOption(QAction * act) { - bool show = proxyModelFolderTree->showChangedFiles(); - proxyModelFolderTree->setShowChangedFiles(!show); - proxyModelFileList->setShowChangedFiles(!show); + InventoryProxyModel::ViewOption opt = + (InventoryProxyModel::ViewOption) act->data().toInt(); + proxyModelFolderTree->setViewOption(opt); + proxyModelFileList->setViewOption(opt); +} + +void Guitone::expandCollapseTree() +{ + bool expanded = actExpandCollapseTree->data().toBool(); - actShowHideChanged->setText( - show ? tr("Show only &changed files") : tr("Show &all files") + if (expanded) + treeView->collapseAll(); + else + treeView->expandAll(); + + actExpandCollapseTree->setText( + expanded ? tr("E&xpand tree") : tr("Co&llapse tree") ); + + actExpandCollapseTree->setData(QVariant(!expanded)); } void Guitone::openRecentWorkspace() ============================================================ --- guitone/src/view/Guitone.h 9f28936da1b590f83b470db5c091b8364ed453b4 +++ guitone/src/view/Guitone.h 1235ffbe29b3cde54be5a44e6ee8987d91f37767 @@ -46,7 +46,8 @@ private slots: void openRecentWorkspace(); void criticalMtnError(const QString &); void showHideIgnoredFiles(); - void showHideChangedFiles(); + void setViewOption(QAction *); + void expandCollapseTree(); void openSwitchWorkspaceRevisionDialog(); void openPreferencesDialog(); void openAncestryGraphDialog(); @@ -63,8 +64,9 @@ private: QMenu *menu; QMenu *wsSubMenu; QAction *actShowHideIgnored; - QAction *actShowHideChanged; - Inventory *invModel; + QActionGroup *actGroupViewOptions; + QAction *actExpandCollapseTree; + Inventory *invModel; Attributes *attrModel; InventoryProxyModel *proxyModelFolderTree; InventoryProxyModel *proxyModelFileList; ============================================================ --- guitone/src/view/InventoryView.cpp 2403be0ec75d8d3a348f3e46c96108941b0a8a81 +++ guitone/src/view/InventoryView.cpp 64145819868bf2bc34916de61f252985eb0838e0 @@ -56,7 +56,7 @@ InventoryView::InventoryView(QWidget* pa connect( this, SIGNAL(doubleClicked(const QModelIndex &)), - this, SLOT(slotItemClicked(const QModelIndex &)) + this, SLOT(itemClicked(const QModelIndex &)) ); // in a folder tree a single click will already trigger actions @@ -64,7 +64,7 @@ InventoryView::InventoryView(QWidget* pa { connect( this, SIGNAL(clicked(const QModelIndex &)), - this, SLOT(slotItemClicked(const QModelIndex &)) + this, SLOT(itemClicked(const QModelIndex &)) ); } } @@ -171,7 +171,8 @@ void InventoryView::contextMenuEvent(QCo } else { - if (item->hasStatus(InventoryItem::Patched)) + if (item->hasStatus(InventoryItem::Patched) && + item->hasNotStatus(InventoryItem::Added)) { actDiff->setFont(activeFont); actOpen->setFont(normalFont); @@ -217,8 +218,8 @@ void InventoryView::createAndConnectCont void InventoryView::createAndConnectContextActions(void) { actChdir = new QAction(tr("&Go into"), this); - actChdir->setStatusTip(tr("Go into the directory")); - connect(actChdir, SIGNAL(triggered()), this, SLOT(slotChdir(QModelIndex()))); + actChdir->setStatusTip(tr("Go into the directory")); + connect(actChdir, SIGNAL(triggered()), this, SLOT(slotChdir())); actOpen = new QAction(tr("&Open"), this); actOpen->setStatusTip(tr("Open in default program")); @@ -257,20 +258,19 @@ void InventoryView::createAndConnectCont connect(actRename, SIGNAL(triggered()), this, SLOT(slotRename())); } - -void InventoryView::slotChdir(const QModelIndex & proxyIndex) +void InventoryView::slotChdir() { - QModelIndex source; + QItemSelectionModel *selectionModel = this->selectionModel(); + QList list(selectionModel->selectedIndexes()); + Q_ASSERT(list.size() > 0); - if (!proxyIndex.isValid()) - { - source = getSingleSelection(); - } - else - { - source = static_cast(model())->mapToSource(proxyIndex); - } - + emit directoryChanged(list[0]); + changeDirectory(list[0]); +} + +void InventoryView::changeDirectory(const QModelIndex & proxyIndex) +{ + QModelIndex source = static_cast(model())->mapToSource(proxyIndex); InventoryItem *item = static_cast(source.internalPointer()); if (type == FileList) @@ -414,7 +414,7 @@ QModelIndex InventoryView::getSingleSele } -void InventoryView::slotItemClicked(const QModelIndex & index) +void InventoryView::itemClicked(const QModelIndex & index) { if (!index.isValid()) return; QModelIndex sourceIndex = @@ -425,11 +425,12 @@ void InventoryView::slotItemClicked(cons if (item->isDirectory()) { emit directoryChanged(index); - slotChdir(index); + changeDirectory(index); return; } - if (item->hasStatus(InventoryItem::Patched)) + if (item->hasStatus(InventoryItem::Patched) && + item->hasNotStatus(InventoryItem::Added)) { slotDiff(); return; ============================================================ --- guitone/src/view/InventoryView.h 89ca6e4bfe2a01af39b97963f752a96fe2f04941 +++ guitone/src/view/InventoryView.h e27d8be7c798a13d350783fdaf5b38bc85b6e6bc @@ -32,10 +32,7 @@ public: Q_OBJECT public: - enum Type{ - FolderTree = 1, - FileList = 2 - }; + enum Type { FolderTree, FileList }; InventoryView(QWidget*, Type, QString); ~InventoryView(); @@ -66,8 +63,10 @@ private slots: Type type; private slots: - void slotChdir(const QModelIndex &); - void slotItemClicked(const QModelIndex & index); + void changeDirectory(const QModelIndex &); + void itemClicked(const QModelIndex & index); + + void slotChdir(void); void slotOpen(void); void slotAdd(void); void slotRemove(void);