Allow opening a specific workspace path from the commandline

FossilOrigin-Name: e42f476b1c07959ee224b1abbd60f811893d0717
This commit is contained in:
kostas 2012-04-15 14:42:09 +00:00
parent b25efbddd1
commit ef4945494c
5 changed files with 30 additions and 16 deletions

View File

@ -88,7 +88,7 @@ static QStringMap MakeKeyValues(QStringList lines)
///////////////////////////////////////////////////////////////////////////////
MainWindow::MainWindow(QWidget *parent) :
MainWindow::MainWindow(QWidget *parent, QString *workspacePath) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
@ -172,6 +172,11 @@ MainWindow::MainWindow(QWidget *parent) :
viewMode = VIEWMODE_TREE;
loadSettings();
// Apply any explict workspace path if available
if(workspacePath)
openWorkspace(*workspacePath);
refresh();
rebuildRecent();
@ -208,7 +213,7 @@ void MainWindow::setCurrentWorkspace(const QString &workspace)
return;
}
QString new_workspace = QDir(workspace).absolutePath();
QString new_workspace = QFileInfo(workspace).absoluteFilePath();
currentWorkspace = new_workspace;
addWorkspace(new_workspace);
@ -277,13 +282,15 @@ bool MainWindow::openWorkspace(const QString &path)
}
else
{
Q_ASSERT(QDir(wkspace).exists());
if(!QDir(wkspace).exists())
return false;
setCurrentWorkspace(wkspace);
}
}
else
{
Q_ASSERT(QDir(wkspace).exists());
if(!QDir(wkspace).exists())
return false;
setCurrentWorkspace(wkspace);
}
@ -568,9 +575,10 @@ void MainWindow::scanWorkspace()
for(QFileInfoList::iterator it=all_files.begin(); it!=all_files.end(); ++it)
{
QString filename = it->fileName();
QString fullpath = it->absoluteFilePath();
// Skip fossil files
if(filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!repositoryFile.isEmpty() && it->absoluteFilePath()==repositoryFile))
if(filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!repositoryFile.isEmpty() && QFileInfo(fullpath) == QFileInfo(repositoryFile)))
continue;
RepoFile *rf = new RepoFile(*it, RepoFile::TYPE_UNKNOWN, wkdir);
@ -624,6 +632,8 @@ void MainWindow::scanWorkspace()
workspaceFiles.remove(fname);
continue;
}
else
add_missing = true;
filemap_t::iterator it = workspaceFiles.find(fname);

View File

@ -116,7 +116,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
explicit MainWindow(QWidget *parent = 0, QString *workspacePath = 0);
~MainWindow();
bool diffFile(QString repoFile);

View File

@ -15,7 +15,11 @@ int main(int argc, char *argv[])
#endif
{
MainWindow w;
QString workspace;
if(a.arguments().length()>1)
workspace = a.arguments()[1];
MainWindow w(0, &workspace);
w.show();
return a.exec();
}

View File

@ -1,5 +1,5 @@
C Fixed\sQt\sruntime\swarnings
D 2012-04-15T13:01:27.517
C Allow\sopening\sa\sspecific\sworkspace\spath\sfrom\sthe\scommandline\n\n
D 2012-04-15T14:42:09.758
F CommitDialog.cpp a46020a9361151d8d286a2670257d01d8967bf69
F CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72
F CommitDialog.ui 813d7cba316e226de1a22b7e480bb969fbe9b0c4
@ -8,8 +8,8 @@ F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7
F FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
F FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
F MainWindow.cpp 328041680fdba0c8076393bd58a2946489aee945
F MainWindow.h 1b45fba850a0a1da654f73ee47ba20c7802005d8
F MainWindow.cpp 8d0d6d8e78210670a8fe533b1413bcbe77196ce1
F MainWindow.h 78dc49fe4500a6113ed8bbff597d5305d203a80c
F MainWindow.ui d569997fecf4a22d61a016a4a23eea04eaad6dee
F SettingsDialog.cpp e1fad18cc020d08b82c6d35dc94f6624deec9a3b
F SettingsDialog.h f5da6cab4ccc82e2eb78ec835fb849c4c104d6cc
@ -174,9 +174,9 @@ F icons/fuel.icns 81e535004b62db801a02f3e15d0a33afc9d4070b
F icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038
F installer/fuel.iss 13b6a938bcdf273cbd3649d2549887baa1577214
F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c
F main.cpp 708e816c839ff4d9af9b769ac917a3fffe2c87c3
F main.cpp 69c1f9e873c016ef466d20298a67c3bc4c2b2f3a
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
P 689410ce4a8504ffc6b0a92e8faef8df5df1131c
R 45f82ac60fc0148d6bb76bc7e3806b1f
P 8e08f86043f0c2159037824f125e6acf2c2be007
R 2e9aacb62b629a4e755adad517f7f50b
U kostas
Z dbe672564b67fcf89fa31f8b55a47c06
Z 528eba2e411becfe13a36cbfcfcf8dde

View File

@ -1 +1 @@
8e08f86043f0c2159037824f125e6acf2c2be007
e42f476b1c07959ee224b1abbd60f811893d0717