From 754d4551b7fe36bce497e987f67234b8fb81c4a7 Mon Sep 17 00:00:00 2001 From: shun_iwasawa Date: Oct 28 2016 11:05:27 +0000 Subject: fix not to browse initial description text --- diff --git a/toonz/sources/include/toonzqt/filefield.h b/toonz/sources/include/toonzqt/filefield.h index f5a65f8..944f2d1 100644 --- a/toonz/sources/include/toonzqt/filefield.h +++ b/toonz/sources/include/toonzqt/filefield.h @@ -53,6 +53,8 @@ class DVAPI FileField : public QWidget { QStringList m_filters; QFileDialog::FileMode m_fileMode; QString m_windowTitle; + QString m_descriptionText; // if the initial text is not path, set the string + // here and prevent browsing protected: // used in the child class for CleanupSettings QPushButton *m_fileBrowseButton; @@ -73,7 +75,7 @@ public: static BrowserPopupController *m_browserPopupController; FileField(QWidget *parent = 0, QString path = QString(), - bool readOnly = false); + bool readOnly = false, bool doNotBrowseInitialPath = false); ~FileField() {} /*! Set what the user may select in the file dialog: diff --git a/toonz/sources/toonz/convertpopup.cpp b/toonz/sources/toonz/convertpopup.cpp index 30c184e..7ed582e 100644 --- a/toonz/sources/toonz/convertpopup.cpp +++ b/toonz/sources/toonz/convertpopup.cpp @@ -529,7 +529,7 @@ QFrame *ConvertPopup::createTlvSettings() { m_tlvMode = new QComboBox(); m_unpaintedFolderLabel = new QLabel(tr("Unpainted File Folder:")); m_unpaintedFolder = - new DVGui::FileField(0, QString(tr("Same as Painted")), true); + new DVGui::FileField(0, QString(tr("Same as Painted")), true, true); m_suffixLabel = new QLabel(tr(" Unpainted File Suffix:")); m_unpaintedSuffix = new DVGui::LineEdit("_np"); m_applyAutoclose = new QCheckBox(tr("Apply Autoclose")); @@ -538,8 +538,9 @@ QFrame *ConvertPopup::createTlvSettings() { m_appendDefaultPalette = new QCheckBox(tr("Append Default Palette")); m_antialias = new QComboBox(); m_antialiasIntensity = new DVGui::IntLineEdit(0, 50, 0, 100); - m_palettePath = new DVGui::FileField(0, QString(CreateNewPalette), true); - m_tolerance = new DVGui::IntLineEdit(0, 0, 0, 255); + m_palettePath = + new DVGui::FileField(0, QString(CreateNewPalette), true, true); + m_tolerance = new DVGui::IntLineEdit(0, 0, 0, 255); m_removeUnusedStyles = new QCheckBox(tr("Remove Unused Styles from Input Palette")); diff --git a/toonz/sources/toonzqt/filefield.cpp b/toonz/sources/toonzqt/filefield.cpp index 3a32da2..1832f08 100644 --- a/toonz/sources/toonzqt/filefield.cpp +++ b/toonz/sources/toonzqt/filefield.cpp @@ -18,7 +18,8 @@ FileField::BrowserPopupController *FileField::m_browserPopupController = 0; // FileField //----------------------------------------------------------------------------- -FileField::FileField(QWidget *parent, QString path, bool readOnly) +FileField::FileField(QWidget *parent, QString path, bool readOnly, + bool doNotBrowseInitialPath) : QWidget(parent) , m_filters(QStringList()) , m_fileMode(QFileDialog::DirectoryOnly) @@ -33,6 +34,9 @@ FileField::FileField(QWidget *parent, QString path, bool readOnly) m_fileBrowseButton->setMinimumSize(20, WidgetHeight); m_fileBrowseButton->setObjectName("PushButton_NoPadding"); + // if the initial text is not path, set the string here and prevent browsing + if (doNotBrowseInitialPath) m_descriptionText = path; + QHBoxLayout *mainLayout = new QHBoxLayout(); mainLayout->setMargin(0); mainLayout->setSpacing(1); @@ -90,7 +94,7 @@ void FileField::browseDirectory() { if (!m_browserPopupController) return; m_browserPopupController->openPopup( m_filters, (m_fileMode == QFileDialog::DirectoryOnly), - m_lastSelectedPath); + (m_lastSelectedPath == m_descriptionText) ? "" : m_lastSelectedPath); if (m_browserPopupController->isExecute()) directory = m_browserPopupController->getPath();