ui: removed 'Save Project' and 'Save Project As' actions

* removed save actions from menu in QtMainWindow
* removed MessageSaveProject and all Listeners
* updated project loading to ask whether old project and db file should be kept at old location
* fixed crash for missing include files
* fixed simple header search within source paths was broken
This commit is contained in:
Eberhard Graether
2016-06-28 15:59:22 +02:00
parent 2cf033d43a
commit 8ca54f2091
16 changed files with 123 additions and 202 deletions
+62 -39
View File
@@ -116,14 +116,72 @@ std::string FileSystem::getTimeStringNow() // TODO: move to utility
return boost::posix_time::to_iso_string(boost::posix_time::second_clock::universal_time());
}
bool FileSystem::exists(const std::string& path)
bool FileSystem::exists(const FilePath& path)
{
return boost::filesystem::exists(boost::filesystem::path(path));
return boost::filesystem::exists(path.path());
}
bool FileSystem::remove(const std::string& path)
bool FileSystem::remove(const FilePath& path)
{
return boost::filesystem::remove(path);
return boost::filesystem::remove(path.path());
}
bool FileSystem::rename(const FilePath& from, const FilePath& to)
{
if (!from.exists() || to.exists())
{
return false;
}
boost::filesystem::rename(from.path(), to.path());
return true;
}
bool FileSystem::copyFile(const FilePath& from, const FilePath& to)
{
if (!from.exists() || to.exists())
{
return false;
}
boost::filesystem::copy_file(boost::filesystem::path(from.path()), boost::filesystem::path(to.path()));
return true;
}
bool FileSystem::copy_directory(const FilePath& from, const FilePath& to)
{
if (!from.exists() || to.exists())
{
return false;
}
boost::filesystem::copy_directory(boost::filesystem::path(from.path()),boost::filesystem::path(to.path()));
return true;
}
void FileSystem::createDirectory(const FilePath& path)
{
boost::filesystem::create_directories(path.str());
}
std::vector<FilePath> FileSystem::getSubDirectories(const FilePath &path)
{
std::vector<FilePath> v;
if (!path.exists())
{
return v;
}
for (boost::filesystem::recursive_directory_iterator end, dir(path.str()); dir != end; dir++)
{
if (boost::filesystem::is_directory(dir->path()))
{
v.push_back(FilePath(dir->path()));
}
}
return v;
}
std::string FileSystem::fileName(const std::string& path)
@@ -169,38 +227,3 @@ bool FileSystem::equivalent(const std::string& pathA, const std::string& pathB)
return boost::filesystem::path(pathA).compare(boost::filesystem::path(pathB)) == 0;
}
void FileSystem::createDirectory(const FilePath& path)
{
boost::filesystem::create_directories(path.str());
}
bool FileSystem::copy_directory(const FilePath& from, const FilePath& to)
{
if(!from.exists() || to.exists())
{
return false;
}
boost::filesystem::copy_directory(boost::filesystem::path(from.str()),boost::filesystem::path(to.str()));
return true;
}
std::vector<FilePath> FileSystem::getSubDirectories(const FilePath &path)
{
std::vector<FilePath> v;
if (!path.exists())
{
return v;
}
for (boost::filesystem::recursive_directory_iterator end, dir(path.str()); dir != end; dir++)
{
if (boost::filesystem::is_directory(dir->path()))
{
v.push_back(FilePath(dir->path()));
}
}
return v;
}
+7 -4
View File
@@ -23,15 +23,18 @@ public:
static TimePoint getLastWriteTime(const FilePath& filePath);
static std::string getTimeStringNow();
static bool exists(const FilePath& path);
static bool remove(const FilePath& path);
static bool rename(const FilePath& from, const FilePath& to);
static bool copyFile(const FilePath& from, const FilePath& to);
static bool copy_directory(const FilePath& from, const FilePath& to);
static void createDirectory(const FilePath& path);
static std::vector<FilePath> getSubDirectories(const FilePath& path);
static bool exists(const std::string& path);
static std::string fileName(const std::string& path);
static std::string absoluteFilePath(const std::string& path);
static bool remove(const std::string& path);
static bool copy_directory(const FilePath& from, const FilePath& to);
static std::string extension(const std::string& path);
static std::string filePathWithoutExtension(const std::string& path);
@@ -1,12 +1,14 @@
#ifndef MESSAGE_LOAD_PROJECT_H
#define MESSAGE_LOAD_PROJECT_H
#include "utility/file/FilePath.h"
#include "utility/messaging/Message.h"
class MessageLoadProject: public Message<MessageLoadProject>
class MessageLoadProject
: public Message<MessageLoadProject>
{
public:
MessageLoadProject(const std::string& filePath, bool forceRefresh)
MessageLoadProject(const FilePath& filePath, bool forceRefresh)
: projectSettingsFilePath(filePath)
, forceRefresh(forceRefresh)
{
@@ -19,10 +21,10 @@ public:
virtual void print(std::ostream& os) const
{
os << projectSettingsFilePath << ", forceRefresh: " << std::boolalpha << forceRefresh;
os << projectSettingsFilePath.str() << ", forceRefresh: " << std::boolalpha << forceRefresh;
}
const std::string projectSettingsFilePath;
const FilePath projectSettingsFilePath;
const bool forceRefresh;
};
@@ -1,27 +0,0 @@
#ifndef MESSAGE_SAVE_PROJECT_H
#define MESSAGE_SAVE_PROJECT_H
#include "utility/messaging/Message.h"
class MessageSaveProject: public Message<MessageSaveProject>
{
public:
MessageSaveProject(const std::string& filePath)
: projectSettingsFilePath(filePath)
{
}
static const std::string getStaticType()
{
return "MessageSaveProject";
}
virtual void print(std::ostream& os) const
{
os << projectSettingsFilePath;
}
const std::string projectSettingsFilePath;
};
#endif // MESSAGE_SAVE_PROJECT_H