| ︙ | | |
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
-
+
+
|
#include <QShortcut>
#include "CommitDialog.h"
#include "FileActionDialog.h"
#include "CloneDialog.h"
#include "UpdateDialog.h"
#include "Utils.h"
#define LATEST_VERSION "Latest"
#define LATEST_VERSION "Latest Revision"
#define CURRENT_VERSION "Current Revision"
//-----------------------------------------------------------------------------
enum
{
COLUMN_STATUS,
COLUMN_FILENAME,
COLUMN_EXTENSION,
|
| ︙ | | |
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
+
+
+
+
+
+
+
+
+
|
menuWorkspace->addAction(ui->actionDelete);
menuWorkspace->addAction(separator);
menuWorkspace->addAction(ui->actionRenameFolder);
menuWorkspace->addAction(ui->actionOpenFolder);
// StashMenu
menuStashes = new QMenu(this);
menuStashes->addAction(ui->actionNewStash);
menuStashes->addAction(separator);
menuStashes->addAction(ui->actionApplyStash);
menuStashes->addAction(ui->actionDiffStash);
menuStashes->addAction(ui->actionDeleteStash);
// TagsMenu
menuTags = new QMenu(this);
menuTags->addAction(ui->actionNewTag);
menuTags->addAction(separator);
menuTags->addAction(ui->actionDeleteTag);
menuTags->addAction(ui->actionUpdateRevision);
// BranchesMenu
menuBranches = new QMenu(this);
menuBranches->addAction(ui->actionNewBranch);
menuBranches->addAction(separator);
menuBranches->addAction(ui->actionMergeBranch);
menuBranches->addAction(ui->actionUpdateRevision);
// Recent Workspaces
// Locate a sequence of two separator actions in file menu
QList<QAction*> file_actions = ui->menuFile->actions();
QAction *recent_sep=0;
for(int i=0; i<file_actions.size(); ++i)
{
|
| ︙ | | |
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
|
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
|
-
-
-
|
uiCallback,
operationAborted
);
updateWorkspaceView();
updateFileView();
// Build default versions list
const QString latest = tr(LATEST_VERSION);
versionList.clear();
versionList.append(latest);
versionList += getWorkspace().getBranches();
versionList += getWorkspace().getTags().keys();
selectedTags.clear();
selectedBranches.clear();
setBusy(false);
|
| ︙ | | |
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
|
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
|
+
+
+
+
+
+
-
+
|
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::on_actionUpdateRevision_triggered()
{
QStringList selected = selectedBranches + selectedTags;
QString revision;
if(!selected.isEmpty())
revision = selected.first();
updateRevision("");
updateRevision(revision);
}
//------------------------------------------------------------------------------
void MainWindow::loadFossilSettings()
{
// Also retrieve the fossil global settings
QStringList out;
|
| ︙ | | |
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
|
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
|
+
+
|
QModelIndexList indices = ui->workspaceTreeView->selectionModel()->selectedIndexes();
// Do not modify the selection if nothing is selected
if(indices.empty())
return;
stringset_t new_dirs;
selectedTags.clear();
selectedBranches.clear();
foreach(const QModelIndex &id, indices)
{
QVariant data = id.model()->data(id, REPODIRMODEL_ROLE_PATH);
Q_ASSERT(data.isValid());
TreeViewItem tv = data.value<TreeViewItem>();
|
| ︙ | | |
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
|
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
|
+
+
|
if(tv.Type == TreeViewItem::TYPE_FOLDER || tv.Type == TreeViewItem::TYPE_WORKSPACE)
menu = menuWorkspace;
else if (tv.Type == TreeViewItem::TYPE_STASH || tv.Type == TreeViewItem::TYPE_STASHES)
menu = menuStashes;
else if (tv.Type == TreeViewItem::TYPE_TAG || tv.Type == TreeViewItem::TYPE_TAGS)
menu = menuTags;
else if (tv.Type == TreeViewItem::TYPE_BRANCH || tv.Type == TreeViewItem::TYPE_BRANCHES)
menu = menuBranches;
if(menu)
{
QPoint pos = QCursor::pos();
menu->popup(pos);
}
}
|
| ︙ | | |
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
|
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
|
-
+
+
+
+
|
//------------------------------------------------------------------------------
void MainWindow::on_actionNewTag_triggered()
{
// Default to current revision
QString revision = fossil().getCurrentRevision();
QString name;
if(!UpdateDialog::runNewTag(this, tr("New tag"), versionList, revision, revision, name))
if(!UpdateDialog::runNewTag(this, tr("New Tag"), versionList, revision, revision, name))
return;
if(name.isEmpty() || getWorkspace().getTags().contains(name) || getWorkspace().getBranches().contains(name))
{
QMessageBox::critical(this, tr("Error"), tr("Invalid name."), QMessageBox::Ok );
return;
}
fossil().tagNew(name, revision);
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::on_actionDeleteTag_triggered()
|
| ︙ | | |
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
|
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
fossil().tagDelete(tagname, revision);
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::on_actionNewBranch_triggered()
{
// Default to current revision
QString revision = fossil().getCurrentRevision();
QString branch_name;
if(!UpdateDialog::runNewTag(this, tr("New Branch"), versionList, revision, revision, branch_name))
return;
if(branch_name.isEmpty() || getWorkspace().getTags().contains(branch_name) || getWorkspace().getBranches().contains(branch_name))
{
QMessageBox::critical(this, tr("Error"), tr("Invalid name."), QMessageBox::Ok );
return;
}
if(!fossil().branchNew(branch_name, revision, false))
return;
if(QMessageBox::Yes == DialogQuery(this, tr("New Branch"), tr("Would you like to check-out the branch '%0' ?").arg(branch_name)))
updateRevision(branch_name);
else
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::MergeRevision(const QString &defaultRevision)
{
QStringList res;
QString revision = defaultRevision;
bool integrate = false;
revision = UpdateDialog::runMerge(this, tr("Merge"), versionList, revision, integrate);
if(revision.isEmpty())
return;
// Do test merge
if(!fossil().branchMerge(res, revision, integrate, true))
return;
if(!FileActionDialog::run(this, tr("Merge"), tr("The following changesd will be made.")+"\n"+tr("Are you sure?"), res))
return;
// Do update
fossil().branchMerge(res, revision, integrate, false);
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::on_actionMergeBranch_triggered()
{
QString revision;
if(!selectedBranches.isEmpty())
revision = selectedBranches.first();
MergeRevision(revision);
}
|