Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix file browser not to clear name field on moving

shun-iwasawa8c9284da51b2
diff --git "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm"
index 422e129a3..0648bcdf5 100644
Binary files "a/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" and "b/stuff/config/loc/\346\227\245\346\234\254\350\252\236/toonz.qm" differ
diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cpp
index a5efd7a5a..a0196839a 100644
--- a/toonz/sources/toonz/filebrowser.cpp
+++ b/toonz/sources/toonz/filebrowser.cpp
@@ -2127,7 +2127,8 @@ void FileBrowser::refreshFolder(const TFilePath &folderPath) {
std::set<FileBrowser *>::iterator it;
for (it = activeBrowsers.begin(); it != activeBrowsers.end(); ++it) {
FileBrowser *browser = *it;
- DvDirModel::instance()->refreshFolder(folderPath);
+ DvDirModel::instance()->refreshFolder(
+ folderPath, DvDirModel::instance()->getIndexByPath(folderPath));
if (browser->getFolder() == folderPath) {
browser->setFolder(folderPath, false, true);
}
@@ -2307,8 +2308,8 @@ 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 &)));
+ connect(this, SIGNAL(filePathDoubleClicked(const TFilePath &)), this,
+ SLOT(tryToOpenScene(const TFilePath &)));
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cpp
index 9e127c7e0..0098446a6 100644
--- a/toonz/sources/toonz/filebrowserpopup.cpp
+++ b/toonz/sources/toonz/filebrowserpopup.cpp
@@ -75,6 +75,7 @@ FileBrowserPopup::FileBrowserPopup(const QString &title, Options options,
: QDialog(TApp::instance()->getMainWindow())
, m_isDirectoryOnly(false)
, m_multiSelectionEnabled(options & MULTISELECTION)
+ , m_forSaving(options & FOR_SAVING)
, m_dialogSize(800, 600)
, m_customWidget(customWidget) {
setWindowTitle(title);
@@ -326,6 +327,8 @@ void FileBrowserPopup::onFilePathClicked(const TFilePath &fp) {
void FileBrowserPopup::onFilePathsSelected(
const std::set<TFilePath> &paths,
const std::list<std::vector<TFrameId>> &fIds) {
+ if (paths.size() == 0 && m_forSaving) return;
+
m_selectedPaths = paths;
m_currentFIdsSet = fIds;
@@ -352,6 +355,8 @@ void FileBrowserPopup::onFilePathDoubleClicked(const TFilePath &) {
void FileBrowserPopup::setOkText(const QString &text) {
m_okButton->setText(text);
+ // if the button label is "Save" then the browser is assumed as for saving
+ if (text == QObject::tr("Save")) m_forSaving = true;
}
//-----------------------------------------------------------------------------
@@ -444,7 +449,7 @@ TFilePath GenericLoadFilePopup::getPath() {
//***********************************************************************************
GenericSaveFilePopup::GenericSaveFilePopup(const QString &title)
- : FileBrowserPopup(title) {
+ : FileBrowserPopup(title, Options(FOR_SAVING)) {
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton,
SLOT(animateClick()));
}
@@ -590,7 +595,8 @@ void LoadSubScenePopup::showEvent(QShowEvent *e) {
//=============================================================================
// SaveSceneAsPopup
-SaveSceneAsPopup::SaveSceneAsPopup() : FileBrowserPopup(tr("Save Scene")) {
+SaveSceneAsPopup::SaveSceneAsPopup()
+ : FileBrowserPopup(tr("Save Scene"), Options(FOR_SAVING)) {
setOkText(tr("Save"));
addFilterType("tnz");
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton,
@@ -622,7 +628,7 @@ void SaveSceneAsPopup::initFolder() {
// SaveSubSceneAsPopup
SaveSubSceneAsPopup::SaveSubSceneAsPopup()
- : FileBrowserPopup(tr("Sub-xsheet")) {
+ : FileBrowserPopup(tr("Sub-xsheet"), Options(FOR_SAVING)) {
setOkText(tr("Save"));
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton,
SLOT(animateClick()));
@@ -1526,7 +1532,8 @@ void LoadLevelPopup::onWhiteTranspClicked() {
//=============================================================================
// SaveLevelAsPopup
-SaveLevelAsPopup::SaveLevelAsPopup() : FileBrowserPopup(tr("Save Level")) {
+SaveLevelAsPopup::SaveLevelAsPopup()
+ : FileBrowserPopup(tr("Save Level"), Options(FOR_SAVING)) {
setOkText(tr("Save"));
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton,
SLOT(animateClick()));
@@ -1845,7 +1852,7 @@ void ReplaceLevelPopup::onSelectionChanged(TSelection *sel) {
// SavePaletteAsPopup
SavePaletteAsPopup::SavePaletteAsPopup()
- : FileBrowserPopup(tr("Save Palette")) {
+ : FileBrowserPopup(tr("Save Palette"), Options(FOR_SAVING)) {
setOkText(tr("Save"));
addFilterType("tpl");
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton,
diff --git a/toonz/sources/toonz/filebrowserpopup.h b/toonz/sources/toonz/filebrowserpopup.h
index cd97d9e9c..c1ac1c981 100644
--- a/toonz/sources/toonz/filebrowserpopup.h
+++ b/toonz/sources/toonz/filebrowserpopup.h
@@ -53,8 +53,12 @@ public:
//! construction, surrendering it
//! to the user. Observe that sub-widgets creation is still enforced.
MULTISELECTION = 0x2, //!< Enable multiple selection in the browser widget.
- WITH_APPLY_BUTTON = 0x4 //!< Enable if the filebrowser has an apply button
- //! next to the OK button
+ WITH_APPLY_BUTTON = 0x4, //!< Enable if the filebrowser has an apply button
+ //! next to the OK button
+ FOR_SAVING = 0x8 //!< The popup is for saving. When file selection is
+ //! released, previously-clicked file name remains so
+ //! that users can reuse it for inputting the file name.
+ //! see FileBrowserPopup::onFilePathsSelected
};
public:
@@ -102,6 +106,7 @@ protected:
bool m_isDirectoryOnly;
// bool m_checkFrameRange;
bool m_multiSelectionEnabled;
+ bool m_forSaving;
QSize m_dialogSize;
QWidget *m_customWidget;
diff --git a/toonz/sources/translations/japanese/toonz.ts b/toonz/sources/translations/japanese/toonz.ts
index 30b7edaf2..46327151a 100644
--- a/toonz/sources/translations/japanese/toonz.ts
+++ b/toonz/sources/translations/japanese/toonz.ts
@@ -8198,7 +8198,7 @@ Do you want to overwrite it?</source>
</message>
<message>
<source>Save</source>
- <translation>保存する</translation>
+ <translation>保存</translation>
</message>
<message>
<source>Discard</source>