Goodbye Stash View
Working stash management in Workspace view FossilOrigin-Name: 1b0d47442df7a239ed11a048bde0073603b514f1
This commit is contained in:
@ -169,13 +169,6 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
||||
menuWorkspace->addAction(ui->actionRenameFolder);
|
||||
menuWorkspace->addAction(ui->actionOpenFolder);
|
||||
|
||||
// StashView
|
||||
ui->stashTableView->setModel(&getWorkspace().getStashModel());
|
||||
ui->stashTableView->addAction(ui->actionApplyStash);
|
||||
ui->stashTableView->addAction(ui->actionDiffStash);
|
||||
ui->stashTableView->addAction(ui->actionDeleteStash);
|
||||
ui->stashTableView->horizontalHeader()->setSortIndicatorShown(false);
|
||||
|
||||
// StashMenu
|
||||
menuStashes = new QMenu(this);
|
||||
menuStashes->addAction(ui->actionApplyStash);
|
||||
@ -608,7 +601,6 @@ void MainWindow::scanWorkspace()
|
||||
);
|
||||
updateDirView();
|
||||
updateFileView();
|
||||
updateStashView();
|
||||
|
||||
setBusy(false);
|
||||
setStatus("");
|
||||
@ -790,25 +782,6 @@ void MainWindow::updateFileView()
|
||||
ui->fileTableView->resizeRowsToContents();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::updateStashView()
|
||||
{
|
||||
getWorkspace().getStashModel().clear();
|
||||
|
||||
QStringList header;
|
||||
header << tr("Stashes");
|
||||
getWorkspace().getStashModel().setHorizontalHeaderLabels(header);
|
||||
|
||||
for(stashmap_t::iterator it=getWorkspace().getStashes().begin(); it!=getWorkspace().getStashes().end(); ++it)
|
||||
{
|
||||
QStandardItem *item = new QStandardItem(it.key());
|
||||
item->setToolTip(it.key());
|
||||
getWorkspace().getStashModel().appendRow(item);
|
||||
}
|
||||
ui->stashTableView->resizeColumnsToContents();
|
||||
ui->stashTableView->resizeRowsToContents();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::log(const QString &text, bool isHTML)
|
||||
{
|
||||
@ -907,11 +880,6 @@ void MainWindow::applySettings()
|
||||
viewMode = store->value("ViewAsList").toBool()? VIEWMODE_LIST : VIEWMODE_TREE;
|
||||
}
|
||||
//ui->workspaceTreeView->setVisible(viewMode == VIEWMODE_TREE);
|
||||
|
||||
if(store->contains("ViewStash"))
|
||||
ui->actionViewStash->setChecked(store->value("ViewStash").toBool());
|
||||
ui->stashTableView->setVisible(ui->actionViewStash->isChecked());
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1104,25 +1072,23 @@ void MainWindow::getFileViewSelection(QStringList &filenames, int includeMask, b
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::getStashViewSelection(QStringList &stashNames, bool allIfEmpty)
|
||||
void MainWindow::getStashViewSelection(QStringList &stashNames)
|
||||
{
|
||||
QModelIndexList selection = ui->stashTableView->selectionModel()->selectedIndexes();
|
||||
if(selection.empty() && allIfEmpty)
|
||||
{
|
||||
ui->stashTableView->selectAll();
|
||||
selection = ui->stashTableView->selectionModel()->selectedIndexes();
|
||||
ui->stashTableView->clearSelection();
|
||||
}
|
||||
QModelIndexList selection = ui->workspaceTreeView->selectionModel()->selectedIndexes();
|
||||
|
||||
for(QModelIndexList::iterator mi_it = selection.begin(); mi_it!=selection.end(); ++mi_it)
|
||||
foreach(const QModelIndex &mi, selection)
|
||||
{
|
||||
const QModelIndex &mi = *mi_it;
|
||||
QVariant data = mi.model()->data(mi, REPODIRMODEL_ROLE_PATH);
|
||||
Q_ASSERT(data.isValid());
|
||||
TreeViewItem tv = data.value<TreeViewItem>();
|
||||
|
||||
if(mi.column()!=0)
|
||||
if(tv.Type != TreeViewItem::TYPE_STASH)
|
||||
continue;
|
||||
QString name = getWorkspace().getStashModel().data(mi).toString();
|
||||
|
||||
QString name = mi.model()->data(mi, Qt::DisplayRole).toString();
|
||||
stashNames.append(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1625,8 +1591,6 @@ void MainWindow::onWorkspaceTreeViewSelectionChanged(const QItemSelection &/*sel
|
||||
|
||||
foreach(const QModelIndex &id, indices)
|
||||
{
|
||||
Q_ASSERT(ui->workspaceTreeView->model()==&getWorkspace().getDirModel());
|
||||
//QVariant data = getWorkspace().getDirModel().data(id, REPODIRMODEL_ROLE_PATH);
|
||||
QVariant data = id.model()->data(id, REPODIRMODEL_ROLE_PATH);
|
||||
Q_ASSERT(data.isValid());
|
||||
TreeViewItem tv = data.value<TreeViewItem>();
|
||||
@ -1843,12 +1807,6 @@ QMenu * MainWindow::createPopupMenu()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionViewStash_triggered()
|
||||
{
|
||||
ui->stashTableView->setVisible(ui->actionViewStash->isChecked());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionNewStash_triggered()
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ private:
|
||||
void getSelectionFilenames(QStringList &filenames, int includeMask=WorkspaceFile::TYPE_ALL, bool allIfEmpty=false);
|
||||
void getFileViewSelection(QStringList &filenames, int includeMask=WorkspaceFile::TYPE_ALL, bool allIfEmpty=false);
|
||||
void getDirViewSelection(QStringList &filenames, int includeMask=WorkspaceFile::TYPE_ALL, bool allIfEmpty=false);
|
||||
void getStashViewSelection(QStringList &stashNames, bool allIfEmpty=false);
|
||||
void getStashViewSelection(QStringList &stashNames);
|
||||
void getSelectionPaths(stringset_t &paths);
|
||||
void getAllFilenames(QStringList &filenames, int includeMask=WorkspaceFile::TYPE_ALL);
|
||||
bool startUI();
|
||||
@ -49,7 +49,6 @@ private:
|
||||
QString getFossilHttpAddress();
|
||||
void updateDirView();
|
||||
void updateFileView();
|
||||
void updateStashView();
|
||||
void selectRootDir();
|
||||
void fossilBrowse(const QString &fossilUrl);
|
||||
void dragEnterEvent(class QDragEnterEvent *event);
|
||||
@ -105,7 +104,6 @@ private slots:
|
||||
void on_actionOpenRepository_triggered();
|
||||
void on_actionCloseRepository_triggered();
|
||||
void on_actionCloneRepository_triggered();
|
||||
void on_actionViewStash_triggered();
|
||||
void on_actionNewStash_triggered();
|
||||
void on_actionApplyStash_triggered();
|
||||
void on_actionDeleteStash_triggered();
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
|
||||
QStandardItemModel &getFileModel() { return repoFileModel; }
|
||||
QStandardItemModel &getDirModel() { return repoDirModel; }
|
||||
QStandardItemModel &getStashModel() { return repoStashModel; }
|
||||
|
||||
filemap_t &getFiles() { return workspaceFiles; }
|
||||
stringset_t &getPaths() { return pathSet; }
|
||||
stashmap_t &getStashes() { return stashMap; }
|
||||
@ -129,7 +129,6 @@ private:
|
||||
|
||||
QStandardItemModel repoFileModel;
|
||||
QStandardItemModel repoDirModel;
|
||||
QStandardItemModel repoStashModel;
|
||||
};
|
||||
|
||||
#endif // WORKSPACE_H
|
||||
|
Reference in New Issue
Block a user