Reorganized the menus.
Removed distinction between repositories and workspaces Open Workspace action maps to File|Open Open Workspace now also "opens" the fossil repo if no workspace is detected Added "Close Repo" action (File|Close) FossilOrigin-Name: 1fb5f07f1b18c3d7f9cf16f54cd790294001940f
This commit is contained in:
parent
5acd01a0fd
commit
160b04e762
241
MainWindow.cpp
241
MainWindow.cpp
@ -270,9 +270,50 @@ void MainWindow::on_actionRefresh_triggered()
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool MainWindow::openWorkspace(const QString &dir)
|
||||
// Open a fossil file or workspace path. If no checkout is detected offer to
|
||||
// open the fossil file.
|
||||
bool MainWindow::openWorkspace(const QString &path)
|
||||
{
|
||||
setCurrentWorkspace(dir);
|
||||
QFileInfo fi(path);
|
||||
QString wkspace = path;
|
||||
|
||||
if(fi.isFile())
|
||||
{
|
||||
wkspace = fi.absoluteDir().absolutePath();
|
||||
QString metadata_file = wkspace + PATH_SEP + "_FOSSIL_";
|
||||
|
||||
if(!QFileInfo(metadata_file).exists())
|
||||
{
|
||||
if(ANSWER_YES !=DialogQuery(this, tr("Open Fossil"), "No workspace found.\nWould you like to make one here?"))
|
||||
return false;
|
||||
|
||||
// Ok open the fossil
|
||||
setCurrentWorkspace(wkspace);
|
||||
if(!QDir::setCurrent(wkspace))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not change current directory"), QMessageBox::Ok );
|
||||
return false;
|
||||
}
|
||||
|
||||
repositoryFile = fi.absoluteFilePath();
|
||||
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(repositoryFile), 0, false))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT(QDir(wkspace).exists());
|
||||
setCurrentWorkspace(wkspace);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT(QDir(wkspace).exists());
|
||||
setCurrentWorkspace(wkspace);
|
||||
}
|
||||
|
||||
on_actionClearLog_triggered();
|
||||
stopUI();
|
||||
@ -281,7 +322,7 @@ bool MainWindow::openWorkspace(const QString &dir)
|
||||
if(!refresh())
|
||||
{
|
||||
setCurrentWorkspace("");
|
||||
workspaceHistory.removeAll(dir);
|
||||
workspaceHistory.removeAll(path);
|
||||
rebuildRecent();
|
||||
return false;
|
||||
}
|
||||
@ -289,13 +330,102 @@ bool MainWindow::openWorkspace(const QString &dir)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionOpen_triggered()
|
||||
void MainWindow::on_actionOpenRepository_triggered()
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Fossil Workspace"), QDir::currentPath());
|
||||
if(!path.isNull())
|
||||
openWorkspace(path);
|
||||
QString filter(tr("Fossil Repositories (*.fossil)"));
|
||||
|
||||
QString path = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Fossil Repository"),
|
||||
QDir::currentPath(),
|
||||
filter,
|
||||
&filter);
|
||||
|
||||
if(path.isEmpty())
|
||||
return;
|
||||
|
||||
openWorkspace(path);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionNewRepository_triggered()
|
||||
{
|
||||
QString filter(tr("Fossil Repositories (*.fossil)"));
|
||||
|
||||
QString path = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
tr("New Fossil Repository"),
|
||||
QDir::currentPath(),
|
||||
filter,
|
||||
&filter);
|
||||
|
||||
if(path.isEmpty())
|
||||
return;
|
||||
|
||||
if(QFile::exists(path))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("A repository file already exists.\nRepository creation aborted."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
stopUI();
|
||||
|
||||
on_actionClearLog_triggered();
|
||||
|
||||
QFileInfo path_info(path);
|
||||
Q_ASSERT(path_info.dir().exists());
|
||||
QString wkdir = path_info.absoluteDir().absolutePath();
|
||||
|
||||
setCurrentWorkspace(wkdir);
|
||||
if(!QDir::setCurrent(wkdir))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not change current directory"), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
repositoryFile = path_info.absoluteFilePath();
|
||||
|
||||
// Create repo
|
||||
if(!runFossil(QStringList() << "new" << QuotePath(repositoryFile), 0, false))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not create repository."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
// Open repo
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(repositoryFile), 0, false))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionCloseRepository_triggered()
|
||||
{
|
||||
if(getRepoStatus()!=REPO_OK)
|
||||
return;
|
||||
|
||||
if(ANSWER_YES !=DialogQuery(this, tr("Close Workspace"), "Are you sure want to close this workspace?"))
|
||||
return;
|
||||
|
||||
// Close Repo
|
||||
if(!runFossil(QStringList() << "close", 0, false))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot close the workspace.\nAre there still uncommitted changes in available?"), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
stopUI();
|
||||
setCurrentWorkspace("");
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionClone_triggered()
|
||||
{
|
||||
// FIXME: Implement this
|
||||
stopUI();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::rebuildRecent()
|
||||
@ -307,7 +437,7 @@ void MainWindow::rebuildRecent()
|
||||
|
||||
for(int i = 0; i < enabled_acts; ++i)
|
||||
{
|
||||
QString text = tr("&%1 %2").arg(i + 1).arg(workspaceHistory[i]);
|
||||
QString text = tr("&%1 %2").arg(i + 1).arg(QDir::toNativeSeparators(workspaceHistory[i]));
|
||||
|
||||
recentWorkspaceActs[i]->setText(text);
|
||||
recentWorkspaceActs[i]->setData(workspaceHistory[i]);
|
||||
@ -378,6 +508,8 @@ void MainWindow::enableActions(bool on)
|
||||
ui->actionOpenContaining->setEnabled(on);
|
||||
ui->actionUndo->setEnabled(on);
|
||||
ui->actionUpdate->setEnabled(on);
|
||||
ui->actionOpenFolder->setEnabled(on);
|
||||
ui->actionRenameFolder->setEnabled(on);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
bool MainWindow::refresh()
|
||||
@ -387,9 +519,10 @@ bool MainWindow::refresh()
|
||||
|
||||
if(st==REPO_NOT_FOUND)
|
||||
{
|
||||
setStatus(tr("No checkout detected."));
|
||||
setStatus(tr("No workspace detected."));
|
||||
enableActions(false);
|
||||
repoFileModel.removeRows(0, repoFileModel.rowCount());
|
||||
repoDirModel.clear();
|
||||
return false;
|
||||
}
|
||||
else if(st==REPO_OLD_SCHEMA)
|
||||
@ -397,6 +530,7 @@ bool MainWindow::refresh()
|
||||
setStatus(tr("Old fossil schema detected. Consider running rebuild."));
|
||||
enableActions(false);
|
||||
repoFileModel.removeRows(0, repoFileModel.rowCount());
|
||||
repoDirModel.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -630,9 +764,6 @@ void MainWindow::updateFileView()
|
||||
{ RepoFile::TYPE_MISSING, "M", "Missing", ":icons/icons/Button Help-01.png" },
|
||||
};
|
||||
|
||||
//size_t num_files = workspaceFiles.size();
|
||||
//repoFileModel.insertRows(0, num_files);
|
||||
|
||||
size_t item_id=0;
|
||||
for(filemap_t::iterator it = workspaceFiles.begin(); it!=workspaceFiles.end(); ++it)
|
||||
{
|
||||
@ -1448,91 +1579,7 @@ void MainWindow::on_actionRename_triggered()
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionNewRepository_triggered()
|
||||
{
|
||||
QString filter(tr("Fossil Repositories (*.fossil)"));
|
||||
|
||||
QString path = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
tr("New Fossil Repository"),
|
||||
QDir::currentPath(),
|
||||
filter,
|
||||
&filter);
|
||||
|
||||
if(path.isEmpty())
|
||||
return;
|
||||
|
||||
if(QFile::exists(path))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("A repository file already exists.\nRepository creation aborted."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
stopUI();
|
||||
|
||||
on_actionClearLog_triggered();
|
||||
|
||||
QFileInfo path_info(path);
|
||||
Q_ASSERT(path_info.dir().exists());
|
||||
QString wkdir = path_info.absoluteDir().absolutePath();
|
||||
|
||||
setCurrentWorkspace(wkdir);
|
||||
if(!QDir::setCurrent(wkdir))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not change current diectory"), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
repositoryFile = path_info.absoluteFilePath();
|
||||
|
||||
// Create repo
|
||||
if(!runFossil(QStringList() << "new" << QuotePath(repositoryFile), 0, false))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Repository creation failed."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
// Open repo
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(repositoryFile), 0, false))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Repository checkout failed."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionOpenRepository_triggered()
|
||||
{
|
||||
#if 0
|
||||
QString filter(tr("Fossil Repositories (*.fossil)"));
|
||||
|
||||
QString path = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Fossil Repository"),
|
||||
QDir::currentPath(),
|
||||
filter,
|
||||
&filter);
|
||||
|
||||
if(path.isEmpty())
|
||||
return;
|
||||
|
||||
if(!QFile::exists(path))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Repository file does not exist."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionClone_triggered()
|
||||
{
|
||||
// FIXME: Implement this
|
||||
stopUI();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionOpenContaining_triggered()
|
||||
@ -1670,9 +1717,7 @@ void MainWindow::on_actionSettings_triggered()
|
||||
if(value->isEmpty())
|
||||
runFossil(QStringList() << "unset" << name << "-global");
|
||||
else
|
||||
{
|
||||
runFossil(QStringList() << "settings" << name << "\"" + *value + "\"" <<"-global");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ private:
|
||||
void enableActions(bool on);
|
||||
void addWorkspace(const QString &dir);
|
||||
void rebuildRecent();
|
||||
bool openWorkspace(const QString &dir);
|
||||
bool openWorkspace(const QString &path);
|
||||
void loadFossilSettings();
|
||||
QString getFossilPath();
|
||||
QString getFossilHttpAddress();
|
||||
@ -170,7 +170,7 @@ private slots:
|
||||
|
||||
// Designer slots
|
||||
void on_actionRefresh_triggered();
|
||||
void on_actionOpen_triggered();
|
||||
|
||||
void on_actionDiff_triggered();
|
||||
void on_actionFossilUI_triggered();
|
||||
void on_actionQuit_triggered();
|
||||
@ -200,8 +200,9 @@ private slots:
|
||||
void on_actionViewAsList_triggered();
|
||||
void on_actionOpenFolder_triggered();
|
||||
void on_actionRenameFolder_triggered();
|
||||
void on_actionOpenRepository_triggered();
|
||||
void on_actionNewRepository_triggered();
|
||||
void on_actionOpenRepository_triggered();
|
||||
void on_actionCloseRepository_triggered();
|
||||
|
||||
private:
|
||||
enum
|
||||
|
@ -128,12 +128,11 @@
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>Workspace</string>
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionNewRepository"/>
|
||||
<addaction name="actionOpenRepository"/>
|
||||
<addaction name="actionCloseRepository"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSyncSettings"/>
|
||||
<addaction name="actionSettings"/>
|
||||
@ -269,19 +268,37 @@
|
||||
<string>Ctrl+-</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen">
|
||||
<action name="actionNewRepository">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/icons/Document Blank-01.png</normaloff>:/icons/icons/Document Blank-01.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Make a new Fossil repository</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Make a new Fossil repository</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenRepository">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/icons/My Documents-01.png</normaloff>:/icons/icons/My Documents-01.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Workspace...</string>
|
||||
<string>Open...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open a fossil checkout folder</string>
|
||||
<string>Open a Fossil repository or workspace folder</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Open a fossil checkout folder</string>
|
||||
<string>Open a Fossil repository or workspace folder</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
@ -290,6 +307,20 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCloseRepository">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCloneRepository">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/icons/Address Book-01.png</normaloff>:/icons/icons/Address Book-01.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clone Repository...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPush">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
@ -425,41 +456,6 @@
|
||||
<string>Ctrl+Return</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNewRepository">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/icons/Book-01.png</normaloff>:/icons/icons/Book-01.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Repository...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Make a new Fossil repository</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Make a new Fossil repository</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenRepository">
|
||||
<property name="text">
|
||||
<string>Open Repository...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open Repository</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCloneRepository">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/icons/Address Book-01.png</normaloff>:/icons/icons/Address Book-01.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clone Repository...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenContaining">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
@ -525,7 +521,7 @@
|
||||
</action>
|
||||
<action name="actionSyncSettings">
|
||||
<property name="text">
|
||||
<string>Workspace Settings...</string>
|
||||
<string>Fossil Settings...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set remote synchronization settings</string>
|
||||
|
16
manifest
16
manifest
@ -1,14 +1,14 @@
|
||||
C Added\sWorkspace\sTree\sview\nAdded\sRename\sFolder\saction\nMinor\sGUI\scleanups\n
|
||||
D 2011-10-17T14:58:09.384
|
||||
C Reorganized\sthe\smenus.\nRemoved\sdistinction\sbetween\srepositories\sand\sworkspaces\nOpen\sWorkspace\saction\smaps\sto\sFile|Open\nOpen\sWorkspace\snow\salso\s"opens"\sthe\sfossil\srepo\sif\sno\sworkspace\sis\sdetected\nAdded\s"Close\sRepo"\saction\s(File|Close)
|
||||
D 2011-10-18T12:35:37.610
|
||||
F CommitDialog.cpp 8965e52d077c300cf1acb1b16fb2dcca5c7070f8
|
||||
F CommitDialog.h a9596d99865cf312b419d01d51334ffc916f5508
|
||||
F CommitDialog.ui 5067623f6af6f5a42c87df903278e383e945e154
|
||||
F FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8
|
||||
F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
||||
F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7
|
||||
F MainWindow.cpp 1ca79369fdb5cbe87dcc38d3f2aebd8a007d64f0
|
||||
F MainWindow.h 6fdcb10c8a6da760c83dd05f1d07b69132ba3d4c
|
||||
F MainWindow.ui 82a3d869e043314a0c9a4c0821de2469d565b782
|
||||
F MainWindow.cpp 1d32a9a2a76833f7d16a6507ca97b7169eb1dd09
|
||||
F MainWindow.h 43030bed3c400aea93e988ad437ca783db7e2aa2
|
||||
F MainWindow.ui 868c2ab8910467cfb410f3e140d997b57fc7d425
|
||||
F RepoDialog.cpp 8f20e1511526973555c774350ec413dcecf51c9e
|
||||
F RepoDialog.h a958c5f98f1e6882bf41dbdd2e4df3cb89700802
|
||||
F RepoDialog.ui be7b18199c04a3003f3c7534a616cd7441b7bb0c
|
||||
@ -175,7 +175,7 @@ F installer/fuel.iss 13b6a938bcdf273cbd3649d2549887baa1577214
|
||||
F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c
|
||||
F main.cpp f67a9b5c9ca0b634b19ef08e7136032372d37f93
|
||||
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
|
||||
P a29a3fd0f7f4c26591e1ca168ad63f1f7530edbe
|
||||
R 4d693a61ebb632ca6600c2150bca11d5
|
||||
P 5fc925ac68148c69db66e88e23be196807ffec22
|
||||
R dd14deeace107d9d603384c1b8303b02
|
||||
U kostas
|
||||
Z a4c724920b064e72a32c87376626c0ab
|
||||
Z c13eaf4b3637295f43452645e51a80da
|
||||
|
@ -1 +1 @@
|
||||
5fc925ac68148c69db66e88e23be196807ffec22
|
||||
1fb5f07f1b18c3d7f9cf16f54cd790294001940f
|
Loading…
x
Reference in New Issue
Block a user