Allow double-click to open scenes in File Browser and Browser Room.
For #2941.
This commit is contained in:
parent
40a40ea47c
commit
871ee4b4f6
3 changed files with 26 additions and 0 deletions
|
@ -2303,6 +2303,22 @@ void FileBrowser::enableGlobalSelection(bool enabled) {
|
|||
|
||||
void FileBrowser::selectNone() { m_itemViewer->selectNone(); }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FileBrowser::enableDoubleClickToOpenScenes() {
|
||||
// perhaps this should disconnect existing signal handlers first
|
||||
connect(this, SIGNAL(filePathDoubleClicked(const TFilePath &)),
|
||||
this, SLOT(tryToOpenScene(const TFilePath &)));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FileBrowser::tryToOpenScene(const TFilePath &filePath) {
|
||||
if (filePath.getType() == "tnz") {
|
||||
IoCmd::loadScene(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// FCData methods
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -124,6 +124,12 @@ types to be displayed in the file browser.
|
|||
|
||||
QSplitter *getMainSplitter() const { return m_mainSplitter; }
|
||||
|
||||
// Enable double-click to open a scene.
|
||||
// This is not always desirable (e.g. if a user double-clicks on a file in
|
||||
// a "Save As" dialog, they expect the file will be saved to, not opened).
|
||||
// So it is disabled by default.
|
||||
void enableDoubleClickToOpenScenes();
|
||||
|
||||
protected:
|
||||
int findIndexWithPath(TFilePath path);
|
||||
void getExpandedFolders(DvDirModelNode *node,
|
||||
|
@ -198,6 +204,9 @@ protected slots:
|
|||
|
||||
void onFileSystemChanged(const QString &folderPath);
|
||||
|
||||
// If filePath is a valid scene file, open it. Otherwise do nothing.
|
||||
void tryToOpenScene(const TFilePath &filePath);
|
||||
|
||||
signals:
|
||||
|
||||
void filePathClicked(const TFilePath &);
|
||||
|
|
|
@ -1089,6 +1089,7 @@ public:
|
|||
TFilePath currentProjectFolder =
|
||||
TProjectManager::instance()->getCurrentProjectPath().getParentDir();
|
||||
browser->setFolder(currentProjectFolder, true);
|
||||
browser->enableDoubleClickToOpenScenes();
|
||||
}
|
||||
} browserFactory;
|
||||
|
||||
|
|
Loading…
Reference in a new issue