Project Management Overhaul (#47)
* Redo Project Management - Part 1 * Part 2 * Fix build * Cleanup
This commit is contained in:
parent
8d19877058
commit
c04aa72cd3
25 changed files with 427 additions and 759 deletions
|
@ -57,9 +57,9 @@ after_build:
|
||||||
|
|
||||||
copy /Y "C:\Tools\opencv\build\x64\vc14\bin\opencv_world412.dll" %CONFIGURATION%\Tahoma
|
copy /Y "C:\Tools\opencv\build\x64\vc14\bin\opencv_world412.dll" %CONFIGURATION%\Tahoma
|
||||||
|
|
||||||
mkdir "%CONFIGURATION%\Tahoma\portablestuff"
|
mkdir "%CONFIGURATION%\Tahoma\tahomastuff"
|
||||||
|
|
||||||
xcopy /Y /E ..\..\stuff "%CONFIGURATION%\Tahoma\portablestuff"
|
xcopy /Y /E ..\..\stuff "%CONFIGURATION%\Tahoma\tahomastuff"
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: toonz\$(PLATFORM)\$(CONFIGURATION)
|
- path: toonz\$(PLATFORM)\$(CONFIGURATION)
|
||||||
|
|
|
@ -4,94 +4,12 @@ HD 1080, 1920x1080, 16/9
|
||||||
|
|
||||||
HD 720, 1280x720, 16/9
|
HD 720, 1280x720, 16/9
|
||||||
|
|
||||||
HD 480, 853x480, 16/9
|
Square, 1000x1000, 1
|
||||||
|
|
||||||
AJA Fr01,1920x1080, 10x5.625, 16/9
|
Cinema 1080, 1920x803, 2.39
|
||||||
|
|
||||||
PAL analog, 768x576, 4/3
|
Cinema 2K, 2048x858, 2.39
|
||||||
|
|
||||||
PAL digital, 720x576, 4/3
|
Cinema 4K, 3840x1607, 2.39
|
||||||
|
|
||||||
PAL 16/9, 1024x576, 16/9
|
1K, 1024x768, 4/3
|
||||||
|
|
||||||
NTSC digital, 720x486, 4/3
|
|
||||||
|
|
||||||
NTSC analog, 648x486, 4/3
|
|
||||||
|
|
||||||
NTSC 16/9, 864x486, 16/9
|
|
||||||
|
|
||||||
Academy Full Frame1 1K, 914x666, 1.37
|
|
||||||
|
|
||||||
Academy Full Frame2 1K, 1024x746, 1.37
|
|
||||||
|
|
||||||
Academy Full Frame1 2K, 1828x1332, 1.37
|
|
||||||
|
|
||||||
Academy Full Frame2 2K, 2048x1494, 1.37
|
|
||||||
|
|
||||||
Academy Full Frame1 4K, 3656x2664, 1.37
|
|
||||||
|
|
||||||
Academy Full Frame2 4K, 4096x2988, 1.37
|
|
||||||
|
|
||||||
Full Camera Aperture 1K, 1024x768, 4/3
|
|
||||||
|
|
||||||
1K, 1024x768, 4/3
|
|
||||||
|
|
||||||
Full Camera Aperture 2K, 2048x1536, 4/3
|
|
||||||
|
|
||||||
2K, 2048x1536, 4/3
|
|
||||||
|
|
||||||
3K, 3072x2304, 4/3
|
|
||||||
|
|
||||||
Full Camera Aperture 4k, 4096x3072, 4/3
|
|
||||||
|
|
||||||
4K, 4096x3072, 4/3
|
|
||||||
|
|
||||||
Cineon Half Unsqueezed, 3675x1556, 2.36183
|
|
||||||
|
|
||||||
Cineon Half, 1828x1556, 2.35
|
|
||||||
|
|
||||||
Cineon Half Squeezed, 1828x1556, 2.36183
|
|
||||||
|
|
||||||
Cineon Full, 3656x3112, 2.35
|
|
||||||
|
|
||||||
Cineon Full, 4704x3112, 2.36183
|
|
||||||
|
|
||||||
Academy Projection1 1K, 914x550, 1.66
|
|
||||||
|
|
||||||
Academy Projection2 1K, 1024x617, 1.66
|
|
||||||
|
|
||||||
Academy Projection1 2K, 1828x1102, 1.66
|
|
||||||
|
|
||||||
Academy Projection2 2K, 2048x1229, 1.66
|
|
||||||
|
|
||||||
Academy Projection1 4K, 3656x2202, 1.66
|
|
||||||
|
|
||||||
Academy Projection2 4K, 4096x2468, 1.66
|
|
||||||
|
|
||||||
Academy Projection1 1K, 914x494, 1.85
|
|
||||||
|
|
||||||
Academy Projection2 1K, 1024x554, 1.85
|
|
||||||
|
|
||||||
Academy Projection1 2K, 1828x988, 1.85
|
|
||||||
|
|
||||||
Academy Projection2 2K, 2048x1107, 1.85
|
|
||||||
|
|
||||||
Academy Projection1 4K, 3656x1976, 1.85
|
|
||||||
|
|
||||||
Academy Projection2 4K, 4096x2214, 1.85
|
|
||||||
|
|
||||||
Anamorphic Pre-squeezed 1K, 914x774, 1.18
|
|
||||||
|
|
||||||
Anamorphic Pre-squeezed 2K, 1828x1550, 1.18
|
|
||||||
|
|
||||||
Anamorphic Pre-squeezed 4K, 3656x3098, 1.18
|
|
||||||
|
|
||||||
Anamorphic Un-squeezed 1K, 914x388, 2.35
|
|
||||||
|
|
||||||
Anamorphic Un-squeezed 2K, 1828x778, 2.35
|
|
||||||
|
|
||||||
Anamorphic Un-squeezed 4K, 3656x1556, 2.35
|
|
||||||
|
|
||||||
DCI 2K, 2048x1080, 256/135
|
|
||||||
|
|
||||||
DCI 4K, 4096x2160, 256/135
|
|
|
@ -15,12 +15,9 @@
|
||||||
<separator/>
|
<separator/>
|
||||||
<command>MI_LoadColorModel</command>
|
<command>MI_LoadColorModel</command>
|
||||||
<separator/>
|
<separator/>
|
||||||
<menu title="Project Management">
|
<command>MI_NewProject</command>
|
||||||
<command>MI_NewProject</command>
|
<separator/>
|
||||||
<command>MI_ProjectSettings</command>
|
<command>MI_SaveDefaultSettings</command>
|
||||||
<separator/>
|
|
||||||
<command>MI_SaveDefaultSettings</command>
|
|
||||||
</menu>
|
|
||||||
<separator/>
|
<separator/>
|
||||||
<menu title="Import">
|
<menu title="Import">
|
||||||
<command>MI_ImportMagpieFile</command>
|
<command>MI_ImportMagpieFile</command>
|
||||||
|
@ -313,6 +310,8 @@
|
||||||
<command>MI_StartupPopup</command>
|
<command>MI_StartupPopup</command>
|
||||||
<command>MI_OpenGuidedDrawingControls</command>
|
<command>MI_OpenGuidedDrawingControls</command>
|
||||||
<separator/>
|
<separator/>
|
||||||
|
<command>MI_OpenExport</command>
|
||||||
|
<separator/>
|
||||||
<command>MI_MaximizePanel</command>
|
<command>MI_MaximizePanel</command>
|
||||||
<command>MI_FullScreenWindow</command>
|
<command>MI_FullScreenWindow</command>
|
||||||
<separator/>
|
<separator/>
|
||||||
|
|
|
@ -143,7 +143,7 @@ public:
|
||||||
TFilePath getStuffDir() {
|
TFilePath getStuffDir() {
|
||||||
if (m_stuffDir) return *m_stuffDir;
|
if (m_stuffDir) return *m_stuffDir;
|
||||||
if (m_isPortable)
|
if (m_isPortable)
|
||||||
return TFilePath((getWorkingDirectory() + "\\portablestuff\\"));
|
return TFilePath((getWorkingDirectory() + "\\tahomastuff\\"));
|
||||||
|
|
||||||
return TFilePath(getSystemVarValue(m_rootVarName));
|
return TFilePath(getSystemVarValue(m_rootVarName));
|
||||||
}
|
}
|
||||||
|
@ -226,21 +226,20 @@ public:
|
||||||
m_workingDirectory = workingDirectory;
|
m_workingDirectory = workingDirectory;
|
||||||
|
|
||||||
// check if portable
|
// check if portable
|
||||||
TFilePath portableCheck =
|
TFilePath portableCheck = TFilePath(m_workingDirectory + "\\tahomastuff\\");
|
||||||
TFilePath(m_workingDirectory + "\\portablestuff\\");
|
|
||||||
TFileStatus portableStatus(portableCheck);
|
TFileStatus portableStatus(portableCheck);
|
||||||
m_isPortable = portableStatus.doesExist();
|
m_isPortable = portableStatus.doesExist();
|
||||||
|
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
// macOS 10.12 (Sierra) translocates applications before running them
|
// macOS 10.12 (Sierra) translocates applications before running them
|
||||||
// depending on how it was installed. This separates the app from the
|
// depending on how it was installed. This separates the app from the
|
||||||
// portablestuff folder and we don't know where it is so we stop treating it
|
// tahomastuff folder and we don't know where it is so we stop treating it
|
||||||
// as a portable. Placing portablestuff inside Tahoma.app will keep
|
// as a portable. Placing stuff inside Tahoma.app will keep
|
||||||
// everything together when it translocates.
|
// everything together when it translocates.
|
||||||
if (!m_isPortable) {
|
if (!m_isPortable) {
|
||||||
portableCheck =
|
portableCheck =
|
||||||
TFilePath(m_workingDirectory + "\\" + getApplicationFileName() +
|
TFilePath(m_workingDirectory + "\\" + getApplicationFileName() +
|
||||||
".app\\portablestuff\\");
|
".app\\tahomastuff\\");
|
||||||
portableStatus = TFileStatus(portableCheck);
|
portableStatus = TFileStatus(portableCheck);
|
||||||
m_isPortable = portableStatus.doesExist();
|
m_isPortable = portableStatus.doesExist();
|
||||||
if (m_isPortable)
|
if (m_isPortable)
|
||||||
|
|
|
@ -108,11 +108,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<TFilePath> m_projectsRoots;
|
// std::vector<TFilePath> m_projectsRoots;
|
||||||
std::vector<TFilePath> m_svnProjectsRoots;
|
std::vector<TFilePath> m_svnProjectsRoots;
|
||||||
std::set<Listener *> m_listeners;
|
std::set<Listener *> m_listeners;
|
||||||
|
|
||||||
void addDefaultProjectsRoot();
|
// void addDefaultProjectsRoot();
|
||||||
|
|
||||||
TProjectManager();
|
TProjectManager();
|
||||||
void notifyListeners();
|
void notifyListeners();
|
||||||
|
@ -135,12 +135,12 @@ public:
|
||||||
|
|
||||||
void saveTemplate(ToonzScene *scene);
|
void saveTemplate(ToonzScene *scene);
|
||||||
|
|
||||||
void addProjectsRoot(const TFilePath &fp);
|
// void addProjectsRoot(const TFilePath &fp);
|
||||||
void addSVNProjectsRoot(const TFilePath &fp);
|
void addSVNProjectsRoot(const TFilePath &fp);
|
||||||
|
|
||||||
//! returns the project root of the current project (if this fails, then
|
//! returns the project root of the current project (if this fails, then
|
||||||
//! returns the first project root)
|
//! returns the first project root)
|
||||||
TFilePath getCurrentProjectRoot();
|
// TFilePath getCurrentProjectRoot();
|
||||||
|
|
||||||
TFilePath projectPathToProjectName(const TFilePath &projectPath);
|
TFilePath projectPathToProjectName(const TFilePath &projectPath);
|
||||||
TFilePath projectNameToProjectPath(const TFilePath &projectName);
|
TFilePath projectNameToProjectPath(const TFilePath &projectName);
|
||||||
|
@ -166,9 +166,9 @@ public:
|
||||||
TFilePath getSandboxProjectFolder();
|
TFilePath getSandboxProjectFolder();
|
||||||
TFilePath getSandboxProjectPath();
|
TFilePath getSandboxProjectPath();
|
||||||
|
|
||||||
void getProjectRoots(std::vector<TFilePath> &projectRoots) const {
|
// void getProjectRoots(std::vector<TFilePath> &projectRoots) const {
|
||||||
projectRoots = m_projectsRoots;
|
// projectRoots = m_projectsRoots;
|
||||||
}
|
//}
|
||||||
|
|
||||||
bool isProject(const TFilePath &projectFolder);
|
bool isProject(const TFilePath &projectFolder);
|
||||||
};
|
};
|
||||||
|
|
|
@ -92,6 +92,7 @@ public:
|
||||||
void setValidator(const QValidator *v) { m_field->setValidator(v); }
|
void setValidator(const QValidator *v) { m_field->setValidator(v); }
|
||||||
QString getPath();
|
QString getPath();
|
||||||
void setPath(const QString &path);
|
void setPath(const QString &path);
|
||||||
|
LineEdit *getField() { return m_field; }
|
||||||
|
|
||||||
static void setBrowserPopupController(BrowserPopupController *controller);
|
static void setBrowserPopupController(BrowserPopupController *controller);
|
||||||
static BrowserPopupController *getBrowserPopupController();
|
static BrowserPopupController *getBrowserPopupController();
|
||||||
|
|
|
@ -523,17 +523,17 @@ int main(int argc, char *argv[]) {
|
||||||
TFilePath logFilePath = lRootDir + "tcleanup.log";
|
TFilePath logFilePath = lRootDir + "tcleanup.log";
|
||||||
TUserLogAppend m_userLog(logFilePath);
|
TUserLogAppend m_userLog(logFilePath);
|
||||||
|
|
||||||
TFilePathSet fps = ToonzFolder::getProjectsFolders();
|
// TFilePathSet fps = ToonzFolder::getProjectsFolders();
|
||||||
TFilePathSet::iterator fpIt;
|
// TFilePathSet::iterator fpIt;
|
||||||
for (fpIt = fps.begin(); fpIt != fps.end(); ++fpIt)
|
// for (fpIt = fps.begin(); fpIt != fps.end(); ++fpIt)
|
||||||
TProjectManager::instance()->addProjectsRoot(*fpIt);
|
// TProjectManager::instance()->addProjectsRoot(*fpIt);
|
||||||
|
|
||||||
TFilePath libraryFolder = ToonzFolder::getLibraryFolder();
|
TFilePath libraryFolder = ToonzFolder::getLibraryFolder();
|
||||||
TRasterImagePatternStrokeStyle::setRootDir(libraryFolder);
|
TRasterImagePatternStrokeStyle::setRootDir(libraryFolder);
|
||||||
TVectorImagePatternStrokeStyle::setRootDir(libraryFolder);
|
TVectorImagePatternStrokeStyle::setRootDir(libraryFolder);
|
||||||
TPalette::setRootDir(libraryFolder);
|
TPalette::setRootDir(libraryFolder);
|
||||||
TImageStyle::setLibraryDir(libraryFolder);
|
TImageStyle::setLibraryDir(libraryFolder);
|
||||||
TFilePath cacheRoot = ToonzFolder::getCacheRootFolder();
|
TFilePath cacheRoot = ToonzFolder::getCacheRootFolder();
|
||||||
if (cacheRoot.isEmpty()) cacheRoot = TEnv::getStuffDir() + "cache";
|
if (cacheRoot.isEmpty()) cacheRoot = TEnv::getStuffDir() + "cache";
|
||||||
TImageCache::instance()->setRootDir(cacheRoot);
|
TImageCache::instance()->setRootDir(cacheRoot);
|
||||||
|
|
||||||
|
@ -843,4 +843,3 @@ int main(int argc, char *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -713,10 +713,10 @@ int main(int argc, char *argv[]) {
|
||||||
TMeasureManager::instance()-> // Loads camera-related units
|
TMeasureManager::instance()-> // Loads camera-related units
|
||||||
addCameraMeasures(getCurrentCameraSize); //
|
addCameraMeasures(getCurrentCameraSize); //
|
||||||
|
|
||||||
TFilePathSet fps = ToonzFolder::getProjectsFolders();
|
// TFilePathSet fps = ToonzFolder::getProjectsFolders();
|
||||||
TFilePathSet::iterator fpIt;
|
// TFilePathSet::iterator fpIt;
|
||||||
for (fpIt = fps.begin(); fpIt != fps.end(); ++fpIt)
|
// for (fpIt = fps.begin(); fpIt != fps.end(); ++fpIt)
|
||||||
TProjectManager::instance()->addProjectsRoot(*fpIt);
|
// TProjectManager::instance()->addProjectsRoot(*fpIt);
|
||||||
|
|
||||||
TFilePath libraryFolder = ToonzFolder::getLibraryFolder();
|
TFilePath libraryFolder = ToonzFolder::getLibraryFolder();
|
||||||
TRasterImagePatternStrokeStyle::setRootDir(libraryFolder);
|
TRasterImagePatternStrokeStyle::setRootDir(libraryFolder);
|
||||||
|
|
|
@ -154,7 +154,7 @@ bool DvDirTreeViewDelegate::editorEvent(QEvent *ev, QAbstractItemModel *model,
|
||||||
m_treeView->expand(index);
|
m_treeView->expand(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pnode && pnode->isCurrent() == false && 14 < x && x < 26) ||
|
if ( //(pnode && pnode->isCurrent() == false && 14 < x && x < 26) ||
|
||||||
(vcpNode && vcpNode->isCurrent() == false && 14 < x && x < 26)) {
|
(vcpNode && vcpNode->isCurrent() == false && 14 < x && x < 26)) {
|
||||||
if (pnode)
|
if (pnode)
|
||||||
pnode->makeCurrent();
|
pnode->makeCurrent();
|
||||||
|
@ -212,7 +212,8 @@ void DvDirTreeViewDelegate::paint(QPainter *painter,
|
||||||
DvDirVersionControlNode *vcNode =
|
DvDirVersionControlNode *vcNode =
|
||||||
dynamic_cast<DvDirVersionControlNode *>(node);
|
dynamic_cast<DvDirVersionControlNode *>(node);
|
||||||
|
|
||||||
rect.adjust((pnode || vcpNode) ? 31 : 22, 0, 0, 0);
|
// rect.adjust((pnode || vcpNode) ? 31 : 22, 0, 0, 0);
|
||||||
|
rect.adjust((vcpNode) ? 31 : 22, 0, 0, 0);
|
||||||
|
|
||||||
// draw text
|
// draw text
|
||||||
QVariant d = index.data();
|
QVariant d = index.data();
|
||||||
|
@ -231,7 +232,8 @@ void DvDirTreeViewDelegate::paint(QPainter *painter,
|
||||||
painter->drawText(rect, Qt::AlignVCenter | Qt::AlignLeft, name);
|
painter->drawText(rect, Qt::AlignVCenter | Qt::AlignLeft, name);
|
||||||
|
|
||||||
// project folder node, version control node
|
// project folder node, version control node
|
||||||
if (pnode || vcpNode) {
|
// if (pnode || vcpNode) {
|
||||||
|
if (vcpNode) {
|
||||||
painter->setPen(m_treeView->getTextColor());
|
painter->setPen(m_treeView->getTextColor());
|
||||||
if ((pnode && pnode->isCurrent()) || (vcpNode && vcpNode->isCurrent()))
|
if ((pnode && pnode->isCurrent()) || (vcpNode && vcpNode->isCurrent()))
|
||||||
painter->setBrush(Qt::red);
|
painter->setBrush(Qt::red);
|
||||||
|
@ -302,6 +304,7 @@ void DvDirTreeViewDelegate::commitAndCloseEditor() {
|
||||||
FileBrowser *fileBrowser =
|
FileBrowser *fileBrowser =
|
||||||
dynamic_cast<FileBrowser *>(m_treeView->parentWidget());
|
dynamic_cast<FileBrowser *>(m_treeView->parentWidget());
|
||||||
if (fileBrowser) fileBrowser->onTreeFolderChanged();
|
if (fileBrowser) fileBrowser->onTreeFolderChanged();
|
||||||
|
emit(m_treeView->currentNodeChanged());
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ void ExportSceneDvDirModelRootNode::refreshChildren() {
|
||||||
//{
|
//{
|
||||||
TProjectManager *pm = TProjectManager::instance();
|
TProjectManager *pm = TProjectManager::instance();
|
||||||
std::vector<TFilePath> projectRoots;
|
std::vector<TFilePath> projectRoots;
|
||||||
pm->getProjectRoots(projectRoots);
|
// pm->getProjectRoots(projectRoots);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < (int)projectRoots.size(); i++) {
|
for (i = 0; i < (int)projectRoots.size(); i++) {
|
||||||
|
@ -264,7 +264,7 @@ DvDirModelNode *ExportSceneDvDirModel::getNode(const QModelIndex &index) const {
|
||||||
QModelIndex ExportSceneDvDirModel::index(int row, int column,
|
QModelIndex ExportSceneDvDirModel::index(int row, int column,
|
||||||
const QModelIndex &parent) const {
|
const QModelIndex &parent) const {
|
||||||
if (column != 0) return QModelIndex();
|
if (column != 0) return QModelIndex();
|
||||||
DvDirModelNode *parentNode = m_root;
|
DvDirModelNode *parentNode = m_root;
|
||||||
if (parent.isValid()) parentNode = getNode(parent);
|
if (parent.isValid()) parentNode = getNode(parent);
|
||||||
if (row < 0 || row >= parentNode->getChildCount()) return QModelIndex();
|
if (row < 0 || row >= parentNode->getChildCount()) return QModelIndex();
|
||||||
DvDirModelNode *node = parentNode->getChild(row);
|
DvDirModelNode *node = parentNode->getChild(row);
|
||||||
|
@ -454,9 +454,9 @@ ExportSceneTreeView::ExportSceneTreeView(QWidget *parent)
|
||||||
// bottom horizontal scrollbar to resize contents...
|
// bottom horizontal scrollbar to resize contents...
|
||||||
bool ret = connect(this, SIGNAL(expanded(const QModelIndex &)), this,
|
bool ret = connect(this, SIGNAL(expanded(const QModelIndex &)), this,
|
||||||
SLOT(resizeToConts()));
|
SLOT(resizeToConts()));
|
||||||
ret = ret && connect(this, SIGNAL(collapsed(const QModelIndex &)), this,
|
ret = ret && connect(this, SIGNAL(collapsed(const QModelIndex &)), this,
|
||||||
SLOT(resizeToConts()));
|
SLOT(resizeToConts()));
|
||||||
ret = ret && connect(this->model(), SIGNAL(layoutChanged()), this,
|
ret = ret && connect(this->model(), SIGNAL(layoutChanged()), this,
|
||||||
SLOT(resizeToConts()));
|
SLOT(resizeToConts()));
|
||||||
|
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
@ -672,16 +672,8 @@ TFilePath ExportScenePopup::createNewProject() {
|
||||||
return TFilePath();
|
return TFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
TFilePath currentProjectRoot;
|
TFilePath projectPath = pm->projectNameToProjectPath(projectName);
|
||||||
DvDirModelFileFolderNode *node = dynamic_cast<DvDirModelFileFolderNode *>(
|
TProject *project = new TProject();
|
||||||
m_projectTreeView->getCurrentNode());
|
|
||||||
if (node)
|
|
||||||
currentProjectRoot = node->getPath();
|
|
||||||
else
|
|
||||||
currentProjectRoot = pm->getCurrentProjectRoot();
|
|
||||||
TFilePath projectFolder = currentProjectRoot + projectName;
|
|
||||||
TFilePath projectPath = pm->projectFolderToProjectPath(projectFolder);
|
|
||||||
TProject *project = new TProject();
|
|
||||||
|
|
||||||
TProjectP currentProject = pm->getCurrentProject();
|
TProjectP currentProject = pm->getCurrentProject();
|
||||||
assert(currentProject);
|
assert(currentProject);
|
||||||
|
@ -690,7 +682,7 @@ TFilePath ExportScenePopup::createNewProject() {
|
||||||
project->setFolder(currentProject->getFolderName(i),
|
project->setFolder(currentProject->getFolderName(i),
|
||||||
currentProject->getFolder(i));
|
currentProject->getFolder(i));
|
||||||
project->save(projectPath);
|
project->save(projectPath);
|
||||||
DvDirModel::instance()->refreshFolder(currentProjectRoot);
|
DvDirModel::instance()->refreshFolder(projectPath.getParentDir());
|
||||||
|
|
||||||
return projectPath;
|
return projectPath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2067,8 +2067,10 @@ void FileBrowser::onSelectedItems(const std::set<int> &indexes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (it = indexes.begin(); it != indexes.end(); ++it) {
|
for (it = indexes.begin(); it != indexes.end(); ++it) {
|
||||||
filePaths.insert(m_items[*it].m_path);
|
if (*it < m_items.size()) {
|
||||||
frameIDs.insert(frameIDs.begin(), m_items[*it].m_frameIds);
|
filePaths.insert(m_items[*it].m_path);
|
||||||
|
frameIDs.insert(frameIDs.begin(), m_items[*it].m_frameIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reuse the list of TFrameId in order to skip loadInfo() when loading the
|
// reuse the list of TFrameId in order to skip loadInfo() when loading the
|
||||||
|
|
|
@ -217,7 +217,8 @@ DvDirModelFileFolderNode *DvDirModelFileFolderNode::createNode(
|
||||||
DvDirModelNode *parent, const TFilePath &path) {
|
DvDirModelNode *parent, const TFilePath &path) {
|
||||||
DvDirModelFileFolderNode *node;
|
DvDirModelFileFolderNode *node;
|
||||||
// check the project nodes under the Poject Root Node
|
// check the project nodes under the Poject Root Node
|
||||||
if (QString::fromStdWString(parent->getName()).startsWith("Project root") &&
|
if ( // QString::fromStdWString(parent->getName()).startsWith("Project root")
|
||||||
|
// &&
|
||||||
TProjectManager::instance()->isProject(path))
|
TProjectManager::instance()->isProject(path))
|
||||||
node = new DvDirModelProjectNode(parent, path);
|
node = new DvDirModelProjectNode(parent, path);
|
||||||
else {
|
else {
|
||||||
|
@ -1070,21 +1071,21 @@ void DvDirModelRootNode::refreshChildren() {
|
||||||
addChild(new DvDirModelHistoryNode(this));
|
addChild(new DvDirModelHistoryNode(this));
|
||||||
|
|
||||||
TProjectManager *pm = TProjectManager::instance();
|
TProjectManager *pm = TProjectManager::instance();
|
||||||
std::vector<TFilePath> projectRoots;
|
// std::vector<TFilePath> projectRoots;
|
||||||
pm->getProjectRoots(projectRoots);
|
// pm->getProjectRoots(projectRoots);
|
||||||
|
|
||||||
int i;
|
// int i;
|
||||||
for (i = 0; i < (int)projectRoots.size(); i++) {
|
// for (i = 0; i < (int)projectRoots.size(); i++) {
|
||||||
TFilePath projectRoot = projectRoots[i];
|
// TFilePath projectRoot = projectRoots[i];
|
||||||
std::wstring roothDir = projectRoot.getWideString();
|
// std::wstring roothDir = projectRoot.getWideString();
|
||||||
DvDirModelSpecialFileFolderNode *projectRootNode =
|
// DvDirModelSpecialFileFolderNode *projectRootNode =
|
||||||
new DvDirModelSpecialFileFolderNode(
|
// new DvDirModelSpecialFileFolderNode(
|
||||||
this, L"Project root (" + roothDir + L")", projectRoot);
|
// this, L"Project root (" + roothDir + L")", projectRoot);
|
||||||
projectRootNode->setPixmap(
|
// projectRootNode->setPixmap(
|
||||||
QPixmap(svgToPixmap(":Resources/projects.svg")));
|
// QPixmap(svgToPixmap(":Resources/projects.svg")));
|
||||||
m_projectRootNodes.push_back(projectRootNode);
|
// m_projectRootNodes.push_back(projectRootNode);
|
||||||
addChild(projectRootNode);
|
// addChild(projectRootNode);
|
||||||
}
|
//}
|
||||||
|
|
||||||
TFilePath sandboxProjectPath = pm->getSandboxProjectFolder();
|
TFilePath sandboxProjectPath = pm->getSandboxProjectFolder();
|
||||||
m_sandboxProjectNode = new DvDirModelProjectNode(this, sandboxProjectPath);
|
m_sandboxProjectNode = new DvDirModelProjectNode(this, sandboxProjectPath);
|
||||||
|
@ -1280,11 +1281,15 @@ void DvDirModel::onFolderChanged(const TFilePath &path) { refreshFolder(path); }
|
||||||
void DvDirModel::refresh(const QModelIndex &index) {
|
void DvDirModel::refresh(const QModelIndex &index) {
|
||||||
if (!index.isValid()) return;
|
if (!index.isValid()) return;
|
||||||
DvDirModelNode *node = getNode(index);
|
DvDirModelNode *node = getNode(index);
|
||||||
if (!node || node->getChildCount() < 1) return;
|
if (!node) return;
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
emit beginRemoveRows(index, 0, node->getChildCount() - 1);
|
bool emitBeginAndEnd = false;
|
||||||
|
int rc = rowCount(index);
|
||||||
|
int cc = node->getChildCount();
|
||||||
|
if (cc < rc) emitBeginAndEnd = true;
|
||||||
|
if (emitBeginAndEnd) emit beginRemoveRows(index, 0, node->getChildCount());
|
||||||
node->refreshChildren();
|
node->refreshChildren();
|
||||||
emit endRemoveRows();
|
if (emitBeginAndEnd) emit endRemoveRows();
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,8 +254,12 @@ void FileBrowserPopup::onOkPressed() {
|
||||||
} else {
|
} else {
|
||||||
if (!m_isDirectoryOnly)
|
if (!m_isDirectoryOnly)
|
||||||
pathSet.insert(*pt);
|
pathSet.insert(*pt);
|
||||||
else
|
else {
|
||||||
pathSet.insert(folder);
|
if (TFileStatus(*pt).isDirectory())
|
||||||
|
pathSet.insert(*pt);
|
||||||
|
else
|
||||||
|
pathSet.insert(folder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_multiSelectionEnabled) break;
|
if (!m_multiSelectionEnabled) break;
|
||||||
|
@ -300,8 +304,12 @@ void FileBrowserPopup::onApplyPressed() {
|
||||||
} else {
|
} else {
|
||||||
if (!m_isDirectoryOnly)
|
if (!m_isDirectoryOnly)
|
||||||
pathSet.insert(*it);
|
pathSet.insert(*it);
|
||||||
else
|
else {
|
||||||
|
// if (TFileStatus(*it).isDirectory())
|
||||||
|
// pathSet.insert(*it);
|
||||||
|
// else
|
||||||
pathSet.insert(folder);
|
pathSet.insert(folder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!m_multiSelectionEnabled) break;
|
if (!m_multiSelectionEnabled) break;
|
||||||
++it;
|
++it;
|
||||||
|
@ -338,8 +346,13 @@ void FileBrowserPopup::onFilePathsSelected(
|
||||||
QString text;
|
QString text;
|
||||||
if (!m_isDirectoryOnly)
|
if (!m_isDirectoryOnly)
|
||||||
text = QString::fromStdWString(fp.getLevelNameW());
|
text = QString::fromStdWString(fp.getLevelNameW());
|
||||||
else
|
else {
|
||||||
text = QString::fromStdWString(m_browser->getFolder().getWideString());
|
if (TFileStatus(fp).isDirectory())
|
||||||
|
text = fp.getQString();
|
||||||
|
else
|
||||||
|
text = QString::fromStdWString(m_browser->getFolder().getWideString());
|
||||||
|
}
|
||||||
|
std::string textStr = text.toStdString();
|
||||||
|
|
||||||
m_nameField->setText(text);
|
m_nameField->setText(text);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -1812,33 +1812,35 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
|
||||||
DVGui::warning(msg);
|
DVGui::warning(msg);
|
||||||
}
|
}
|
||||||
if (sceneProject && !sceneProject->isCurrent()) {
|
if (sceneProject && !sceneProject->isCurrent()) {
|
||||||
QString currentProjectName = QString::fromStdWString(
|
pm->setCurrentProjectPath(sceneProject->getProjectPath());
|
||||||
pm->getCurrentProject()->getName().getWideString());
|
// QString currentProjectName = QString::fromStdWString(
|
||||||
QString sceneProjectName =
|
// pm->getCurrentProject()->getName().getWideString());
|
||||||
QString::fromStdWString(sceneProject->getName().getWideString());
|
// QString sceneProjectName =
|
||||||
|
// QString::fromStdWString(sceneProject->getName().getWideString());
|
||||||
/*QString question = "The Scene '"
|
//
|
||||||
+ QString::fromStdWString(scenePath.getWideString())
|
// /*QString question = "The Scene '"
|
||||||
+ "' belongs to project '" + sceneProjectName + "'.\n"
|
// + QString::fromStdWString(scenePath.getWideString())
|
||||||
+ "What do you want to do?";*/
|
//+ "' belongs to project '" + sceneProjectName + "'.\n"
|
||||||
QString question =
|
//+ "What do you want to do?";*/
|
||||||
QObject::tr(
|
// QString question =
|
||||||
"The Scene '%1' belongs to project '%2'.\nWhat do you want to do?")
|
// QObject::tr(
|
||||||
.arg(QString::fromStdWString(scenePath.getWideString()))
|
// "The Scene '%1' belongs to project '%2'.\nWhat do you want to
|
||||||
.arg(sceneProjectName);
|
// do?")
|
||||||
QString importAnswer = QObject::tr("Import Scene");
|
// .arg(QString::fromStdWString(scenePath.getWideString()))
|
||||||
QString switchProjectAnswer = QObject::tr("Change Project");
|
// .arg(sceneProjectName);
|
||||||
QString cancelAnswer = QObject::tr("Cancel");
|
// QString importAnswer = QObject::tr("Import Scene");
|
||||||
int ret = DVGui::MsgBox(question, importAnswer, switchProjectAnswer,
|
// QString switchProjectAnswer = QObject::tr("Change Project");
|
||||||
cancelAnswer, 0);
|
// QString cancelAnswer = QObject::tr("Cancel");
|
||||||
if (ret == 3 || ret == 0) {
|
// int ret = DVGui::MsgBox(question, importAnswer, switchProjectAnswer,
|
||||||
newScene();
|
// cancelAnswer, 0);
|
||||||
return false;
|
// if (ret == 3 || ret == 0) {
|
||||||
}
|
// newScene();
|
||||||
if (ret == 2)
|
// return false;
|
||||||
pm->setCurrentProjectPath(sceneProject->getProjectPath());
|
// }
|
||||||
else
|
// if (ret == 2)
|
||||||
importScene = true;
|
// pm->setCurrentProjectPath(sceneProject->getProjectPath());
|
||||||
|
// else
|
||||||
|
// importScene = true;
|
||||||
}
|
}
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
|
|
|
@ -204,10 +204,10 @@ static void initToonzEnv(QHash<QString, QString> &argPathValues) {
|
||||||
/*--
|
/*--
|
||||||
* TOONZPROJECTSのパスセットを取得する。(TOONZPROJECTSはセミコロンで区切って複数設定可能)
|
* TOONZPROJECTSのパスセットを取得する。(TOONZPROJECTSはセミコロンで区切って複数設定可能)
|
||||||
* --*/
|
* --*/
|
||||||
TFilePathSet projectsRoots = ToonzFolder::getProjectsFolders();
|
// TFilePathSet projectsRoots = ToonzFolder::getProjectsFolders();
|
||||||
TFilePathSet::iterator it;
|
// TFilePathSet::iterator it;
|
||||||
for (it = projectsRoots.begin(); it != projectsRoots.end(); ++it)
|
// for (it = projectsRoots.begin(); it != projectsRoots.end(); ++it)
|
||||||
projectManager->addProjectsRoot(*it);
|
// projectManager->addProjectsRoot(*it);
|
||||||
|
|
||||||
/*-- もしまだ無ければ、TOONZROOT/sandboxにsandboxプロジェクトを作る --*/
|
/*-- もしまだ無ければ、TOONZROOT/sandboxにsandboxプロジェクトを作る --*/
|
||||||
projectManager->createSandboxIfNeeded();
|
projectManager->createSandboxIfNeeded();
|
||||||
|
|
|
@ -1665,9 +1665,9 @@ void MainWindow::defineActions() {
|
||||||
createMenuFileAction(MI_ImportMagpieFile,
|
createMenuFileAction(MI_ImportMagpieFile,
|
||||||
tr("&Import Toonz Lip Sync File..."), "");
|
tr("&Import Toonz Lip Sync File..."), "");
|
||||||
createMenuFileAction(MI_NewProject, tr("&New Project..."), "");
|
createMenuFileAction(MI_NewProject, tr("&New Project..."), "");
|
||||||
createMenuFileAction(MI_ProjectSettings, tr("&Project Settings..."), "");
|
// createMenuFileAction(MI_ProjectSettings, tr("&Project Settings..."), "");
|
||||||
createMenuFileAction(MI_SaveDefaultSettings, tr("&Save Default Settings"),
|
createMenuFileAction(MI_SaveDefaultSettings,
|
||||||
"");
|
tr("&Save Project Default Settings"), "");
|
||||||
createMenuRenderAction(MI_OutputSettings, tr("&Output Settings..."),
|
createMenuRenderAction(MI_OutputSettings, tr("&Output Settings..."),
|
||||||
"Ctrl+O");
|
"Ctrl+O");
|
||||||
createMenuRenderAction(MI_PreviewSettings, tr("&Preview Settings..."), "");
|
createMenuRenderAction(MI_PreviewSettings, tr("&Preview Settings..."), "");
|
||||||
|
|
|
@ -381,13 +381,13 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
addMenuItem(fileMenu, MI_LoadColorModel);
|
addMenuItem(fileMenu, MI_LoadColorModel);
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
QMenu *projectManagementMenu = fileMenu->addMenu(tr("Project Management"));
|
addMenuItem(fileMenu, MI_NewProject);
|
||||||
{
|
fileMenu->addSeparator();
|
||||||
addMenuItem(projectManagementMenu, MI_NewProject);
|
addMenuItem(fileMenu, MI_SaveDefaultSettings);
|
||||||
addMenuItem(projectManagementMenu, MI_ProjectSettings);
|
// QMenu *projectManagementMenu = fileMenu->addMenu(tr("Project Management"));
|
||||||
projectManagementMenu->addSeparator();
|
//{
|
||||||
addMenuItem(projectManagementMenu, MI_SaveDefaultSettings);
|
// //addMenuItem(projectManagementMenu, MI_ProjectSettings);
|
||||||
}
|
//}
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
QMenu *importMenu = fileMenu->addMenu(tr("Import"));
|
QMenu *importMenu = fileMenu->addMenu(tr("Import"));
|
||||||
{ addMenuItem(importMenu, MI_ImportMagpieFile); }
|
{ addMenuItem(importMenu, MI_ImportMagpieFile); }
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#define MI_NewNoteLevel "MI_NewNoteLevel"
|
#define MI_NewNoteLevel "MI_NewNoteLevel"
|
||||||
#define MI_RemoveEmptyColumns "MI_RemoveEmptyColumns"
|
#define MI_RemoveEmptyColumns "MI_RemoveEmptyColumns"
|
||||||
#define MI_NewProject "MI_NewProject"
|
#define MI_NewProject "MI_NewProject"
|
||||||
#define MI_ProjectSettings "MI_ProjectSettings"
|
//#define MI_ProjectSettings "MI_ProjectSettings"
|
||||||
#define MI_SaveDefaultSettings "MI_SaveDefaultSettings"
|
#define MI_SaveDefaultSettings "MI_SaveDefaultSettings"
|
||||||
#define MI_OutputSettings "MI_OutputSettings"
|
#define MI_OutputSettings "MI_OutputSettings"
|
||||||
#define MI_PreviewSettings "MI_PreviewSettings"
|
#define MI_PreviewSettings "MI_PreviewSettings"
|
||||||
|
|
|
@ -581,15 +581,15 @@ void PreferencesPopup::onAutoSavePeriodExternallyChanged() {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void PreferencesPopup::onProjectRootChanged() {
|
// void PreferencesPopup::onProjectRootChanged() {
|
||||||
int index = 0;
|
// int index = 0;
|
||||||
// if (m_projectRootStuff->isChecked())
|
// // if (m_projectRootStuff->isChecked())
|
||||||
index |= 0x08;
|
// index |= 0x08;
|
||||||
if (m_projectRootDocuments->isChecked()) index |= 0x04;
|
// if (m_projectRootDocuments->isChecked()) index |= 0x04;
|
||||||
if (m_projectRootDesktop->isChecked()) index |= 0x02;
|
// if (m_projectRootDesktop->isChecked()) index |= 0x02;
|
||||||
if (m_projectRootCustom->isChecked()) index |= 0x01;
|
// if (m_projectRootCustom->isChecked()) index |= 0x01;
|
||||||
m_pref->setValue(projectRoot, index);
|
// m_pref->setValue(projectRoot, index);
|
||||||
}
|
//}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void PreferencesPopup::onPixelUnitExternallySelected(bool on) {
|
void PreferencesPopup::onPixelUnitExternallySelected(bool on) {
|
||||||
|
@ -1253,21 +1253,21 @@ PreferencesPopup::PreferencesPopup()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
QWidget* PreferencesPopup::createGeneralPage() {
|
QWidget* PreferencesPopup::createGeneralPage() {
|
||||||
m_projectRootDocuments = new CheckBox(tr("My Documents/Tahoma*"), this);
|
// m_projectRootDocuments = new CheckBox(tr("My Documents/Tahoma*"), this);
|
||||||
m_projectRootDesktop = new CheckBox(tr("Desktop/Tahoma*"), this);
|
// m_projectRootDesktop = new CheckBox(tr("Desktop/Tahoma*"), this);
|
||||||
m_projectRootCustom = new CheckBox(tr("Custom*"), this);
|
// m_projectRootCustom = new CheckBox(tr("Custom*"), this);
|
||||||
QWidget* customField = new QWidget(this);
|
// QWidget* customField = new QWidget(this);
|
||||||
QGridLayout* customLay = new QGridLayout();
|
// QGridLayout* customLay = new QGridLayout();
|
||||||
setupLayout(customLay, 5);
|
// setupLayout(customLay, 5);
|
||||||
{
|
//{
|
||||||
insertUI(customProjectRoot, customLay);
|
// insertUI(customProjectRoot, customLay);
|
||||||
customLay->addWidget(
|
// customLay->addWidget(
|
||||||
new QLabel(
|
// new QLabel(
|
||||||
tr("Advanced: Multiple paths can be separated by ** (No Spaces)"),
|
// tr("Advanced: Multiple paths can be separated by ** (No Spaces)"),
|
||||||
this),
|
// this),
|
||||||
customLay->rowCount(), 0, 1, 2, Qt::AlignLeft | Qt::AlignVCenter);
|
// customLay->rowCount(), 0, 1, 2, Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
}
|
//}
|
||||||
customField->setLayout(customLay);
|
// customField->setLayout(customLay);
|
||||||
|
|
||||||
QWidget* widget = new QWidget(this);
|
QWidget* widget = new QWidget(this);
|
||||||
QGridLayout* lay = new QGridLayout();
|
QGridLayout* lay = new QGridLayout();
|
||||||
|
@ -1290,14 +1290,14 @@ QWidget* PreferencesPopup::createGeneralPage() {
|
||||||
insertUI(sceneNumberingEnabled, lay);
|
insertUI(sceneNumberingEnabled, lay);
|
||||||
insertUI(watchFileSystemEnabled, lay);
|
insertUI(watchFileSystemEnabled, lay);
|
||||||
|
|
||||||
QGridLayout* projectRootLay =
|
// QGridLayout* projectRootLay =
|
||||||
insertGroupBox(tr("Additional Project Locations"), lay);
|
// insertGroupBox(tr("Additional Project Locations"), lay);
|
||||||
{
|
//{
|
||||||
projectRootLay->addWidget(m_projectRootDocuments, 0, 0, 1, 2);
|
// projectRootLay->addWidget(m_projectRootDocuments, 0, 0, 1, 2);
|
||||||
projectRootLay->addWidget(m_projectRootDesktop, 1, 0, 1, 2);
|
// projectRootLay->addWidget(m_projectRootDesktop, 1, 0, 1, 2);
|
||||||
projectRootLay->addWidget(m_projectRootCustom, 2, 0, 1, 2);
|
// projectRootLay->addWidget(m_projectRootCustom, 2, 0, 1, 2);
|
||||||
projectRootLay->addWidget(customField, 3, 0, 1, 2);
|
// projectRootLay->addWidget(customField, 3, 0, 1, 2);
|
||||||
}
|
//}
|
||||||
|
|
||||||
insertUI(pathAliasPriority, lay, getComboItemList(pathAliasPriority));
|
insertUI(pathAliasPriority, lay, getComboItemList(pathAliasPriority));
|
||||||
|
|
||||||
|
@ -1305,11 +1305,11 @@ QWidget* PreferencesPopup::createGeneralPage() {
|
||||||
insertFootNote(lay);
|
insertFootNote(lay);
|
||||||
widget->setLayout(lay);
|
widget->setLayout(lay);
|
||||||
|
|
||||||
int projectPaths = m_pref->getIntValue(projectRoot);
|
// int projectPaths = m_pref->getIntValue(projectRoot);
|
||||||
m_projectRootDocuments->setChecked(projectPaths & 0x04);
|
// m_projectRootDocuments->setChecked(projectPaths & 0x04);
|
||||||
m_projectRootDesktop->setChecked(projectPaths & 0x02);
|
// m_projectRootDesktop->setChecked(projectPaths & 0x02);
|
||||||
m_projectRootCustom->setChecked(projectPaths & 0x01);
|
// m_projectRootCustom->setChecked(projectPaths & 0x01);
|
||||||
if (!(projectPaths & 0x01)) customField->hide();
|
// if (!(projectPaths & 0x01)) customField->hide();
|
||||||
|
|
||||||
QComboBox* pathAliasPriorityCB = getUI<QComboBox*>(pathAliasPriority);
|
QComboBox* pathAliasPriorityCB = getUI<QComboBox*>(pathAliasPriority);
|
||||||
pathAliasPriorityCB->setToolTip(
|
pathAliasPriorityCB->setToolTip(
|
||||||
|
@ -1341,14 +1341,15 @@ QWidget* PreferencesPopup::createGeneralPage() {
|
||||||
ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this,
|
ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this,
|
||||||
SLOT(onAutoSavePeriodExternallyChanged()));
|
SLOT(onAutoSavePeriodExternallyChanged()));
|
||||||
|
|
||||||
ret = ret && connect(m_projectRootDocuments, SIGNAL(stateChanged(int)),
|
// ret = ret && connect(m_projectRootDocuments, SIGNAL(stateChanged(int)),
|
||||||
SLOT(onProjectRootChanged()));
|
// SLOT(onProjectRootChanged()));
|
||||||
ret = ret && connect(m_projectRootDesktop, SIGNAL(stateChanged(int)),
|
// ret = ret && connect(m_projectRootDesktop, SIGNAL(stateChanged(int)),
|
||||||
SLOT(onProjectRootChanged()));
|
// SLOT(onProjectRootChanged()));
|
||||||
ret = ret && connect(m_projectRootCustom, SIGNAL(stateChanged(int)),
|
// ret = ret && connect(m_projectRootCustom, SIGNAL(stateChanged(int)),
|
||||||
SLOT(onProjectRootChanged()));
|
// SLOT(onProjectRootChanged()));
|
||||||
ret = ret && connect(m_projectRootCustom, SIGNAL(clicked(bool)), customField,
|
// ret = ret && connect(m_projectRootCustom, SIGNAL(clicked(bool)),
|
||||||
SLOT(setVisible(bool)));
|
// customField,
|
||||||
|
// SLOT(setVisible(bool)));
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
|
|
|
@ -68,8 +68,8 @@ private:
|
||||||
Preferences* m_pref;
|
Preferences* m_pref;
|
||||||
FormatProperties* m_formatProperties;
|
FormatProperties* m_formatProperties;
|
||||||
|
|
||||||
DVGui::CheckBox *m_projectRootDocuments, *m_projectRootDesktop,
|
// DVGui::CheckBox *m_projectRootDocuments, *m_projectRootDesktop,
|
||||||
*m_projectRootCustom;
|
// *m_projectRootCustom;
|
||||||
QPushButton* m_editLevelFormat;
|
QPushButton* m_editLevelFormat;
|
||||||
QComboBox* m_levelFormatNames;
|
QComboBox* m_levelFormatNames;
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ private slots:
|
||||||
|
|
||||||
void onAutoSaveExternallyChanged();
|
void onAutoSaveExternallyChanged();
|
||||||
void onAutoSavePeriodExternallyChanged();
|
void onAutoSavePeriodExternallyChanged();
|
||||||
void onProjectRootChanged();
|
// void onProjectRootChanged();
|
||||||
void onPixelUnitExternallySelected(bool on);
|
void onPixelUnitExternallySelected(bool on);
|
||||||
void onInterfaceFontChanged(const QString& text);
|
void onInterfaceFontChanged(const QString& text);
|
||||||
void onLutPathChanged();
|
void onLutPathChanged();
|
||||||
|
|
|
@ -28,239 +28,16 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
using namespace DVGui;
|
using namespace DVGui;
|
||||||
|
|
||||||
//=============================================================================
|
//===================================================================
|
||||||
// ProjectDvDirModelProjectNode
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QPixmap ProjectDvDirModelProjectNode::getPixmap(bool isOpen) const {
|
TFilePath getDocumentsPath() {
|
||||||
static QPixmap openProjectPixmap(
|
QString documentsPath =
|
||||||
svgToPixmap(":Resources/browser_project_open.svg"));
|
QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0];
|
||||||
static QPixmap closeProjectPixmap(
|
return TFilePath(documentsPath);
|
||||||
svgToPixmap(":Resources/browser_project_close.svg"));
|
|
||||||
return isOpen ? openProjectPixmap : closeProjectPixmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
// ProjectDvDirModelFileFolderNode [Root]
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
DvDirModelNode *ProjectDvDirModelFileFolderNode::makeChild(std::wstring name) {
|
|
||||||
return createNode(this, m_path + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
DvDirModelFileFolderNode *ProjectDvDirModelFileFolderNode::createNode(
|
|
||||||
DvDirModelNode *parent, const TFilePath &path) {
|
|
||||||
DvDirModelFileFolderNode *node;
|
|
||||||
if (TProjectManager::instance()->isProject(path))
|
|
||||||
node = new ProjectDvDirModelProjectNode(parent, path);
|
|
||||||
else
|
|
||||||
node = new ProjectDvDirModelFileFolderNode(parent, path);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
// ProjectDvDirModelSpecialFileFolderNode
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
// ProjectDvDirModelRootNode [Root]
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ProjectDvDirModelRootNode::ProjectDvDirModelRootNode()
|
|
||||||
: DvDirModelNode(0, L"Root") {
|
|
||||||
m_nodeType = "Root";
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ProjectDvDirModelRootNode::refreshChildren() {
|
|
||||||
m_childrenValid = true;
|
|
||||||
if (m_children.empty()) {
|
|
||||||
TProjectManager *pm = TProjectManager::instance();
|
|
||||||
std::vector<TFilePath> projectRoots;
|
|
||||||
pm->getProjectRoots(projectRoots);
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < (int)projectRoots.size(); i++) {
|
|
||||||
TFilePath projectRoot = projectRoots[i];
|
|
||||||
std::wstring rootDir = projectRoot.getWideString();
|
|
||||||
ProjectDvDirModelSpecialFileFolderNode *projectRootNode =
|
|
||||||
new ProjectDvDirModelSpecialFileFolderNode(
|
|
||||||
this, L"Project root (" + rootDir + L")", projectRoot);
|
|
||||||
projectRootNode->setPixmap(svgToPixmap(":Resources/projects.svg"));
|
|
||||||
addChild(projectRootNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// SVN Repository
|
|
||||||
QList<SVNRepository> repositories =
|
|
||||||
VersionControl::instance()->getRepositories();
|
|
||||||
int count = repositories.size();
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
SVNRepository repo = repositories.at(i);
|
|
||||||
|
|
||||||
ProjectDvDirModelSpecialFileFolderNode *node =
|
|
||||||
new ProjectDvDirModelSpecialFileFolderNode(
|
|
||||||
this, repo.m_name.toStdWString(),
|
|
||||||
TFilePath(repo.m_localPath.toStdWString()));
|
|
||||||
node->setPixmap(svgToPixmap(":Resources/vcroot.svg"));
|
|
||||||
addChild(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
// ProjectDirModel
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ProjectDirModel::ProjectDirModel() {
|
|
||||||
m_root = new ProjectDvDirModelRootNode();
|
|
||||||
m_root->refreshChildren();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ProjectDirModel::~ProjectDirModel() { delete m_root; }
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
DvDirModelNode *ProjectDirModel::getNode(const QModelIndex &index) const {
|
|
||||||
if (index.isValid())
|
|
||||||
return static_cast<DvDirModelNode *>(index.internalPointer());
|
|
||||||
else
|
|
||||||
return m_root;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QModelIndex ProjectDirModel::index(int row, int column,
|
|
||||||
const QModelIndex &parent) const {
|
|
||||||
if (column != 0) return QModelIndex();
|
|
||||||
DvDirModelNode *parentNode = m_root;
|
|
||||||
if (parent.isValid()) parentNode = getNode(parent);
|
|
||||||
if (row < 0 || row >= parentNode->getChildCount()) return QModelIndex();
|
|
||||||
DvDirModelNode *node = parentNode->getChild(row);
|
|
||||||
return createIndex(row, column, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QModelIndex ProjectDirModel::parent(const QModelIndex &index) const {
|
|
||||||
if (!index.isValid()) return QModelIndex();
|
|
||||||
DvDirModelNode *node = getNode(index);
|
|
||||||
DvDirModelNode *parentNode = node->getParent();
|
|
||||||
if (!parentNode || parentNode == m_root)
|
|
||||||
return QModelIndex();
|
|
||||||
else
|
|
||||||
return createIndex(parentNode->getRow(), 0, parentNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QModelIndex ProjectDirModel::childByName(const QModelIndex &parent,
|
|
||||||
const std::wstring &name) const {
|
|
||||||
if (!parent.isValid()) return QModelIndex();
|
|
||||||
DvDirModelNode *parentNode = getNode(parent);
|
|
||||||
if (!parentNode) return QModelIndex();
|
|
||||||
int row = parentNode->rowByName(name);
|
|
||||||
if (row < 0 || row >= parentNode->getChildCount()) return QModelIndex();
|
|
||||||
DvDirModelNode *childNode = parentNode->getChild(row);
|
|
||||||
return createIndex(row, 0, childNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int ProjectDirModel::rowCount(const QModelIndex &parent) const {
|
|
||||||
DvDirModelNode *node = getNode(parent);
|
|
||||||
int childCount = node->getChildCount();
|
|
||||||
return childCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QVariant ProjectDirModel::data(const QModelIndex &index, int role) const {
|
|
||||||
if (!index.isValid()) return QVariant();
|
|
||||||
DvDirModelNode *node = getNode(index);
|
|
||||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
|
||||||
return QString::fromStdWString(node->getName());
|
|
||||||
else if (role == Qt::DecorationRole) {
|
|
||||||
return QVariant();
|
|
||||||
} else if (role == Qt::ForegroundRole) {
|
|
||||||
if (!node || !node->isRenameEnabled())
|
|
||||||
return QBrush(Qt::blue);
|
|
||||||
else
|
|
||||||
return QVariant();
|
|
||||||
} else
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Qt::ItemFlags ProjectDirModel::flags(const QModelIndex &index) const {
|
|
||||||
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
|
|
||||||
if (index.isValid()) {
|
|
||||||
DvDirModelNode *node = getNode(index);
|
|
||||||
if (node && node->isRenameEnabled()) flags |= Qt::ItemIsEditable;
|
|
||||||
}
|
|
||||||
return flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool ProjectDirModel::setData(const QModelIndex &index, const QVariant &value,
|
|
||||||
int role) {
|
|
||||||
if (!index.isValid()) return false;
|
|
||||||
DvDirModelNode *node = getNode(index);
|
|
||||||
if (!node || !node->isRenameEnabled()) return false;
|
|
||||||
QString newName = value.toString();
|
|
||||||
if (newName == "") return false;
|
|
||||||
if (!node->setName(newName.toStdWString())) return false;
|
|
||||||
emit dataChanged(index, index);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool ProjectDirModel::hasChildren(const QModelIndex &parent) const {
|
|
||||||
DvDirModelNode *node = getNode(parent);
|
|
||||||
return node->hasChildren();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ProjectDirModel::refresh(const QModelIndex &index) {
|
|
||||||
if (!index.isValid()) return;
|
|
||||||
DvDirModelNode *node = getNode(index);
|
|
||||||
if (!node) return;
|
|
||||||
emit layoutAboutToBeChanged();
|
|
||||||
emit beginRemoveRows(index, 0, node->getChildCount());
|
|
||||||
node->refreshChildren();
|
|
||||||
emit endRemoveRows();
|
|
||||||
emit layoutChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ProjectDirModel::refreshFolderChild(const QModelIndex &i) {
|
|
||||||
DvDirModelNode *node = getNode(i);
|
|
||||||
if (!node || !node->areChildrenValid()) return;
|
|
||||||
|
|
||||||
if (node->isFolder() || dynamic_cast<DvDirModelMyComputerNode *>(node))
|
|
||||||
refresh(i);
|
|
||||||
int count = rowCount(i);
|
|
||||||
int r;
|
|
||||||
for (r = 0; r < count; r++) refreshFolderChild(index(r, 0, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QModelIndex ProjectDirModel::getIndexByNode(DvDirModelNode *node) const {
|
|
||||||
if (!node) return QModelIndex();
|
|
||||||
return createIndex(node->getRow(), 0, node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -271,35 +48,31 @@ ProjectPopup::ProjectPopup(bool isModal)
|
||||||
: Dialog(TApp::instance()->getMainWindow(), isModal, false, "Project") {
|
: Dialog(TApp::instance()->getMainWindow(), isModal, false, "Project") {
|
||||||
TProjectManager *pm = TProjectManager::instance();
|
TProjectManager *pm = TProjectManager::instance();
|
||||||
|
|
||||||
m_choosePrjLabel = new QLabel(tr("Project:"), this);
|
m_choosePrjLabel = new QLabel(tr("Project:"), this);
|
||||||
m_chooseProjectCombo = new QComboBox();
|
m_prjNameLabel = new QLabel(tr("Project Name:"), this);
|
||||||
m_prjNameLabel = new QLabel(tr("Project Name:"), this);
|
m_nameFld = new LineEdit();
|
||||||
m_nameFld = new LineEdit();
|
|
||||||
m_model = new ProjectDirModel;
|
m_projectLocationFld =
|
||||||
m_treeView = new DvDirTreeView(this);
|
new DVGui::FileField(this, getDocumentsPath().getQString());
|
||||||
|
|
||||||
m_nameFld->setMaximumHeight(WidgetHeight);
|
m_nameFld->setMaximumHeight(WidgetHeight);
|
||||||
m_treeView->setModel(m_model);
|
|
||||||
m_treeView->setStyleSheet("border:1px solid rgb(120,120,120);");
|
|
||||||
|
|
||||||
//----layout
|
//----layout
|
||||||
m_topLayout->setMargin(5);
|
m_topLayout->setMargin(5);
|
||||||
m_topLayout->setSpacing(10);
|
m_topLayout->setSpacing(10);
|
||||||
{
|
{
|
||||||
m_topLayout->addWidget(m_treeView, 0);
|
|
||||||
|
|
||||||
QGridLayout *upperLayout = new QGridLayout();
|
QGridLayout *upperLayout = new QGridLayout();
|
||||||
upperLayout->setMargin(5);
|
upperLayout->setMargin(5);
|
||||||
upperLayout->setHorizontalSpacing(5);
|
upperLayout->setHorizontalSpacing(5);
|
||||||
upperLayout->setVerticalSpacing(10);
|
upperLayout->setVerticalSpacing(10);
|
||||||
{
|
{
|
||||||
upperLayout->addWidget(m_choosePrjLabel, 0, 0,
|
upperLayout->addWidget(m_prjNameLabel, 0, 0,
|
||||||
Qt::AlignRight | Qt::AlignVCenter);
|
Qt::AlignRight | Qt::AlignVCenter);
|
||||||
upperLayout->addWidget(m_chooseProjectCombo, 0, 1);
|
upperLayout->addWidget(m_nameFld, 0, 1);
|
||||||
|
|
||||||
upperLayout->addWidget(m_prjNameLabel, 1, 0,
|
upperLayout->addWidget(new QLabel(tr("Create Project In:"), this), 1, 0,
|
||||||
Qt::AlignRight | Qt::AlignVCenter);
|
Qt::AlignRight | Qt::AlignVCenter);
|
||||||
upperLayout->addWidget(m_nameFld, 1, 1);
|
upperLayout->addWidget(m_projectLocationFld, 1, 1);
|
||||||
}
|
}
|
||||||
upperLayout->setColumnStretch(0, 0);
|
upperLayout->setColumnStretch(0, 0);
|
||||||
upperLayout->setColumnStretch(1, 1);
|
upperLayout->setColumnStretch(1, 1);
|
||||||
|
@ -312,9 +85,10 @@ ProjectPopup::ProjectPopup(bool isModal)
|
||||||
QString qName = QString::fromStdString(name);
|
QString qName = QString::fromStdString(name);
|
||||||
FileField *ff = new FileField(0, qName);
|
FileField *ff = new FileField(0, qName);
|
||||||
m_folderFlds.append(qMakePair(name, ff));
|
m_folderFlds.append(qMakePair(name, ff));
|
||||||
upperLayout->addWidget(new QLabel("+" + qName, this), i + 2, 0,
|
// upperLayout->addWidget(new QLabel("+" + qName, this), i + 2, 0,
|
||||||
Qt::AlignRight | Qt::AlignVCenter);
|
// Qt::AlignRight | Qt::AlignVCenter);
|
||||||
upperLayout->addWidget(ff, i + 2, 1);
|
upperLayout->addWidget(ff, i + 3, 1);
|
||||||
|
ff->hide();
|
||||||
}
|
}
|
||||||
std::vector<std::tuple<QString, std::string>> cbs = {
|
std::vector<std::tuple<QString, std::string>> cbs = {
|
||||||
std::make_tuple(tr("Append $scenepath to +drawings"),
|
std::make_tuple(tr("Append $scenepath to +drawings"),
|
||||||
|
@ -330,6 +104,7 @@ ProjectPopup::ProjectPopup(bool isModal)
|
||||||
cb->setMaximumHeight(WidgetHeight);
|
cb->setMaximumHeight(WidgetHeight);
|
||||||
upperLayout->addWidget(cb, currentRow + i, 1);
|
upperLayout->addWidget(cb, currentRow + i, 1);
|
||||||
m_useScenePathCbs.append(qMakePair(folderName, cb));
|
m_useScenePathCbs.append(qMakePair(folderName, cb));
|
||||||
|
cb->hide();
|
||||||
}
|
}
|
||||||
m_topLayout->addLayout(upperLayout);
|
m_topLayout->addLayout(upperLayout);
|
||||||
}
|
}
|
||||||
|
@ -339,51 +114,6 @@ ProjectPopup::ProjectPopup(bool isModal)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ProjectPopup::updateChooseProjectCombo() {
|
|
||||||
m_projectPaths.clear();
|
|
||||||
m_chooseProjectCombo->clear();
|
|
||||||
|
|
||||||
TProjectManager *pm = TProjectManager::instance();
|
|
||||||
|
|
||||||
TFilePath sandboxFp = pm->getSandboxProjectFolder() + "sandbox_otprj.xml";
|
|
||||||
m_projectPaths.push_back(sandboxFp);
|
|
||||||
m_chooseProjectCombo->addItem("sandbox");
|
|
||||||
|
|
||||||
std::vector<TFilePath> prjRoots;
|
|
||||||
pm->getProjectRoots(prjRoots);
|
|
||||||
for (int i = 0; i < prjRoots.size(); i++) {
|
|
||||||
TFilePathSet fps;
|
|
||||||
TSystem::readDirectory_Dir_ReadExe(fps, prjRoots[i]);
|
|
||||||
|
|
||||||
TFilePathSet::iterator it;
|
|
||||||
for (it = fps.begin(); it != fps.end(); ++it) {
|
|
||||||
TFilePath fp(*it);
|
|
||||||
if (pm->isProject(fp)) {
|
|
||||||
m_projectPaths.push_back(pm->projectFolderToProjectPath(fp));
|
|
||||||
TFilePath prjFile = pm->getProjectPathByProjectFolder(fp);
|
|
||||||
m_chooseProjectCombo->addItem(
|
|
||||||
QString::fromStdString(prjFile.getName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add in project of current project if outside known Project root folders
|
|
||||||
TProjectP currentProject = pm->getCurrentProject();
|
|
||||||
TFilePath currentProjectFP = currentProject->getProjectPath();
|
|
||||||
if (m_projectPaths.indexOf(currentProjectFP) == -1) {
|
|
||||||
m_projectPaths.push_back(currentProjectFP);
|
|
||||||
m_chooseProjectCombo->addItem(
|
|
||||||
QString::fromStdString(currentProject->getName().getName()));
|
|
||||||
}
|
|
||||||
for (int i = 0; i < m_projectPaths.size(); i++) {
|
|
||||||
if (pm->getCurrentProjectPath() == m_projectPaths[i]) {
|
|
||||||
m_chooseProjectCombo->setCurrentIndex(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ProjectPopup::updateFieldsFromProject(TProject *project) {
|
void ProjectPopup::updateFieldsFromProject(TProject *project) {
|
||||||
m_nameFld->setText(toQString(project->getName()));
|
m_nameFld->setText(toQString(project->getName()));
|
||||||
int i;
|
int i;
|
||||||
|
@ -431,13 +161,8 @@ void ProjectPopup::onProjectSwitched() {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ProjectPopup::showEvent(QShowEvent *) {
|
void ProjectPopup::showEvent(QShowEvent *) {
|
||||||
// Must refresh the tree.
|
|
||||||
DvDirModelNode *rootNode = m_model->getNode(QModelIndex());
|
|
||||||
QModelIndex index = m_model->getIndexByNode(rootNode);
|
|
||||||
m_model->refreshFolderChild(index);
|
|
||||||
TProjectP currentProject = TProjectManager::instance()->getCurrentProject();
|
TProjectP currentProject = TProjectManager::instance()->getCurrentProject();
|
||||||
updateFieldsFromProject(currentProject.getPointer());
|
updateFieldsFromProject(currentProject.getPointer());
|
||||||
updateChooseProjectCombo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -455,9 +180,7 @@ ProjectSettingsPopup::ProjectSettingsPopup() : ProjectPopup(false) {
|
||||||
m_prjNameLabel->hide();
|
m_prjNameLabel->hide();
|
||||||
m_nameFld->hide();
|
m_nameFld->hide();
|
||||||
m_choosePrjLabel->show();
|
m_choosePrjLabel->show();
|
||||||
m_chooseProjectCombo->show();
|
|
||||||
|
|
||||||
m_treeView->hide();
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_folderFlds.size(); i++) {
|
for (i = 0; i < m_folderFlds.size(); i++) {
|
||||||
FileField *ff = m_folderFlds[i].second;
|
FileField *ff = m_folderFlds[i].second;
|
||||||
|
@ -468,31 +191,6 @@ ProjectSettingsPopup::ProjectSettingsPopup() : ProjectPopup(false) {
|
||||||
connect(cb, SIGNAL(stateChanged(int)), this,
|
connect(cb, SIGNAL(stateChanged(int)), this,
|
||||||
SLOT(onUseSceneChekboxChanged(int)));
|
SLOT(onUseSceneChekboxChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_chooseProjectCombo, SIGNAL(activated(int)), this,
|
|
||||||
SLOT(onChooseProjectChanged(int)));
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ProjectSettingsPopup::onChooseProjectChanged(int index) {
|
|
||||||
TFilePath projectFp = m_projectPaths[index];
|
|
||||||
|
|
||||||
TProjectManager *pm = TProjectManager::instance();
|
|
||||||
pm->setCurrentProjectPath(projectFp);
|
|
||||||
|
|
||||||
TProject *projectP =
|
|
||||||
TProjectManager::instance()->getCurrentProject().getPointer();
|
|
||||||
|
|
||||||
// In case the project file was upgraded to current version, save it now
|
|
||||||
if (projectP->getProjectPath() != projectFp) {
|
|
||||||
m_projectPaths[index] = projectP->getProjectPath();
|
|
||||||
projectP->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateFieldsFromProject(projectP);
|
|
||||||
IoCmd::saveSceneIfNeeded("Change project");
|
|
||||||
IoCmd::newScene();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -525,8 +223,8 @@ void ProjectSettingsPopup::onUseSceneChekboxChanged(int) {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
OpenPopupCommandHandler<ProjectSettingsPopup> openProjectSettingsPopup(
|
// OpenPopupCommandHandler<ProjectSettingsPopup> openProjectSettingsPopup(
|
||||||
MI_ProjectSettings);
|
// MI_ProjectSettings);
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*! \class ProjectCreatePopup
|
/*! \class ProjectCreatePopup
|
||||||
|
@ -557,7 +255,6 @@ ProjectCreatePopup::ProjectCreatePopup() : ProjectPopup(true) {
|
||||||
m_prjNameLabel->show();
|
m_prjNameLabel->show();
|
||||||
m_nameFld->show();
|
m_nameFld->show();
|
||||||
m_choosePrjLabel->hide();
|
m_choosePrjLabel->hide();
|
||||||
m_chooseProjectCombo->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -590,23 +287,25 @@ void ProjectCreatePopup::createProject() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pm->getProjectPathByName(projectName) != TFilePath()) {
|
// if (pm->getProjectPathByName(projectName) != TFilePath()) {
|
||||||
|
// error(tr("Project '%1' already exists").arg(m_nameFld->text()));
|
||||||
|
// // project already exists
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
TFilePath newLocation = TFilePath(m_projectLocationFld->getPath());
|
||||||
|
std::string newLocStr = newLocation.getQString().toStdString();
|
||||||
|
TFilePath projectFolder = newLocation + projectName;
|
||||||
|
TFilePath projectPath = pm->projectFolderToProjectPath(projectFolder);
|
||||||
|
std::string projectPathStr = projectPath.getQString().toStdString();
|
||||||
|
|
||||||
|
if (TSystem::doesExistFileOrLevel(projectPath)) {
|
||||||
error(tr("Project '%1' already exists").arg(m_nameFld->text()));
|
error(tr("Project '%1' already exists").arg(m_nameFld->text()));
|
||||||
// project already exists
|
// project already exists
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFilePath currentProjectRoot;
|
TProject *project = new TProject();
|
||||||
DvDirModelFileFolderNode *node =
|
|
||||||
dynamic_cast<DvDirModelFileFolderNode *>(m_treeView->getCurrentNode());
|
|
||||||
if (node)
|
|
||||||
currentProjectRoot = node->getPath();
|
|
||||||
else
|
|
||||||
currentProjectRoot = pm->getCurrentProjectRoot();
|
|
||||||
|
|
||||||
TFilePath projectFolder = currentProjectRoot + projectName;
|
|
||||||
TFilePath projectPath = pm->projectFolderToProjectPath(projectFolder);
|
|
||||||
TProject *project = new TProject();
|
|
||||||
updateProjectFromFields(project);
|
updateProjectFromFields(project);
|
||||||
TProjectP currentProject = pm->getCurrentProject();
|
TProjectP currentProject = pm->getCurrentProject();
|
||||||
project->setSceneProperties(currentProject->getSceneProperties());
|
project->setSceneProperties(currentProject->getSceneProperties());
|
||||||
|
@ -642,15 +341,20 @@ void ProjectCreatePopup::showEvent(QShowEvent *) {
|
||||||
}
|
}
|
||||||
|
|
||||||
m_nameFld->setText("");
|
m_nameFld->setText("");
|
||||||
// Must refresh the tree.
|
|
||||||
DvDirModelNode *rootNode = m_model->getNode(QModelIndex());
|
resize(600, 150);
|
||||||
QModelIndex index = m_model->getIndexByNode(rootNode);
|
QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
m_model->refreshFolderChild(index);
|
sizePolicy.setHorizontalStretch(0);
|
||||||
// Select the first Item in the treeView
|
sizePolicy.setVerticalStretch(0);
|
||||||
QItemSelectionModel *selection = new QItemSelectionModel(m_model);
|
setSizePolicy(sizePolicy);
|
||||||
index = m_model->index(0, 0, QModelIndex());
|
setMinimumSize(QSize(600, 150));
|
||||||
selection->select(index, QItemSelectionModel::Select);
|
setMaximumSize(QSize(600, 150));
|
||||||
m_treeView->setSelectionModel(selection);
|
setFixedSize(width(), height());
|
||||||
|
setSizeGripEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectCreatePopup::setPath(QString path) {
|
||||||
|
m_projectLocationFld->setPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -107,16 +107,14 @@ class ProjectPopup : public DVGui::Dialog, public TProjectManager::Listener {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ProjectDirModel *m_model;
|
|
||||||
DvDirTreeView *m_treeView;
|
|
||||||
DVGui::LineEdit *m_nameFld;
|
DVGui::LineEdit *m_nameFld;
|
||||||
QList<QPair<std::string, DVGui::FileField *>> m_folderFlds;
|
QList<QPair<std::string, DVGui::FileField *>> m_folderFlds;
|
||||||
QList<QPair<std::string, DVGui::CheckBox *>> m_useScenePathCbs;
|
QList<QPair<std::string, DVGui::CheckBox *>> m_useScenePathCbs;
|
||||||
|
|
||||||
QLabel *m_prjNameLabel;
|
QLabel *m_prjNameLabel;
|
||||||
QLabel *m_choosePrjLabel;
|
QLabel *m_choosePrjLabel;
|
||||||
QComboBox *m_chooseProjectCombo;
|
|
||||||
QList<TFilePath> m_projectPaths;
|
DVGui::FileField *m_projectLocationFld;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ProjectPopup(bool isModal);
|
ProjectPopup(bool isModal);
|
||||||
|
@ -128,8 +126,6 @@ public:
|
||||||
void updateProjectFromFields(TProject *);
|
void updateProjectFromFields(TProject *);
|
||||||
void updateFieldsFromProject(TProject *);
|
void updateFieldsFromProject(TProject *);
|
||||||
|
|
||||||
void updateChooseProjectCombo();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *) override;
|
void showEvent(QShowEvent *) override;
|
||||||
};
|
};
|
||||||
|
@ -147,8 +143,6 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void onFolderChanged();
|
void onFolderChanged();
|
||||||
void onUseSceneChekboxChanged(int);
|
void onUseSceneChekboxChanged(int);
|
||||||
|
|
||||||
void onChooseProjectChanged(int);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -160,6 +154,7 @@ class ProjectCreatePopup final : public ProjectPopup {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ProjectCreatePopup();
|
ProjectCreatePopup();
|
||||||
|
void setPath(QString path);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void createProject();
|
void createProject();
|
||||||
|
|
|
@ -11,11 +11,13 @@
|
||||||
#include "menubarcommandids.h"
|
#include "menubarcommandids.h"
|
||||||
#include "tenv.h"
|
#include "tenv.h"
|
||||||
#include "toonz/stage.h"
|
#include "toonz/stage.h"
|
||||||
|
#include "projectpopup.h"
|
||||||
|
|
||||||
// TnzQt includes
|
// TnzQt includes
|
||||||
#include "toonzqt/menubarcommand.h"
|
#include "toonzqt/menubarcommand.h"
|
||||||
#include "toonzqt/gutil.h"
|
#include "toonzqt/gutil.h"
|
||||||
#include "toonzqt/doublefield.h"
|
#include "toonzqt/doublefield.h"
|
||||||
|
#include "toonzqt/lineedit.h"
|
||||||
|
|
||||||
// TnzLib includes
|
// TnzLib includes
|
||||||
#include "toonz/toonzscene.h"
|
#include "toonz/toonzscene.h"
|
||||||
|
@ -99,8 +101,14 @@ StartupPopup::StartupPopup()
|
||||||
m_sceneBox = new QGroupBox(tr("Create a New Scene"), this);
|
m_sceneBox = new QGroupBox(tr("Create a New Scene"), this);
|
||||||
m_recentBox = new QGroupBox(tr("Recent Scenes [Project]"), this);
|
m_recentBox = new QGroupBox(tr("Recent Scenes [Project]"), this);
|
||||||
m_projectBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
m_projectBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
m_nameFld = new LineEdit(this);
|
m_nameFld = new LineEdit(this);
|
||||||
m_pathFld = new FileField(this);
|
m_pathFld = new FileField(this);
|
||||||
|
m_projectLocationFld = new FileField(this);
|
||||||
|
QString currProjectPath = TProjectManager::instance()
|
||||||
|
->getCurrentProjectPath()
|
||||||
|
.getParentDir()
|
||||||
|
.getQString();
|
||||||
|
m_projectLocationFld->setPath(currProjectPath);
|
||||||
m_sceneNameLabel = new QLabel(tr("Scene Name:"));
|
m_sceneNameLabel = new QLabel(tr("Scene Name:"));
|
||||||
m_widthLabel = new QLabel(tr("Width:"), this);
|
m_widthLabel = new QLabel(tr("Width:"), this);
|
||||||
m_widthFld = new MeasuredDoubleLineEdit(this);
|
m_widthFld = new MeasuredDoubleLineEdit(this);
|
||||||
|
@ -126,7 +134,6 @@ StartupPopup::StartupPopup()
|
||||||
QPushButton *newProjectButton = new QPushButton(tr("New Project..."), this);
|
QPushButton *newProjectButton = new QPushButton(tr("New Project..."), this);
|
||||||
QPushButton *loadOtherSceneButton =
|
QPushButton *loadOtherSceneButton =
|
||||||
new QPushButton(tr("Open Another Scene..."), this);
|
new QPushButton(tr("Open Another Scene..."), this);
|
||||||
m_projectsCB = new QComboBox(this);
|
|
||||||
// QStringList type;
|
// QStringList type;
|
||||||
// type << tr("pixel") << tr("cm") << tr("mm") << tr("inch") << tr("field");
|
// type << tr("pixel") << tr("cm") << tr("mm") << tr("inch") << tr("field");
|
||||||
// m_unitsCB->addItems(type);
|
// m_unitsCB->addItems(type);
|
||||||
|
@ -138,10 +145,13 @@ StartupPopup::StartupPopup()
|
||||||
|
|
||||||
m_widthFld->setMeasure("camera.lx");
|
m_widthFld->setMeasure("camera.lx");
|
||||||
m_heightFld->setMeasure("camera.ly");
|
m_heightFld->setMeasure("camera.ly");
|
||||||
|
m_widthFld->setFixedWidth(60);
|
||||||
|
m_heightFld->setFixedWidth(60);
|
||||||
|
|
||||||
m_widthFld->setRange(0.1, (std::numeric_limits<double>::max)());
|
m_widthFld->setRange(0.1, (std::numeric_limits<double>::max)());
|
||||||
m_heightFld->setRange(0.1, (std::numeric_limits<double>::max)());
|
m_heightFld->setRange(0.1, (std::numeric_limits<double>::max)());
|
||||||
m_fpsFld->setRange(1.0, (std::numeric_limits<double>::max)());
|
m_fpsFld->setRange(1.0, (std::numeric_limits<double>::max)());
|
||||||
|
m_fpsFld->setFixedWidth(30);
|
||||||
// m_dpiFld->setRange(1.0, (std::numeric_limits<double>::max)());
|
// m_dpiFld->setRange(1.0, (std::numeric_limits<double>::max)());
|
||||||
m_resXFld->setRange(0.1, (std::numeric_limits<double>::max)());
|
m_resXFld->setRange(0.1, (std::numeric_limits<double>::max)());
|
||||||
m_resYFld->setRange(0.1, (std::numeric_limits<double>::max)());
|
m_resYFld->setRange(0.1, (std::numeric_limits<double>::max)());
|
||||||
|
@ -165,8 +175,8 @@ StartupPopup::StartupPopup()
|
||||||
m_sceneBox->setContentsMargins(10, 10, 10, 10);
|
m_sceneBox->setContentsMargins(10, 10, 10, 10);
|
||||||
m_recentBox->setContentsMargins(10, 10, 10, 10);
|
m_recentBox->setContentsMargins(10, 10, 10, 10);
|
||||||
m_recentBox->setFixedWidth(200);
|
m_recentBox->setFixedWidth(200);
|
||||||
m_sceneBox->setMinimumWidth(480);
|
m_sceneBox->setFixedWidth(480);
|
||||||
m_projectBox->setMinimumWidth(480);
|
m_projectBox->setFixedWidth(480);
|
||||||
m_buttonFrame->setFixedHeight(34);
|
m_buttonFrame->setFixedHeight(34);
|
||||||
|
|
||||||
//--- layout
|
//--- layout
|
||||||
|
@ -186,7 +196,7 @@ StartupPopup::StartupPopup()
|
||||||
projectLay->setSpacing(8);
|
projectLay->setSpacing(8);
|
||||||
projectLay->setMargin(8);
|
projectLay->setMargin(8);
|
||||||
{
|
{
|
||||||
projectLay->addWidget(m_projectsCB, 1);
|
projectLay->addWidget(m_projectLocationFld, 1);
|
||||||
projectLay->addWidget(newProjectButton, 0);
|
projectLay->addWidget(newProjectButton, 0);
|
||||||
}
|
}
|
||||||
m_projectBox->setLayout(projectLay);
|
m_projectBox->setLayout(projectLay);
|
||||||
|
@ -199,13 +209,14 @@ StartupPopup::StartupPopup()
|
||||||
// Scene Name
|
// Scene Name
|
||||||
newSceneLay->addWidget(m_sceneNameLabel, 0, 0,
|
newSceneLay->addWidget(m_sceneNameLabel, 0, 0,
|
||||||
Qt::AlignRight | Qt::AlignVCenter);
|
Qt::AlignRight | Qt::AlignVCenter);
|
||||||
newSceneLay->addWidget(m_nameFld, 0, 1, 1, 3);
|
newSceneLay->addWidget(m_nameFld, 0, 1, 1, 5);
|
||||||
|
|
||||||
// Save In
|
// Save In
|
||||||
newSceneLay->addWidget(new QLabel(tr("Save In:")), 1, 0,
|
// newSceneLay->addWidget(new QLabel(tr("Save In:")), 1, 0,
|
||||||
Qt::AlignRight | Qt::AlignVCenter);
|
// Qt::AlignRight | Qt::AlignVCenter);
|
||||||
newSceneLay->addWidget(m_pathFld, 1, 1, 1, 3);
|
newSceneLay->addWidget(m_pathFld, 1, 1, 1, 5);
|
||||||
newSceneLay->addWidget(new QLabel(tr("Camera Size:")), 2, 0,
|
m_pathFld->hide();
|
||||||
|
newSceneLay->addWidget(new QLabel(tr("Preset:")), 2, 0,
|
||||||
Qt::AlignRight | Qt::AlignVCenter);
|
Qt::AlignRight | Qt::AlignVCenter);
|
||||||
QHBoxLayout *resListLay = new QHBoxLayout();
|
QHBoxLayout *resListLay = new QHBoxLayout();
|
||||||
resListLay->setSpacing(3);
|
resListLay->setSpacing(3);
|
||||||
|
@ -215,7 +226,7 @@ StartupPopup::StartupPopup()
|
||||||
resListLay->addWidget(m_addPresetBtn, 0);
|
resListLay->addWidget(m_addPresetBtn, 0);
|
||||||
resListLay->addWidget(m_removePresetBtn, 0);
|
resListLay->addWidget(m_removePresetBtn, 0);
|
||||||
}
|
}
|
||||||
newSceneLay->addLayout(resListLay, 2, 1, 1, 3, Qt::AlignLeft);
|
newSceneLay->addLayout(resListLay, 2, 1, 1, 5, Qt::AlignLeft);
|
||||||
|
|
||||||
// Width - Height
|
// Width - Height
|
||||||
newSceneLay->addWidget(m_widthLabel, 3, 0,
|
newSceneLay->addWidget(m_widthLabel, 3, 0,
|
||||||
|
@ -224,21 +235,22 @@ StartupPopup::StartupPopup()
|
||||||
newSceneLay->addWidget(m_heightLabel, 3, 2,
|
newSceneLay->addWidget(m_heightLabel, 3, 2,
|
||||||
Qt::AlignRight | Qt::AlignVCenter);
|
Qt::AlignRight | Qt::AlignVCenter);
|
||||||
newSceneLay->addWidget(m_heightFld, 3, 3);
|
newSceneLay->addWidget(m_heightFld, 3, 3);
|
||||||
|
newSceneLay->addWidget(m_fpsLabel, 3, 4,
|
||||||
|
Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
QHBoxLayout *fpsLay = new QHBoxLayout();
|
||||||
|
fpsLay->addWidget(m_fpsFld);
|
||||||
|
fpsLay->addWidget(new QLabel(tr("fps"), this));
|
||||||
|
newSceneLay->addLayout(fpsLay, 3, 5);
|
||||||
|
|
||||||
newSceneLay->addWidget(m_resTextLabel, 4, 0, 1, 1, Qt::AlignRight);
|
newSceneLay->addWidget(m_resTextLabel, 4, 0, 1, 1, Qt::AlignRight);
|
||||||
newSceneLay->addWidget(m_resXFld, 4, 1);
|
newSceneLay->addWidget(m_resXFld, 4, 1);
|
||||||
newSceneLay->addWidget(m_resXLabel, 4, 2, 1, 1, Qt::AlignCenter);
|
newSceneLay->addWidget(m_resXLabel, 4, 2, 1, 1, Qt::AlignCenter);
|
||||||
newSceneLay->addWidget(m_resYFld, 4, 3);
|
newSceneLay->addWidget(m_resYFld, 4, 3);
|
||||||
// newSceneLay->addWidget(new QLabel(tr("Units:")), 5, 0,
|
// newSceneLay->addWidget(m_fpsLabel, 5, 0,
|
||||||
// Qt::AlignRight | Qt::AlignVCenter);
|
// Qt::AlignRight | Qt::AlignVCenter);
|
||||||
// newSceneLay->addWidget(m_unitsCB, 5, 1, 1, 1);
|
// newSceneLay->addWidget(m_fpsFld, 5, 1, 1, 1);
|
||||||
// newSceneLay->addWidget(m_dpiLabel, 5, 2,
|
|
||||||
// Qt::AlignRight | Qt::AlignVCenter);
|
|
||||||
// newSceneLay->addWidget(m_dpiFld, 5, 3, 1, 1);
|
|
||||||
newSceneLay->addWidget(m_fpsLabel, 5, 0,
|
|
||||||
Qt::AlignRight | Qt::AlignVCenter);
|
|
||||||
newSceneLay->addWidget(m_fpsFld, 5, 1, 1, 1);
|
|
||||||
newSceneLay->addWidget(createButton, 6, 1, 1, 3, Qt::AlignLeft);
|
newSceneLay->addWidget(createButton, 6, 1, 1, 3, Qt::AlignLeft);
|
||||||
|
newSceneLay->setColumnStretch(4, 1);
|
||||||
}
|
}
|
||||||
m_sceneBox->setLayout(newSceneLay);
|
m_sceneBox->setLayout(newSceneLay);
|
||||||
guiLay->addWidget(m_sceneBox, 2, 0, 4, 1, Qt::AlignTop);
|
guiLay->addWidget(m_sceneBox, 2, 0, 4, 1, Qt::AlignTop);
|
||||||
|
@ -278,10 +290,10 @@ StartupPopup::StartupPopup()
|
||||||
SLOT(onSceneChanged()));
|
SLOT(onSceneChanged()));
|
||||||
ret = ret && connect(newProjectButton, SIGNAL(clicked()), this,
|
ret = ret && connect(newProjectButton, SIGNAL(clicked()), this,
|
||||||
SLOT(onNewProjectButtonPressed()));
|
SLOT(onNewProjectButtonPressed()));
|
||||||
|
ret = ret && connect(m_projectLocationFld, SIGNAL(pathChanged()), this,
|
||||||
|
SLOT(onProjectLocationChanged()));
|
||||||
ret = ret && connect(loadOtherSceneButton, SIGNAL(clicked()), this,
|
ret = ret && connect(loadOtherSceneButton, SIGNAL(clicked()), this,
|
||||||
SLOT(onLoadSceneButtonPressed()));
|
SLOT(onLoadSceneButtonPressed()));
|
||||||
ret = ret && connect(m_projectsCB, SIGNAL(currentIndexChanged(int)),
|
|
||||||
SLOT(onProjectChanged(int)));
|
|
||||||
ret = ret &&
|
ret = ret &&
|
||||||
connect(createButton, SIGNAL(clicked()), this, SLOT(onCreateButton()));
|
connect(createButton, SIGNAL(clicked()), this, SLOT(onCreateButton()));
|
||||||
ret = ret && connect(m_showAtStartCB, SIGNAL(stateChanged(int)), this,
|
ret = ret && connect(m_showAtStartCB, SIGNAL(stateChanged(int)), this,
|
||||||
|
@ -294,13 +306,9 @@ StartupPopup::StartupPopup()
|
||||||
connect(m_resXFld, SIGNAL(valueChanged()), this, SLOT(updateSize()));
|
connect(m_resXFld, SIGNAL(valueChanged()), this, SLOT(updateSize()));
|
||||||
ret = ret &&
|
ret = ret &&
|
||||||
connect(m_resYFld, SIGNAL(valueChanged()), this, SLOT(updateSize()));
|
connect(m_resYFld, SIGNAL(valueChanged()), this, SLOT(updateSize()));
|
||||||
// ret = ret && connect(m_dpiFld, SIGNAL(editingFinished()), this,
|
|
||||||
// SLOT(onDpiChanged()));
|
|
||||||
ret = ret && connect(m_presetCombo, SIGNAL(activated(const QString &)),
|
ret = ret && connect(m_presetCombo, SIGNAL(activated(const QString &)),
|
||||||
SLOT(onPresetSelected(const QString &)));
|
SLOT(onPresetSelected(const QString &)));
|
||||||
ret = ret && connect(m_addPresetBtn, SIGNAL(clicked()), SLOT(addPreset()));
|
ret = ret && connect(m_addPresetBtn, SIGNAL(clicked()), SLOT(addPreset()));
|
||||||
// ret = ret && connect(m_unitsCB, SIGNAL(currentIndexChanged(int)),
|
|
||||||
// SLOT(onCameraUnitChanged(int)));
|
|
||||||
ret = ret &&
|
ret = ret &&
|
||||||
connect(m_removePresetBtn, SIGNAL(clicked()), SLOT(removePreset()));
|
connect(m_removePresetBtn, SIGNAL(clicked()), SLOT(removePreset()));
|
||||||
ret = ret && connect(m_nameFld, SIGNAL(returnPressedNow()), createButton,
|
ret = ret && connect(m_nameFld, SIGNAL(returnPressedNow()), createButton,
|
||||||
|
@ -309,14 +317,16 @@ StartupPopup::StartupPopup()
|
||||||
SLOT(onAutoSaveOnChanged(int)));
|
SLOT(onAutoSaveOnChanged(int)));
|
||||||
ret = ret && connect(m_autoSaveTimeFld, SIGNAL(editingFinished()), this,
|
ret = ret && connect(m_autoSaveTimeFld, SIGNAL(editingFinished()), this,
|
||||||
SLOT(onAutoSaveTimeChanged()));
|
SLOT(onAutoSaveTimeChanged()));
|
||||||
|
ret = ret && connect(m_projectLocationFld, SIGNAL(pathChanged()), this,
|
||||||
|
SLOT(checkProject()));
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
checkProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void StartupPopup::showEvent(QShowEvent *) {
|
void StartupPopup::showEvent(QShowEvent *) {
|
||||||
loadPresetList();
|
loadPresetList();
|
||||||
updateProjectCB();
|
|
||||||
m_nameFld->setFocus();
|
m_nameFld->setFocus();
|
||||||
m_pathFld->setPath(TApp::instance()
|
m_pathFld->setPath(TApp::instance()
|
||||||
->getCurrentScene()
|
->getCurrentScene()
|
||||||
|
@ -349,8 +359,6 @@ void StartupPopup::showEvent(QShowEvent *) {
|
||||||
m_resXFld->hide();
|
m_resXFld->hide();
|
||||||
m_resYFld->hide();
|
m_resYFld->hide();
|
||||||
m_resXLabel->hide();
|
m_resXLabel->hide();
|
||||||
// m_dpiFld->hide();
|
|
||||||
// m_dpiLabel->hide();
|
|
||||||
} else {
|
} else {
|
||||||
m_widthFld->setDecimals(4);
|
m_widthFld->setDecimals(4);
|
||||||
m_heightFld->setDecimals(4);
|
m_heightFld->setDecimals(4);
|
||||||
|
@ -358,8 +366,6 @@ void StartupPopup::showEvent(QShowEvent *) {
|
||||||
m_resYFld->show();
|
m_resYFld->show();
|
||||||
m_resXLabel->show();
|
m_resXLabel->show();
|
||||||
m_resTextLabel->show();
|
m_resTextLabel->show();
|
||||||
// m_dpiFld->show();
|
|
||||||
// m_dpiLabel->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fpsFld->setValue(fps);
|
m_fpsFld->setValue(fps);
|
||||||
|
@ -435,6 +441,27 @@ void StartupPopup::refreshRecentScenes() {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void StartupPopup::onCreateButton() {
|
void StartupPopup::onCreateButton() {
|
||||||
|
TProjectManager *pm = TProjectManager::instance();
|
||||||
|
|
||||||
|
TFilePath projectFolder = TFilePath(m_projectLocationFld->getPath());
|
||||||
|
TFilePath projectPath = pm->projectFolderToProjectPath(projectFolder);
|
||||||
|
if (!checkProject()) {
|
||||||
|
DVGui::warning(
|
||||||
|
tr("The project needs to be a valid project.\n"
|
||||||
|
"Please select a valid project or create a new project."));
|
||||||
|
m_projectLocationFld->setFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(TFileStatus(projectPath).doesExist());
|
||||||
|
pm->setCurrentProjectPath(projectPath);
|
||||||
|
IoCmd::newScene();
|
||||||
|
m_pathFld->setPath(TApp::instance()
|
||||||
|
->getCurrentScene()
|
||||||
|
->getScene()
|
||||||
|
->getProject()
|
||||||
|
->getScenesPath()
|
||||||
|
.getQString());
|
||||||
if (m_nameFld->text().trimmed() == "") {
|
if (m_nameFld->text().trimmed() == "") {
|
||||||
DVGui::warning(tr("The name cannot be empty."));
|
DVGui::warning(tr("The name cannot be empty."));
|
||||||
m_nameFld->setFocus();
|
m_nameFld->setFocus();
|
||||||
|
@ -515,55 +542,40 @@ void StartupPopup::onCreateButton() {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void StartupPopup::updateProjectCB() {
|
void StartupPopup::onProjectLocationChanged() {
|
||||||
m_updating = true;
|
|
||||||
m_projectPaths.clear();
|
|
||||||
m_projectsCB->clear();
|
|
||||||
|
|
||||||
TProjectManager *pm = TProjectManager::instance();
|
TProjectManager *pm = TProjectManager::instance();
|
||||||
|
TFilePath path = TFilePath(m_projectLocationFld->getPath());
|
||||||
TFilePath sandboxFp = pm->getSandboxProjectFolder() + "sandbox_otprj.xml";
|
if (!TSystem::doesExistFileOrLevel(path)) {
|
||||||
m_projectPaths.push_back(sandboxFp);
|
path =
|
||||||
m_projectsCB->addItem("sandbox");
|
TApp::instance()->getCurrentScene()->getScene()->decodeFilePath(path);
|
||||||
|
m_projectLocationFld->setPath(path.getQString());
|
||||||
std::vector<TFilePath> prjRoots;
|
if (!TSystem::doesExistFileOrLevel(path)) {
|
||||||
pm->getProjectRoots(prjRoots);
|
DVGui::warning(tr(
|
||||||
for (int i = 0; i < prjRoots.size(); i++) {
|
"This is not a valid folder. Please choose an existing location."));
|
||||||
TFilePathSet fps;
|
checkProject();
|
||||||
TSystem::readDirectory_Dir_ReadExe(fps, prjRoots[i]);
|
return;
|
||||||
|
|
||||||
TFilePathSet::iterator it;
|
|
||||||
for (it = fps.begin(); it != fps.end(); ++it) {
|
|
||||||
TFilePath fp(*it);
|
|
||||||
if (pm->isProject(fp)) {
|
|
||||||
m_projectPaths.push_back(pm->projectFolderToProjectPath(fp));
|
|
||||||
TFilePath prjFile = pm->getProjectPathByProjectFolder(fp);
|
|
||||||
m_projectsCB->addItem(QString::fromStdString(prjFile.getName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add in project of current project if outside known Project root folders
|
if (!pm->isProject(path)) {
|
||||||
TProjectP currentProject = pm->getCurrentProject();
|
QStringList buttonList;
|
||||||
TFilePath currentProjectFP = currentProject->getProjectPath();
|
buttonList.append(tr("Yes"));
|
||||||
if (m_projectPaths.indexOf(currentProjectFP) == -1) {
|
buttonList.append(tr("No"));
|
||||||
m_projectPaths.push_back(currentProjectFP);
|
int answer = DVGui::MsgBox(tr("No project found at this location \n"
|
||||||
m_projectsCB->addItem(
|
"What would you like to do?"),
|
||||||
QString::fromStdString(currentProject->getName().getName()));
|
tr("Make a new project"), tr("Cancel"), 1, this);
|
||||||
}
|
if (answer != 1) {
|
||||||
int i;
|
m_projectLocationFld->setPath(TApp::instance()
|
||||||
for (i = 0; i < m_projectPaths.size(); i++) {
|
->getCurrentScene()
|
||||||
if (pm->getCurrentProjectPath() == m_projectPaths[i]) {
|
->getScene()
|
||||||
m_projectsCB->setCurrentIndex(i);
|
->getProject()
|
||||||
break;
|
->getProjectFolder()
|
||||||
|
.getQString());
|
||||||
|
} else {
|
||||||
|
ProjectCreatePopup *popup = new ProjectCreatePopup();
|
||||||
|
popup->setPath(path.getQString());
|
||||||
|
popup->exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_pathFld->setPath(TApp::instance()
|
|
||||||
->getCurrentScene()
|
|
||||||
->getScene()
|
|
||||||
->getProject()
|
|
||||||
->getScenesPath()
|
|
||||||
.getQString());
|
|
||||||
m_updating = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -613,7 +625,6 @@ void StartupPopup::onProjectChanged(int index) {
|
||||||
m_widthFld->setValue(size.lx);
|
m_widthFld->setValue(size.lx);
|
||||||
m_heightFld->setValue(size.ly);
|
m_heightFld->setValue(size.ly);
|
||||||
m_dpi = m_xRes / size.lx;
|
m_dpi = m_xRes / size.lx;
|
||||||
// m_dpiFld->setValue(m_dpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -726,7 +737,6 @@ void StartupPopup::onPresetSelected(const QString &str) {
|
||||||
if (Preferences::instance()->getPixelsOnly()) {
|
if (Preferences::instance()->getPixelsOnly()) {
|
||||||
m_widthFld->setValue((double)xres / Stage::standardDpi);
|
m_widthFld->setValue((double)xres / Stage::standardDpi);
|
||||||
m_heightFld->setValue((double)yres / Stage::standardDpi);
|
m_heightFld->setValue((double)yres / Stage::standardDpi);
|
||||||
// m_dpiFld->setValue(Stage::standardDpi);
|
|
||||||
}
|
}
|
||||||
m_resXFld->setValue(m_xRes);
|
m_resXFld->setValue(m_xRes);
|
||||||
m_resYFld->setValue(m_yRes);
|
m_resYFld->setValue(m_yRes);
|
||||||
|
@ -850,7 +860,7 @@ void StartupPopup::onSceneChanged() {
|
||||||
if (!TApp::instance()->getCurrentScene()->getScene()->isUntitled()) {
|
if (!TApp::instance()->getCurrentScene()->getScene()->isUntitled()) {
|
||||||
hide();
|
hide();
|
||||||
} else {
|
} else {
|
||||||
updateProjectCB();
|
// updateProjectCB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,7 +869,6 @@ void StartupPopup::onSceneChanged() {
|
||||||
void StartupPopup::onDpiChanged() {
|
void StartupPopup::onDpiChanged() {
|
||||||
if (Preferences::instance()->getPixelsOnly()) {
|
if (Preferences::instance()->getPixelsOnly()) {
|
||||||
m_dpi = Stage::standardDpi;
|
m_dpi = Stage::standardDpi;
|
||||||
// m_dpiFld->setValue(Stage::standardDpi);
|
|
||||||
updateResolution();
|
updateResolution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -887,14 +896,14 @@ void StartupPopup::onRecentSceneClicked(int index) {
|
||||||
DVGui::warning(msg);
|
DVGui::warning(msg);
|
||||||
refreshRecentScenes();
|
refreshRecentScenes();
|
||||||
} else {
|
} else {
|
||||||
if (RecentFiles::instance()->getFileProject(index) != "-") {
|
// if (RecentFiles::instance()->getFileProject(index) != "-") {
|
||||||
QString projectName = RecentFiles::instance()->getFileProject(index);
|
// QString projectName = RecentFiles::instance()->getFileProject(index);
|
||||||
int projectIndex = m_projectsCB->findText(projectName);
|
// int projectIndex = m_projectsCB->findText(projectName);
|
||||||
if (projectIndex >= 0) {
|
// if (projectIndex >= 0) {
|
||||||
TFilePath projectFp = m_projectPaths[projectIndex];
|
// TFilePath projectFp = m_projectPaths[projectIndex];
|
||||||
TProjectManager::instance()->setCurrentProjectPath(projectFp);
|
// TProjectManager::instance()->setCurrentProjectPath(projectFp);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
IoCmd::loadScene(TFilePath(path.toStdWString()), false, true);
|
IoCmd::loadScene(TFilePath(path.toStdWString()), false, true);
|
||||||
QString origProjectName = RecentFiles::instance()->getFileProject(index);
|
QString origProjectName = RecentFiles::instance()->getFileProject(index);
|
||||||
QString projectName = QString::fromStdString(TApp::instance()
|
QString projectName = QString::fromStdString(TApp::instance()
|
||||||
|
@ -939,8 +948,6 @@ void StartupPopup::onCameraUnitChanged(int index) {
|
||||||
m_resXFld->show();
|
m_resXFld->show();
|
||||||
m_resYFld->show();
|
m_resYFld->show();
|
||||||
m_resXLabel->show();
|
m_resXLabel->show();
|
||||||
// m_dpiFld->show();
|
|
||||||
// m_dpiLabel->show();
|
|
||||||
m_widthFld->setMeasure("camera.lx");
|
m_widthFld->setMeasure("camera.lx");
|
||||||
m_heightFld->setMeasure("camera.ly");
|
m_heightFld->setMeasure("camera.ly");
|
||||||
m_widthFld->setValue(width);
|
m_widthFld->setValue(width);
|
||||||
|
@ -955,9 +962,6 @@ void StartupPopup::onCameraUnitChanged(int index) {
|
||||||
m_resXFld->hide();
|
m_resXFld->hide();
|
||||||
m_resYFld->hide();
|
m_resYFld->hide();
|
||||||
m_resXLabel->hide();
|
m_resXLabel->hide();
|
||||||
// m_dpiFld->hide();
|
|
||||||
// m_dpiLabel->hide();
|
|
||||||
// m_dpiFld->setValue(Stage::standardDpi);
|
|
||||||
m_widthFld->setMeasure("camera.lx");
|
m_widthFld->setMeasure("camera.lx");
|
||||||
m_heightFld->setMeasure("camera.ly");
|
m_heightFld->setMeasure("camera.ly");
|
||||||
m_widthFld->setValue(m_xRes / Stage::standardDpi);
|
m_widthFld->setValue(m_xRes / Stage::standardDpi);
|
||||||
|
@ -989,9 +993,6 @@ void StartupPopup::onAutoSaveTimeChanged() {
|
||||||
|
|
||||||
void StartupPopup::updateResolution() {
|
void StartupPopup::updateResolution() {
|
||||||
if (Preferences::instance()->getPixelsOnly()) {
|
if (Preferences::instance()->getPixelsOnly()) {
|
||||||
// if (m_dpiFld->getValue() != Stage::standardDpi) {
|
|
||||||
// m_dpiFld->setValue(Stage::standardDpi);
|
|
||||||
//}
|
|
||||||
m_xRes = m_widthFld->getValue() * Stage::standardDpi;
|
m_xRes = m_widthFld->getValue() * Stage::standardDpi;
|
||||||
m_yRes = m_heightFld->getValue() * Stage::standardDpi;
|
m_yRes = m_heightFld->getValue() * Stage::standardDpi;
|
||||||
m_resXFld->setValue(m_xRes);
|
m_resXFld->setValue(m_xRes);
|
||||||
|
@ -1011,9 +1012,6 @@ void StartupPopup::updateSize() {
|
||||||
m_xRes = m_resXFld->getValue();
|
m_xRes = m_resXFld->getValue();
|
||||||
m_yRes = m_resYFld->getValue();
|
m_yRes = m_resYFld->getValue();
|
||||||
if (Preferences::instance()->getPixelsOnly()) {
|
if (Preferences::instance()->getPixelsOnly()) {
|
||||||
// if (m_dpiFld->getValue() != Stage::standardDpi) {
|
|
||||||
// m_dpiFld->setValue(Stage::standardDpi);
|
|
||||||
//}
|
|
||||||
m_widthFld->setValue((double)m_xRes / Stage::standardDpi);
|
m_widthFld->setValue((double)m_xRes / Stage::standardDpi);
|
||||||
m_heightFld->setValue((double)m_yRes / Stage::standardDpi);
|
m_heightFld->setValue((double)m_yRes / Stage::standardDpi);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1025,6 +1023,22 @@ void StartupPopup::updateSize() {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool StartupPopup::checkProject() {
|
||||||
|
TFilePath currPath = TFilePath(m_projectLocationFld->getPath());
|
||||||
|
bool isProject = TProjectManager::instance()->isProject(currPath);
|
||||||
|
if (isProject) {
|
||||||
|
m_projectLocationFld->getField()->setStyleSheet(
|
||||||
|
m_pathFld->getField()->styleSheet());
|
||||||
|
m_projectLocationFld->setToolTip(tr(""));
|
||||||
|
} else {
|
||||||
|
m_projectLocationFld->getField()->setStyleSheet("color: red;");
|
||||||
|
m_projectLocationFld->setToolTip(tr("Not a valid project location"));
|
||||||
|
}
|
||||||
|
return isProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
StartupLabel::StartupLabel(const QString &text, QWidget *parent, int index)
|
StartupLabel::StartupLabel(const QString &text, QWidget *parent, int index)
|
||||||
: QLabel(parent), m_index(index) {
|
: QLabel(parent), m_index(index) {
|
||||||
setText(text);
|
setText(text);
|
||||||
|
|
|
@ -27,14 +27,15 @@ class StartupPopup final : public DVGui::Dialog {
|
||||||
|
|
||||||
DVGui::LineEdit *m_nameFld;
|
DVGui::LineEdit *m_nameFld;
|
||||||
DVGui::FileField *m_pathFld;
|
DVGui::FileField *m_pathFld;
|
||||||
|
DVGui::FileField *m_projectLocationFld;
|
||||||
QLabel *m_widthLabel;
|
QLabel *m_widthLabel;
|
||||||
QLabel *m_heightLabel;
|
QLabel *m_heightLabel;
|
||||||
QLabel *m_fpsLabel;
|
QLabel *m_fpsLabel;
|
||||||
QLabel *m_resXLabel;
|
QLabel *m_resXLabel;
|
||||||
QLabel *m_resTextLabel;
|
QLabel *m_resTextLabel;
|
||||||
//QLabel *m_dpiLabel;
|
// QLabel *m_dpiLabel;
|
||||||
QLabel *m_sceneNameLabel;
|
QLabel *m_sceneNameLabel;
|
||||||
//DVGui::DoubleLineEdit *m_dpiFld;
|
// DVGui::DoubleLineEdit *m_dpiFld;
|
||||||
DVGui::MeasuredDoubleLineEdit *m_widthFld;
|
DVGui::MeasuredDoubleLineEdit *m_widthFld;
|
||||||
DVGui::MeasuredDoubleLineEdit *m_heightFld;
|
DVGui::MeasuredDoubleLineEdit *m_heightFld;
|
||||||
DVGui::DoubleLineEdit *m_fpsFld;
|
DVGui::DoubleLineEdit *m_fpsFld;
|
||||||
|
@ -45,8 +46,7 @@ class StartupPopup final : public DVGui::Dialog {
|
||||||
QList<TFilePath> m_projectPaths;
|
QList<TFilePath> m_projectPaths;
|
||||||
QCheckBox *m_showAtStartCB;
|
QCheckBox *m_showAtStartCB;
|
||||||
QCheckBox *m_autoSaveOnCB;
|
QCheckBox *m_autoSaveOnCB;
|
||||||
QComboBox *m_projectsCB;
|
// QComboBox *m_unitsCB;
|
||||||
//QComboBox *m_unitsCB;
|
|
||||||
QPushButton *m_loadOtherSceneButton;
|
QPushButton *m_loadOtherSceneButton;
|
||||||
QPushButton *m_newProjectButton;
|
QPushButton *m_newProjectButton;
|
||||||
QComboBox *m_presetCombo;
|
QComboBox *m_presetCombo;
|
||||||
|
@ -81,7 +81,6 @@ public slots:
|
||||||
void onRecentSceneClicked(int index);
|
void onRecentSceneClicked(int index);
|
||||||
void onCreateButton();
|
void onCreateButton();
|
||||||
void onShowAtStartChanged(int index);
|
void onShowAtStartChanged(int index);
|
||||||
void updateProjectCB();
|
|
||||||
void onProjectChanged(int index);
|
void onProjectChanged(int index);
|
||||||
void onNewProjectButtonPressed();
|
void onNewProjectButtonPressed();
|
||||||
void onLoadSceneButtonPressed();
|
void onLoadSceneButtonPressed();
|
||||||
|
@ -95,6 +94,8 @@ public slots:
|
||||||
void onCameraUnitChanged(int index);
|
void onCameraUnitChanged(int index);
|
||||||
void onAutoSaveOnChanged(int index);
|
void onAutoSaveOnChanged(int index);
|
||||||
void onAutoSaveTimeChanged();
|
void onAutoSaveTimeChanged();
|
||||||
|
bool checkProject();
|
||||||
|
void onProjectLocationChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
class StartupLabel : public QLabel {
|
class StartupLabel : public QLabel {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
// STD includes
|
// STD includes
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -123,9 +124,12 @@ std::wstring getProjectSuffix(const TFilePath &path) {
|
||||||
TFilePath getProjectFile(const TFilePath &fp) {
|
TFilePath getProjectFile(const TFilePath &fp) {
|
||||||
const std::wstring &fpName = fp.getWideName();
|
const std::wstring &fpName = fp.getWideName();
|
||||||
const std::wstring &folderName = fp.getParentDir().getWideName();
|
const std::wstring &folderName = fp.getParentDir().getWideName();
|
||||||
|
std::wstring tahoma = L"tahomaproject";
|
||||||
QDir dir(fp.getQString());
|
QDir dir(fp.getQString());
|
||||||
|
TFilePath path = fp + (tahoma + xmlExt);
|
||||||
|
if (TFileStatus(path).doesExist()) return path;
|
||||||
for (int i = 0; i < prjSuffixCount; ++i) {
|
for (int i = 0; i < prjSuffixCount; ++i) {
|
||||||
TFilePath path = fp + (fpName + prjSuffix[i] + xmlExt);
|
path = fp + (fpName + prjSuffix[i] + xmlExt);
|
||||||
if (TFileStatus(path).doesExist()) return path;
|
if (TFileStatus(path).doesExist()) return path;
|
||||||
|
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
|
@ -144,6 +148,7 @@ TFilePath getProjectFile(const TFilePath &fp) {
|
||||||
//! this function updates it to the most recent; otherwise,
|
//! this function updates it to the most recent; otherwise,
|
||||||
//! it is left untouched.
|
//! it is left untouched.
|
||||||
TFilePath getLatestVersionProjectPath(const TFilePath &path) {
|
TFilePath getLatestVersionProjectPath(const TFilePath &path) {
|
||||||
|
return path.withName(L"tahomaproject");
|
||||||
const std::wstring &suffix = getProjectSuffix(path);
|
const std::wstring &suffix = getProjectSuffix(path);
|
||||||
for (int i = 1; i < prjSuffixCount; ++i)
|
for (int i = 1; i < prjSuffixCount; ++i)
|
||||||
if (suffix == prjSuffix[i]) {
|
if (suffix == prjSuffix[i]) {
|
||||||
|
@ -173,7 +178,7 @@ TFilePath searchProjectPath(TFilePath folder) {
|
||||||
if (projectPath != TFilePath()) return projectPath;
|
if (projectPath != TFilePath()) return projectPath;
|
||||||
|
|
||||||
// If none exist in the folder, build the name with the most recent suffix
|
// If none exist in the folder, build the name with the most recent suffix
|
||||||
return folder + TFilePath(projectName + prjSuffix[0] + xmlExt);
|
return folder + TFilePath(L"tahomaproject" + xmlExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===================================================================
|
//===================================================================
|
||||||
|
@ -197,13 +202,29 @@ void hideOlderProjectFiles(const TFilePath &folderPath) {
|
||||||
const std::wstring &name = folderPath.getWideName();
|
const std::wstring &name = folderPath.getWideName();
|
||||||
|
|
||||||
TFilePath path;
|
TFilePath path;
|
||||||
for (int i = 1; i < prjSuffixCount; ++i) {
|
for (int i = 0; i < prjSuffixCount; ++i) {
|
||||||
path = folderPath + (name + prjSuffix[i] + xmlExt);
|
path = folderPath + (name + prjSuffix[i] + xmlExt);
|
||||||
if (TFileStatus(path).doesExist())
|
if (TFileStatus(path).doesExist())
|
||||||
TSystem::renameFile(path.withType("xml_"), path);
|
TSystem::renameFile(path.withType("xml_"), path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===================================================================
|
||||||
|
|
||||||
|
TFilePath getDocumentsPath() {
|
||||||
|
QString documentsPath =
|
||||||
|
QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0];
|
||||||
|
return TFilePath(documentsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
//===================================================================
|
||||||
|
|
||||||
|
TFilePath getDesktopPath() {
|
||||||
|
QString desktopPath =
|
||||||
|
QStandardPaths::standardLocations(QStandardPaths::DesktopLocation)[0];
|
||||||
|
return TFilePath(desktopPath);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
//===================================================================
|
//===================================================================
|
||||||
|
@ -691,6 +712,7 @@ void TProject::load(const TFilePath &projectPath) {
|
||||||
bool TProject::isAProjectPath(const TFilePath &fp) {
|
bool TProject::isAProjectPath(const TFilePath &fp) {
|
||||||
if (fp.isAbsolute() && fp.getType() == "xml") {
|
if (fp.isAbsolute() && fp.getType() == "xml") {
|
||||||
const std::wstring &fpName = fp.getWideName();
|
const std::wstring &fpName = fp.getWideName();
|
||||||
|
if (fpName == L"tahomaproject") return true;
|
||||||
for (int i = 0; i < prjSuffixCount; ++i)
|
for (int i = 0; i < prjSuffixCount; ++i)
|
||||||
if (fpName.find(prjSuffix[i]) != std::wstring::npos) return true;
|
if (fpName.find(prjSuffix[i]) != std::wstring::npos) return true;
|
||||||
}
|
}
|
||||||
|
@ -764,12 +786,12 @@ TProjectManager *TProjectManager::instance() {
|
||||||
/*! Adds the specified folder \b fp in the projecs roots container.\n
|
/*! Adds the specified folder \b fp in the projecs roots container.\n
|
||||||
If \b fp is already contained in the container, the method does nothing.
|
If \b fp is already contained in the container, the method does nothing.
|
||||||
\note \b fp must be a folder and not a file path.*/
|
\note \b fp must be a folder and not a file path.*/
|
||||||
void TProjectManager::addProjectsRoot(const TFilePath &root) {
|
// void TProjectManager::addProjectsRoot(const TFilePath &root) {
|
||||||
// assert(TFileStatus(root).isDirectory());
|
// // assert(TFileStatus(root).isDirectory());
|
||||||
if (std::find(m_projectsRoots.begin(), m_projectsRoots.end(), root) ==
|
// if (std::find(m_projectsRoots.begin(), m_projectsRoots.end(), root) ==
|
||||||
m_projectsRoots.end())
|
// m_projectsRoots.end())
|
||||||
m_projectsRoots.push_back(root);
|
// m_projectsRoots.push_back(root);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -786,25 +808,25 @@ void TProjectManager::addSVNProjectsRoot(const TFilePath &root) {
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
void TProjectManager::addDefaultProjectsRoot() {
|
// void TProjectManager::addDefaultProjectsRoot() {
|
||||||
addProjectsRoot(TEnv::getStuffDir() + "projects");
|
// addProjectsRoot(TEnv::getStuffDir() + "projects");
|
||||||
}
|
//}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
TFilePath TProjectManager::getCurrentProjectRoot() {
|
// TFilePath TProjectManager::getCurrentProjectRoot() {
|
||||||
TFilePath currentProjectPath = getCurrentProjectPath();
|
// TFilePath currentProjectPath = getCurrentProjectPath();
|
||||||
int i;
|
// int i;
|
||||||
for (i = 0; i < (int)m_projectsRoots.size(); i++)
|
// for (i = 0; i < (int)m_projectsRoots.size(); i++)
|
||||||
if (m_projectsRoots[i].isAncestorOf(currentProjectPath))
|
// if (m_projectsRoots[i].isAncestorOf(currentProjectPath))
|
||||||
return m_projectsRoots[i];
|
// return m_projectsRoots[i];
|
||||||
for (i = 0; i < (int)m_svnProjectsRoots.size(); i++)
|
// for (i = 0; i < (int)m_svnProjectsRoots.size(); i++)
|
||||||
if (m_svnProjectsRoots[i].isAncestorOf(currentProjectPath))
|
// if (m_svnProjectsRoots[i].isAncestorOf(currentProjectPath))
|
||||||
return m_svnProjectsRoots[i];
|
// return m_svnProjectsRoots[i];
|
||||||
if (m_projectsRoots.empty())
|
// if (m_projectsRoots.empty())
|
||||||
addDefaultProjectsRoot(); // shouldn't be necessary
|
// addDefaultProjectsRoot(); // shouldn't be necessary
|
||||||
return m_projectsRoots[0];
|
// return m_projectsRoots[0];
|
||||||
}
|
//}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
/*! Returns the name of the specified \b projectPath.
|
/*! Returns the name of the specified \b projectPath.
|
||||||
|
@ -814,40 +836,28 @@ TFilePath TProjectManager::projectPathToProjectName(
|
||||||
const TFilePath &projectPath) {
|
const TFilePath &projectPath) {
|
||||||
assert(projectPath.isAbsolute());
|
assert(projectPath.isAbsolute());
|
||||||
TFilePath projectFolder = projectPath.getParentDir();
|
TFilePath projectFolder = projectPath.getParentDir();
|
||||||
if (m_projectsRoots.empty()) addDefaultProjectsRoot();
|
// if (m_projectsRoots.empty()) addDefaultProjectsRoot();
|
||||||
|
|
||||||
|
// keep allowing for older project types
|
||||||
std::wstring fpName = projectPath.getWideName();
|
std::wstring fpName = projectPath.getWideName();
|
||||||
for (int i = 0; i < prjSuffixCount; ++i) {
|
for (int i = 0; i < prjSuffixCount; ++i) {
|
||||||
// std::wstring::size_type const i = fpName.find(prjSuffix[i]);
|
// std::wstring::size_type const i = fpName.find(prjSuffix[i]);
|
||||||
if (fpName.find(prjSuffix[i]) != std::wstring::npos)
|
if (fpName.find(prjSuffix[i]) != std::wstring::npos)
|
||||||
return TFilePath(fpName.substr(0, fpName.find(prjSuffix[i])));
|
return TFilePath(fpName.substr(0, fpName.find(prjSuffix[i])));
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < (int)m_projectsRoots.size(); i++) {
|
|
||||||
if (m_projectsRoots[i].isAncestorOf(projectFolder))
|
|
||||||
return projectFolder - m_projectsRoots[i];
|
|
||||||
}
|
|
||||||
for (i = 0; i < (int)m_svnProjectsRoots.size(); i++) {
|
|
||||||
if (m_svnProjectsRoots[i].isAncestorOf(projectFolder))
|
|
||||||
return projectFolder - m_svnProjectsRoots[i];
|
|
||||||
}
|
|
||||||
// non dovrei mai arrivare qui: il progetto non sta sotto un project root
|
|
||||||
return projectFolder.withoutParentDir();
|
return projectFolder.withoutParentDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
/*! Returns an absolute path of the specified \b projectName.\n
|
// Returns an absolute path of the specified \b projectName.
|
||||||
\note The returned project path is always computed used the first
|
|
||||||
project root in the container.*/
|
|
||||||
TFilePath TProjectManager::projectNameToProjectPath(
|
TFilePath TProjectManager::projectNameToProjectPath(
|
||||||
const TFilePath &projectName) {
|
const TFilePath &projectName) {
|
||||||
assert(!TProject::isAProjectPath(projectName));
|
assert(!TProject::isAProjectPath(projectName));
|
||||||
assert(!projectName.isAbsolute());
|
assert(!projectName.isAbsolute());
|
||||||
if (m_projectsRoots.empty()) addDefaultProjectsRoot();
|
// if (m_projectsRoots.empty()) addDefaultProjectsRoot();
|
||||||
if (projectName == TProject::SandboxProjectName)
|
if (projectName == TProject::SandboxProjectName)
|
||||||
return searchProjectPath(TEnv::getStuffDir() + projectName);
|
return searchProjectPath(TEnv::getStuffDir() + projectName);
|
||||||
return searchProjectPath(m_projectsRoots[0] + projectName);
|
return searchProjectPath(getDocumentsPath() + projectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
@ -871,16 +881,25 @@ TFilePath TProjectManager::getProjectPathByName(const TFilePath &projectName) {
|
||||||
assert(!projectName.isAbsolute());
|
assert(!projectName.isAbsolute());
|
||||||
// TFilePath relativeProjectPath = projectName + (projectName.getName() +
|
// TFilePath relativeProjectPath = projectName + (projectName.getName() +
|
||||||
// projectPathSuffix);
|
// projectPathSuffix);
|
||||||
if (m_projectsRoots.empty()) addDefaultProjectsRoot();
|
// if (m_projectsRoots.empty()) addDefaultProjectsRoot();
|
||||||
if (projectName == TProject::SandboxProjectName)
|
if (projectName == TProject::SandboxProjectName)
|
||||||
return searchProjectPath(TEnv::getStuffDir() + projectName);
|
return searchProjectPath(TEnv::getStuffDir() + projectName);
|
||||||
int i, n = (int)m_projectsRoots.size();
|
|
||||||
for (i = 0; i < n; i++) {
|
TFilePath projectPath = searchProjectPath(getDocumentsPath() + projectName);
|
||||||
TFilePath projectPath = searchProjectPath(m_projectsRoots[i] + projectName);
|
assert(TProject::isAProjectPath(projectPath));
|
||||||
assert(TProject::isAProjectPath(projectPath));
|
if (TFileStatus(projectPath).doesExist()) return projectPath;
|
||||||
if (TFileStatus(projectPath).doesExist()) return projectPath;
|
|
||||||
}
|
projectPath = searchProjectPath(getDesktopPath() + projectName);
|
||||||
for (i = 0; i < (int)m_svnProjectsRoots.size(); i++) {
|
assert(TProject::isAProjectPath(projectPath));
|
||||||
|
if (TFileStatus(projectPath).doesExist()) return projectPath;
|
||||||
|
|
||||||
|
// search the projects folder
|
||||||
|
TFilePath projects = TFilePath(TEnv::getStuffDir() + TFilePath("projects"));
|
||||||
|
projectPath = searchProjectPath(projects + projectName);
|
||||||
|
assert(TProject::isAProjectPath(projectPath));
|
||||||
|
if (TFileStatus(projectPath).doesExist()) return projectPath;
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)m_svnProjectsRoots.size(); i++) {
|
||||||
TFilePath projectPath =
|
TFilePath projectPath =
|
||||||
searchProjectPath(m_svnProjectsRoots[i] + projectName);
|
searchProjectPath(m_svnProjectsRoots[i] + projectName);
|
||||||
assert(TProject::isAProjectPath(projectPath));
|
assert(TProject::isAProjectPath(projectPath));
|
||||||
|
@ -1149,6 +1168,7 @@ TFilePath TProjectManager::getSandboxProjectPath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TProjectManager::isProject(const TFilePath &projectFolder) {
|
bool TProjectManager::isProject(const TFilePath &projectFolder) {
|
||||||
|
if (!projectFolder.isAbsolute()) return false;
|
||||||
TFilePath projectPath = projectFolderToProjectPath(projectFolder);
|
TFilePath projectPath = projectFolderToProjectPath(projectFolder);
|
||||||
return TFileStatus(projectPath).doesExist();
|
return TFileStatus(projectPath).doesExist();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue