OpenToonz - An open-source full-featured 2D animation creation software
C
Allow double-click in Load Scene dialog to open selected scene.
Martin van Zijl59b0e62f541b
diff --git a/toonz/sources/toonz/dvitemview.cpp b/toonz/sources/toonz/dvitemview.cppindex e5c724046..c5c0b96ee 100644--- a/toonz/sources/toonz/dvitemview.cpp+++ b/toonz/sources/toonz/dvitemview.cpp@@ -1301,6 +1301,7 @@ void DvItemViewerPanel::mouseReleaseEvent(QMouseEvent *) {}void DvItemViewerPanel::mouseDoubleClickEvent(QMouseEvent *event) {int index = pos2index(event->pos());if (index < 0 || index >= getItemCount()) return;+ if (m_viewer) m_viewer->notifyDoubleClick(index);if (!getModel()->canRenameItem(index)) return;QRect captionRect = getCaptionRect(index);if (!captionRect.contains(event->pos())) return;@@ -1941,4 +1942,4 @@ void DvItemViewerButtonBar::onPreferenceChanged(const QString &prefName) {addAction(refreshAct);addSeparator();}-}\ No newline at end of file+}diff --git a/toonz/sources/toonz/dvitemview.h b/toonz/sources/toonz/dvitemview.hindex 6ce4dcbcd..c3bbb36ff 100644--- a/toonz/sources/toonz/dvitemview.h+++ b/toonz/sources/toonz/dvitemview.h@@ -412,6 +412,10 @@ public:emit clickedItem(index);emit selectedItems(m_panel->getSelectedIndices());}+ void notifyDoubleClick(int index) {+ emit doubleClickedItem(index);+ emit selectedItems(m_panel->getSelectedIndices());+ }void enableGlobalSelection(bool enabled) {m_panel->enableGlobalSelection(enabled);@@ -425,6 +429,7 @@ protected:signals:void clickedItem(int index);+ void doubleClickedItem(int index);void selectedItems(const std::set<int> &indexes);};diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cppindex edcc53a30..c1732a059 100644--- a/toonz/sources/toonz/filebrowser.cpp+++ b/toonz/sources/toonz/filebrowser.cpp@@ -240,6 +240,8 @@ FileBrowser::FileBrowser(QWidget *parent, Qt::WFlags flags, bool noContextMenu,ret = ret && connect(m_itemViewer, SIGNAL(clickedItem(int)), this,SLOT(onClickedItem(int)));+ ret = ret && connect(m_itemViewer, SIGNAL(doubleClickedItem(int)), this,+ SLOT(onDoubleClickedItem(int)));ret =ret && connect(m_itemViewer, SIGNAL(selectedItems(const std::set<int> &)),this, SLOT(onSelectedItems(const std::set<int> &)));@@ -2102,6 +2104,23 @@ void FileBrowser::onClickedItem(int index) {//-----------------------------------------------------------------------------+void FileBrowser::onDoubleClickedItem(int index)+{+ // TODO: Avoid duplicate code with onClickedItem().+ if (0 <= index && index < (int)m_items.size()) {+ // if the folder is clicked, then move the current folder+ TFilePath fp = m_items[index].m_path;+ if (m_items[index].m_isFolder) {+ setFolder(fp, true);+ QModelIndex index = m_folderTreeView->currentIndex();+ if (index.isValid()) m_folderTreeView->scrollTo(index);+ } else+ emit filePathDoubleClicked(fp);+ }+}++//-----------------------------------------------------------------------------+void FileBrowser::refreshFolder(const TFilePath &folderPath) {std::set<FileBrowser *>::iterator it;for (it = activeBrowsers.begin(); it != activeBrowsers.end(); ++it) {diff --git a/toonz/sources/toonz/filebrowser.h b/toonz/sources/toonz/filebrowser.hindex 1ff501bc3..e528325a1 100644--- a/toonz/sources/toonz/filebrowser.h+++ b/toonz/sources/toonz/filebrowser.h@@ -159,6 +159,7 @@ protected slots:const QModelIndex &bottomRight);void loadResources();void onClickedItem(int index);+ void onDoubleClickedItem(int index);void onSelectedItems(const std::set<int> &indexes);void folderUp();void newFolder();@@ -200,6 +201,7 @@ protected slots:signals:void filePathClicked(const TFilePath &);+ void filePathDoubleClicked(const TFilePath &);// reuse the list of TFrameId in order to skip loadInfo() when loading the// level with sequencial frames.void filePathsSelected(const std::set<TFilePath> &,diff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cppindex 8b4f2966b..375f96b98 100644--- a/toonz/sources/toonz/filebrowserpopup.cpp+++ b/toonz/sources/toonz/filebrowserpopup.cpp@@ -346,6 +346,13 @@ void FileBrowserPopup::onFilePathsSelected(//-----------------------------------------------------------------------------+void FileBrowserPopup::onFilePathDoubleClicked(const TFilePath &)+{+ // do nothing by default+}++//-----------------------------------------------------------------------------+void FileBrowserPopup::setOkText(const QString &text) {m_okButton->setText(text);}@@ -495,6 +502,8 @@ LoadScenePopup::LoadScenePopup() : FileBrowserPopup(tr("Load Scene")) {// set the initial current path according to the current modulesetInitialFolderByCurrentRoom();++ connect(m_browser, SIGNAL(filePathDoubleClicked(const TFilePath&)), this, SLOT(onFilePathDoubleClicked(const TFilePath&)));}bool LoadScenePopup::execute() {@@ -535,6 +544,11 @@ void LoadScenePopup::showEvent(QShowEvent *e) {FileBrowserPopup::showEvent(e);}+void LoadScenePopup::onFilePathDoubleClicked(const TFilePath& path) {+ Q_UNUSED(path);+ onOkPressed();+}+//=============================================================================// LoadSubScenePopup@@ -2177,4 +2191,4 @@ OpenPopupCommandHandler<ImportMagpieFilePopup> importMagpieFilePopupCommand(OpenReplaceFilePopupHandler<ReplaceLevelPopup> replaceLevelPopupCommand(MI_ReplaceLevel);OpenReplaceFilePopupHandler<ReplaceParentDirectoryPopup>- replaceParentFolderPopupCommand(MI_ReplaceParentDirectory);\ No newline at end of file+ replaceParentFolderPopupCommand(MI_ReplaceParentDirectory);diff --git a/toonz/sources/toonz/filebrowserpopup.h b/toonz/sources/toonz/filebrowserpopup.hindex a74d202bf..44dac37c6 100644--- a/toonz/sources/toonz/filebrowserpopup.h+++ b/toonz/sources/toonz/filebrowserpopup.h@@ -144,6 +144,7 @@ protected slots:virtual void onFilePathsSelected(const std::set<TFilePath> &paths,const std::list<std::vector<TFrameId>> &fIds);+ virtual void onFilePathDoubleClicked(const TFilePath &);// utility functionpublic:@@ -209,6 +210,9 @@ public:protected:void showEvent(QShowEvent *) override;++protected slots:+ void onFilePathDoubleClicked(const TFilePath &path);};//-----------------------------------------------------------------------------