diff --git a/fuel.pro b/fuel.pro index d5461a1..5e7244e 100644 --- a/fuel.pro +++ b/fuel.pro @@ -52,7 +52,8 @@ SOURCES += src/main.cpp\ src/LoggedProcess.cpp \ src/BrowserWidget.cpp \ src/CustomWebView.cpp \ - src/Bridge.cpp + src/Bridge.cpp \ + src/Workspace.cpp HEADERS += src/MainWindow.h \ src/CommitDialog.h \ @@ -64,7 +65,8 @@ HEADERS += src/MainWindow.h \ src/LoggedProcess.h \ src/BrowserWidget.h \ src/CustomWebView.h \ - src/Bridge.h + src/Bridge.h \ + src/Workspace.h FORMS += ui/MainWindow.ui \ ui/CommitDialog.ui \ diff --git a/manifest b/manifest index 75c018a..9bd8e7e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Refactored\sWorkspace\scleanup -D 2015-04-30T11:10:27.176 +C Moved\sWorkspace\sto\sseparate\sfile +D 2015-04-30T11:21:29.350 F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35 F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b @@ -15,7 +15,7 @@ F dist/win/fuel.iss ef3558dbba409eb194938b930377fc9ee27d319e F doc/Building.txt 17b43fa23da764b5d1b828cc48c5a95e612bbd8f F doc/Changes.txt b03302545e4a6c0b16a30d623a7627f8aef65ef6 F doc/License.txt 4cc77b90af91e615a64ae04893fdffa7939db84c -F fuel.pro fe3ce3763affa5e809b1154fffd33b437d03ca5b +F fuel.pro 5db250757a6063a32663ab4813ec4d02912fa2f1 F intl/convert.bat 4222ae403418381452b843929d15259ea9850ab1 x F intl/convert.sh 2ca2179ff53e727f241925b75e19182607883c45 x F intl/de_DE.ts e2faceab920ac60c97bbc6fba038e261d51fc741 @@ -188,8 +188,8 @@ F src/Bridge.cpp 96aca0460c87ec2cdd154527a0583a00309ebcea F src/Bridge.h 9a3a3a52eb64c673a9dedac1d5d15a44aac71bc7 F src/BrowserWidget.cpp 8b8f545cdff4a4188edc698a1b4777f5df46f056 F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597 -F src/CloneDialog.cpp 812ef7d361c16da21540b7047c9d4d5e74f18539 -F src/CloneDialog.h e9f0fc8e5cc5ea2e7c43d6e77b5c4a9cc850b59e +F src/CloneDialog.cpp 4fc5aa8146ac63ba6ba7341b1635b3025819d708 +F src/CloneDialog.h 8813d91f893eb3eb86a4ea5e50f9a53a0ea07047 F src/CommitDialog.cpp 5300522ac11bc1096a11a6ce22f8c1665d4afc05 F src/CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72 F src/CustomWebView.cpp b7dd0c41977c2cba005df07ed8967ba6f58d07d9 @@ -200,12 +200,12 @@ F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2 F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261 -F src/MainWindow.cpp eef87990ce725c03e0f874548663864aae59d28d -F src/MainWindow.h fa49c7c005cf8b2be71d84302e41444d73a828da +F src/MainWindow.cpp 4c93bd6ef8391332a153f8e820b3baa4b5405ab6 +F src/MainWindow.h 59ba144c9a73a1398afc8c49516d93ea56cd9fc4 F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4 F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43 F src/Utils.cpp f78728e0817b1db23007ba0d2c5c26980ee7ebca -F src/Utils.h bece95535a98daeb3ea0653352c0a1bb63d39ba8 +F src/Utils.h 48ca8ab324068df2bf5120c961216c297b94cb45 F src/main.cpp 2ac8badc2a63fa123ceae53382ce24cfe1b5a54b F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x @@ -215,7 +215,7 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d F ui/MainWindow.ui 8677f5c8bca5bf7561d5f64bfdd0cef5157c6ac7 F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b -P 654259ef3bb3e7e2cc43a85637a8320b501a6593 -R 877ff1e9d9c7da6aaf633c7829698f81 +P 3a653a3761f6f6e565762b8730bf5f7447ca2d2b +R a4168b45358c0251d9f518a38873c7f1 U kostas -Z 708ed1db241d1458ef9161843ffc20f5 +Z 78ce8dabd7aa41822675709425667809 diff --git a/manifest.uuid b/manifest.uuid index 243bb59..d5136a7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3a653a3761f6f6e565762b8730bf5f7447ca2d2b \ No newline at end of file +4c84ad9b0b25c9a77d935f9598b6705498d8e0ae \ No newline at end of file diff --git a/src/CloneDialog.cpp b/src/CloneDialog.cpp index 0f6003d..ff1024b 100644 --- a/src/CloneDialog.cpp +++ b/src/CloneDialog.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "Utils.h" //----------------------------------------------------------------------------- CloneDialog::CloneDialog(QWidget *parent) : diff --git a/src/CloneDialog.h b/src/CloneDialog.h index b2fdae3..884db5a 100644 --- a/src/CloneDialog.h +++ b/src/CloneDialog.h @@ -3,10 +3,6 @@ #include -#define FOSSIL_CHECKOUT1 "_FOSSIL_" -#define FOSSIL_CHECKOUT2 ".fslckout" -#define FOSSIL_EXT "fossil" - namespace Ui { class CloneDialog; } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 5178433..119c387 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -8,22 +8,14 @@ #include #include #include -#include -#include #include -#include #include #include #include -#include -#include -#include -#include #include "CommitDialog.h" #include "FileActionDialog.h" #include "CloneDialog.h" #include "Utils.h" -#include "LoggedProcess.h" //----------------------------------------------------------------------------- enum @@ -212,12 +204,6 @@ MainWindow::~MainWindow() delete ui; } -//----------------------------------------------------------------------------- -Workspace::~Workspace() -{ - clearState(); -} - //----------------------------------------------------------------------------- const QString &MainWindow::getCurrentWorkspace() { @@ -489,38 +475,6 @@ void MainWindow::onOpenRecent() openWorkspace(workspace); } -//------------------------------------------------------------------------------ -bool Workspace::scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool &abort, Bridge::UICallback &uiCallback) -{ - QDir dir(dirPath); - - uiCallback.updateProcess(dirPath); - - QFileInfoList list = dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot); - for (int i=0; ifileName(); - QString fullpath = it->absoluteFilePath(); - - // Skip fossil files - if(filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!fossil().getRepositoryFile().isEmpty() && QFileInfo(fullpath) == QFileInfo(fossil().getRepositoryFile()))) - continue; - - RepoFile *rf = new RepoFile(*it, RepoFile::TYPE_UNKNOWN, wkdir); - getFiles().insert(rf->getFilePath(), rf); - getPaths().insert(rf->getPath()); - } - } - uiCallback.endProcess(); - - uiCallback.beginProcess(QObject::tr("Updating...")); - - // Update Files and Directories - - for(QStringList::iterator line_it=res.begin(); line_it!=res.end(); ++line_it) - { - QString line = (*line_it).trimmed(); - if(line.length()==0) - continue; - - QString status_text = line.left(10).trimmed(); - QString fname = line.right(line.length() - 10).trimmed(); - RepoFile::EntryType type = RepoFile::TYPE_UNKNOWN; - - // Generate a RepoFile for all non-existant fossil files - // or for all files if we skipped scanning the workspace - bool add_missing = !scan_files; - - if(status_text=="EDITED") - type = RepoFile::TYPE_EDITTED; - else if(status_text=="ADDED") - type = RepoFile::TYPE_ADDED; - else if(status_text=="DELETED") - { - type = RepoFile::TYPE_DELETED; - add_missing = true; - } - else if(status_text=="MISSING") - { - type = RepoFile::TYPE_MISSING; - add_missing = true; - } - else if(status_text=="RENAMED") - type = RepoFile::TYPE_RENAMED; - else if(status_text=="UNCHANGED") - type = RepoFile::TYPE_UNCHANGED; - else if(status_text=="CONFLICT") - type = RepoFile::TYPE_CONFLICTED; - - // Filter unwanted file types - if( ((type & RepoFile::TYPE_MODIFIED) && !scanModified) || - ((type & RepoFile::TYPE_UNCHANGED) && !scanUnchanged)) - { - getFiles().remove(fname); - continue; - } - else - add_missing = true; - - Workspace::filemap_t::iterator it = getFiles().find(fname); - - RepoFile *rf = 0; - if(add_missing && it==getFiles().end()) - { - QFileInfo info(wkdir+QDir::separator()+fname); - rf = new RepoFile(info, type, wkdir); - getFiles().insert(rf->getFilePath(), rf); - } - - if(!rf) - { - it = getFiles().find(fname); - Q_ASSERT(it!=getFiles().end()); - rf = *it; - } - - rf->setType(type); - - QString path = rf->getPath(); - getPaths().insert(path); - } - - // Load the stash - fossil().stashList(getStashes()); -_done: - uiCallback.endProcess(); -} //------------------------------------------------------------------------------ void MainWindow::scanWorkspace() diff --git a/src/MainWindow.h b/src/MainWindow.h index 1975b20..4a36ed1 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -2,142 +2,15 @@ #define MAINWINDOW_H #include -#include #include -#include -#include -#include -#include -#include #include "SettingsDialog.h" -#include "Bridge.h" +#include "Workspace.h" namespace Ui { class MainWindow; } -////////////////////////////////////////////////////////////////////////// -// RepoFile -////////////////////////////////////////////////////////////////////////// -struct RepoFile -{ - enum EntryType - { - TYPE_UNKNOWN = 1<<0, - TYPE_UNCHANGED = 1<<1, - TYPE_EDITTED = 1<<2, - TYPE_ADDED = 1<<3, - TYPE_DELETED = 1<<4, - TYPE_MISSING = 1<<5, - TYPE_RENAMED = 1<<6, - TYPE_CONFLICTED = 1<<7, - TYPE_MODIFIED = TYPE_EDITTED|TYPE_ADDED|TYPE_DELETED|TYPE_MISSING|TYPE_RENAMED|TYPE_CONFLICTED, - TYPE_REPO = TYPE_UNCHANGED|TYPE_MODIFIED, - TYPE_ALL = TYPE_UNKNOWN|TYPE_REPO - }; - RepoFile(QFileInfo &info, EntryType type, const QString &repoPath) - { - FileInfo = info; - Type = type; - FilePath = getRelativeFilename(repoPath); - Path = FileInfo.absolutePath(); - - // Strip the workspace path from the path - Q_ASSERT(Path.indexOf(repoPath)==0); - Path = Path.mid(repoPath.length()+1); - } - - bool isType(EntryType t) const - { - return Type == t; - } - - void setType(EntryType t) - { - Type = t; - } - - EntryType getType() const - { - return Type; - } - - QFileInfo getFileInfo() const - { - return FileInfo; - } - - const QString &getFilePath() const - { - return FilePath; - } - - QString getFilename() const - { - return FileInfo.fileName(); - } - - const QString &getPath() const - { - return Path; - } - - QString getRelativeFilename(const QString &path) - { - QString abs_base_dir = QDir(path).absolutePath(); - - QString relative = FileInfo.absoluteFilePath(); - int index = relative.indexOf(abs_base_dir); - if(index<0) - return QString(""); - - return relative.right(relative.length() - abs_base_dir.length()-1); - } - -private: - QFileInfo FileInfo; - EntryType Type; - QString FilePath; - QString Path; -}; - - -typedef QSet stringset_t; - -class Workspace -{ -public: - ~Workspace(); - - typedef QList filelist_t; - typedef QMap filemap_t; - - void clearState(); - - Bridge & fossil() { return bridge; } - const Bridge & fossil() const { return bridge; } - - static bool scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool& abort, Bridge::UICallback &uiCallback); - void scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModified, bool scanUnchanged, const QString &ignoreGlob, Bridge::UICallback &uiCallback, bool &operationAborted); - - 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; } - -private: - Bridge bridge; - filemap_t workspaceFiles; - stringset_t pathSet; - stashmap_t stashMap; - - QStandardItemModel repoFileModel; - QStandardItemModel repoDirModel; - QStandardItemModel repoStashModel; -}; ////////////////////////////////////////////////////////////////////////// // MainWindow diff --git a/src/Utils.h b/src/Utils.h index 1d8a910..36d66bb 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -4,12 +4,16 @@ #include #include +#define COUNTOF(array) (sizeof(array)/sizeof(array[0])) +#define FOSSIL_CHECKOUT1 "_FOSSIL_" +#define FOSSIL_CHECKOUT2 ".fslckout" +#define FOSSIL_EXT "fossil" + + QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, const QString &query, QMessageBox::StandardButtons buttons = QMessageBox::Yes|QMessageBox::No); QString QuotePath(const QString &path); QStringList QuotePaths(const QStringList &paths); -#define COUNTOF(array) (sizeof(array)/sizeof(array[0])) - #ifdef Q_OS_WIN bool ShowExplorerMenu(HWND hwnd, const QString &path, const QPoint &qpoint); #endif