Commit 209d354c authored by dogmaphobic's avatar dogmaphobic

Removed the “selectedFilter” argument from the QGCFileDialog functions along...

Removed the “selectedFilter” argument from the QGCFileDialog functions along with references to it in unit tests.
Fixed function declarations and prototypes formatting while at it.
Changed the caption of a few file save dialogs with a more descriptive text (explicitly telling what is being saved).
parent 808a835d
...@@ -477,12 +477,13 @@ void QGCApplication::criticalMessageBoxOnMainThread(const QString& title, const ...@@ -477,12 +477,13 @@ void QGCApplication::criticalMessageBoxOnMainThread(const QString& title, const
void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile) void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile)
{ {
QString defaultSuffix("mavlink"); QString defaultSuffix("mavlink");
QString saveFilename = QGCFileDialog::getSaveFileName(MainWindow::instance(), QString saveFilename = QGCFileDialog::getSaveFileName(
tr("Select file to save Flight Data Log"), MainWindow::instance(),
qgcApp()->mavlinkLogFilesLocation(), tr("Select file to save Flight Data Log"),
tr("Flight Data Log (*.mavlink)"), qgcApp()->mavlinkLogFilesLocation(),
0,0, tr("Flight Data Log (*.mavlink)"),
&defaultSuffix); 0,
&defaultSuffix);
if (!saveFilename.isEmpty()) { if (!saveFilename.isEmpty()) {
QFile::copy(tempLogfile, saveFilename); QFile::copy(tempLogfile, saveFilename);
} }
......
...@@ -28,12 +28,13 @@ ...@@ -28,12 +28,13 @@
#include "UnitTest.h" #include "UnitTest.h"
#endif #endif
QString QGCFileDialog::getExistingDirectory(QWidget* parent, QString QGCFileDialog::getExistingDirectory(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
Options options) const QString& dir,
Options options)
{ {
_validate(NULL, options); _validate(options);
#ifdef QT_DEBUG #ifdef QT_DEBUG
if (qgcApp()->runningUnitTests()) { if (qgcApp()->runningUnitTests()) {
...@@ -45,65 +46,62 @@ QString QGCFileDialog::getExistingDirectory(QWidget* parent, ...@@ -45,65 +46,62 @@ QString QGCFileDialog::getExistingDirectory(QWidget* parent,
} }
} }
QString QGCFileDialog::getOpenFileName(QWidget* parent, QString QGCFileDialog::getOpenFileName(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
const QString& filter, const QString& dir,
QString* selectedFilter, const QString& filter,
Options options) Options options)
{ {
_validate(selectedFilter, options); _validate(options);
#ifdef QT_DEBUG #ifdef QT_DEBUG
if (qgcApp()->runningUnitTests()) { if (qgcApp()->runningUnitTests()) {
return UnitTest::_getOpenFileName(parent, caption, dir, filter, selectedFilter, options); return UnitTest::_getOpenFileName(parent, caption, dir, filter, options);
} else } else
#endif #endif
{ {
return QFileDialog::getOpenFileName(parent, caption, dir, filter, selectedFilter, options); return QFileDialog::getOpenFileName(parent, caption, dir, filter, NULL, options);
} }
} }
QStringList QGCFileDialog::getOpenFileNames(QWidget* parent, QStringList QGCFileDialog::getOpenFileNames(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
const QString& filter, const QString& dir,
QString* selectedFilter, const QString& filter,
Options options) Options options)
{ {
_validate(selectedFilter, options); _validate(options);
#ifdef QT_DEBUG #ifdef QT_DEBUG
if (qgcApp()->runningUnitTests()) { if (qgcApp()->runningUnitTests()) {
return UnitTest::_getOpenFileNames(parent, caption, dir, filter, selectedFilter, options); return UnitTest::_getOpenFileNames(parent, caption, dir, filter, options);
} else } else
#endif #endif
{ {
return QFileDialog::getOpenFileNames(parent, caption, dir, filter, selectedFilter, options); return QFileDialog::getOpenFileNames(parent, caption, dir, filter, NULL, options);
} }
} }
QString QGCFileDialog::getSaveFileName(QWidget* parent, QString QGCFileDialog::getSaveFileName(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
const QString& filter, const QString& dir,
QString* selectedFilter, const QString& filter,
Options options, Options options,
QString* defaultSuffix) QString* defaultSuffix)
{ {
_validate(selectedFilter, options); _validate(options);
#ifdef QT_DEBUG #ifdef QT_DEBUG
if (qgcApp()->runningUnitTests()) { if (qgcApp()->runningUnitTests()) {
return UnitTest::_getSaveFileName(parent, caption, dir, filter, selectedFilter, options, defaultSuffix); return UnitTest::_getSaveFileName(parent, caption, dir, filter, options, defaultSuffix);
} else } else
#endif #endif
{ {
QFileDialog dlg(parent, caption, dir, filter); QFileDialog dlg(parent, caption, dir, filter);
dlg.setAcceptMode(QFileDialog::AcceptSave); dlg.setAcceptMode(QFileDialog::AcceptSave);
if (selectedFilter) {
dlg.selectNameFilter(*selectedFilter);
}
if (options) { if (options) {
dlg.setOptions(options); dlg.setOptions(options);
} }
...@@ -124,17 +122,13 @@ QString QGCFileDialog::getSaveFileName(QWidget* parent, ...@@ -124,17 +122,13 @@ QString QGCFileDialog::getSaveFileName(QWidget* parent,
} }
/// @brief Validates and updates the parameters for the file dialog calls /// @brief Validates and updates the parameters for the file dialog calls
void QGCFileDialog::_validate(QString* selectedFilter, Options& options) void QGCFileDialog::_validate(Options& options)
{ {
// You can't use QGCFileDialog if QGCApplication is not created yet. // You can't use QGCFileDialog if QGCApplication is not created yet.
Q_ASSERT(qgcApp()); Q_ASSERT(qgcApp());
Q_ASSERT_X(QThread::currentThread() == qgcApp()->thread(), "Threading issue", "QGCFileDialog can only be called from main thread"); Q_ASSERT_X(QThread::currentThread() == qgcApp()->thread(), "Threading issue", "QGCFileDialog can only be called from main thread");
// Support for selectedFilter is not yet implemented through the unit test framework
Q_UNUSED(selectedFilter);
Q_ASSERT(selectedFilter == NULL);
// On OSX native dialog can hang so we always use Qt dialogs // On OSX native dialog can hang so we always use Qt dialogs
options |= DontUseNativeDialog; options |= DontUseNativeDialog;
......
...@@ -50,10 +50,11 @@ public: ...@@ -50,10 +50,11 @@ public:
@return The chosen path or \c QString("") if none. @return The chosen path or \c QString("") if none.
@sa <a href="http://qt-project.org/doc/qt-5/qfiledialog.html#getExistingDirectory">QFileDialog::getExistingDirectory()</a> @sa <a href="http://qt-project.org/doc/qt-5/qfiledialog.html#getExistingDirectory">QFileDialog::getExistingDirectory()</a>
*/ */
static QString getExistingDirectory(QWidget* parent = 0, static QString getExistingDirectory(
const QString& caption = QString(), QWidget* parent = 0,
const QString& dir = QString(), const QString& caption = QString(),
Options options = ShowDirsOnly); const QString& dir = QString(),
Options options = ShowDirsOnly);
//! Static helper that invokes a File Open dialog where the user can select a file to be opened. //! Static helper that invokes a File Open dialog where the user can select a file to be opened.
/*! /*!
...@@ -61,17 +62,16 @@ public: ...@@ -61,17 +62,16 @@ public:
@param[in] caption The caption displayed at the top of the dialog. @param[in] caption The caption displayed at the top of the dialog.
@param[in] dir The initial directory shown to the user. @param[in] dir The initial directory shown to the user.
@param[in] filter The filter used for selecting the file type. @param[in] filter The filter used for selecting the file type.
@param[out] selectedFilter **NOT IMPLEMENTED - Set to NULL** Returns the filter that the user selected in the file dialog.
@param[in] options Set the various options that affect the look and feel of the dialog. @param[in] options Set the various options that affect the look and feel of the dialog.
@return The full path and filename to be opened or \c QString("") if none. @return The full path and filename to be opened or \c QString("") if none.
@sa <a href="http://qt-project.org/doc/qt-5/qfiledialog.html#getOpenFileName">QFileDialog::getOpenFileName()</a> @sa <a href="http://qt-project.org/doc/qt-5/qfiledialog.html#getOpenFileName">QFileDialog::getOpenFileName()</a>
*/ */
static QString getOpenFileName(QWidget* parent = 0, static QString getOpenFileName(
const QString& caption = QString(), QWidget* parent = 0,
const QString& dir = QString(), const QString& caption = QString(),
const QString& filter = QString(), const QString& dir = QString(),
QString* selectedFilter = 0, const QString& filter = QString(),
Options options = 0); Options options = 0);
//! Static helper that invokes a File Open dialog where the user can select one or more files to be opened. //! Static helper that invokes a File Open dialog where the user can select one or more files to be opened.
/*! /*!
...@@ -79,17 +79,16 @@ public: ...@@ -79,17 +79,16 @@ public:
@param[in] caption The caption displayed at the top of the dialog. @param[in] caption The caption displayed at the top of the dialog.
@param[in] dir The initial directory shown to the user. @param[in] dir The initial directory shown to the user.
@param[in] filter The filter used for selecting the file type. @param[in] filter The filter used for selecting the file type.
@param[out] selectedFilter **NOT IMPLEMENTED - Set to NULL** Returns the filter that the user selected in the file dialog.
@param[in] options Set the various options that affect the look and feel of the dialog. @param[in] options Set the various options that affect the look and feel of the dialog.
@return A <a href="http://qt-project.org/doc/qt-5/qstringlist.html">QStringList</a> object containing zero or more files to be opened. @return A <a href="http://qt-project.org/doc/qt-5/qstringlist.html">QStringList</a> object containing zero or more files to be opened.
@sa <a href="http://qt-project.org/doc/qt-5/qfiledialog.html#getOpenFileNames">QFileDialog::getOpenFileNames()</a> @sa <a href="http://qt-project.org/doc/qt-5/qfiledialog.html#getOpenFileNames">QFileDialog::getOpenFileNames()</a>
*/ */
static QStringList getOpenFileNames(QWidget* parent = 0, static QStringList getOpenFileNames(
const QString& caption = QString(), QWidget* parent = 0,
const QString& dir = QString(), const QString& caption = QString(),
const QString& filter = QString(), const QString& dir = QString(),
QString* selectedFilter = 0, const QString& filter = QString(),
Options options = 0); Options options = 0);
//! Static helper that invokes a File Save dialog where the user can select a directory and enter a filename to be saved. //! Static helper that invokes a File Save dialog where the user can select a directory and enter a filename to be saved.
/*! /*!
...@@ -97,7 +96,6 @@ public: ...@@ -97,7 +96,6 @@ public:
@param[in] caption The caption displayed at the top of the dialog. @param[in] caption The caption displayed at the top of the dialog.
@param[in] dir The initial directory shown to the user. @param[in] dir The initial directory shown to the user.
@param[in] filter The filter used for selecting the file type. @param[in] filter The filter used for selecting the file type.
@param[out] selectedFilter **NOT IMPLEMENTED - Set to NULL** Returns the filter that the user selected in the file dialog.
@param[in] options Set the various options that affect the look and feel of the dialog. @param[in] options Set the various options that affect the look and feel of the dialog.
@param[in] defaultSuffix Specifies a string that will be added to the filename if it has no suffix already. The suffix is typically used to indicate the file type (e.g. "txt" indicates a text file). @param[in] defaultSuffix Specifies a string that will be added to the filename if it has no suffix already. The suffix is typically used to indicate the file type (e.g. "txt" indicates a text file).
@return The full path and filename to be used to save the file or \c QString("") if none. @return The full path and filename to be used to save the file or \c QString("") if none.
...@@ -105,21 +103,21 @@ public: ...@@ -105,21 +103,21 @@ public:
@remark If a default suffix is given, it will be appended to the filename if the user does not enter one themselves. That is, if the user simply enters \e foo and the default suffix is set to \e bar, @remark If a default suffix is given, it will be appended to the filename if the user does not enter one themselves. That is, if the user simply enters \e foo and the default suffix is set to \e bar,
the returned filename will be \e foo.bar. However, if the user specifies a suffix, none will be added. That is, if the user enters \e foo.txt, that's what you will receive in return. the returned filename will be \e foo.bar. However, if the user specifies a suffix, none will be added. That is, if the user enters \e foo.txt, that's what you will receive in return.
*/ */
static QString getSaveFileName(QWidget* parent = 0, static QString getSaveFileName(
const QString& caption = QString(), QWidget* parent = 0,
const QString& dir = QString(), const QString& caption = QString(),
const QString& filter = QString(), const QString& dir = QString(),
QString* selectedFilter = 0, const QString& filter = QString(),
Options options = 0, Options options = 0,
QString* defaultSuffix = 0); QString* defaultSuffix = 0);
private slots: private slots:
/// @brief The exec slot is private becasue when only want QGCFileDialog users to use the static methods. Otherwise it will break /// @brief The exec slot is private becasue we only want QGCFileDialog users to use the static methods. Otherwise it will break
/// unit testing. /// unit testing.
int exec(void) { return QGCFileDialog::exec(); } int exec(void) { return QGCFileDialog::exec(); }
private: private:
static void _validate(QString* selectedFilter, Options& options); static void _validate(Options& options);
}; };
......
...@@ -273,10 +273,11 @@ QString UnitTest::_fileDialogResponseSingle(enum FileDialogType type) ...@@ -273,10 +273,11 @@ QString UnitTest::_fileDialogResponseSingle(enum FileDialogType type)
return retFile; return retFile;
} }
QString UnitTest::_getExistingDirectory(QWidget* parent, QString UnitTest::_getExistingDirectory(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
QFileDialog::Options options) const QString& dir,
QFileDialog::Options options)
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
Q_UNUSED(caption); Q_UNUSED(caption);
...@@ -286,12 +287,12 @@ QString UnitTest::_getExistingDirectory(QWidget* parent, ...@@ -286,12 +287,12 @@ QString UnitTest::_getExistingDirectory(QWidget* parent,
return _fileDialogResponseSingle(getExistingDirectory); return _fileDialogResponseSingle(getExistingDirectory);
} }
QString UnitTest::_getOpenFileName(QWidget* parent, QString UnitTest::_getOpenFileName(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
const QString& filter, const QString& dir,
QString* selectedFilter, const QString& filter,
QFileDialog::Options options) QFileDialog::Options options)
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
Q_UNUSED(caption); Q_UNUSED(caption);
...@@ -299,18 +300,15 @@ QString UnitTest::_getOpenFileName(QWidget* parent, ...@@ -299,18 +300,15 @@ QString UnitTest::_getOpenFileName(QWidget* parent,
Q_UNUSED(filter); Q_UNUSED(filter);
Q_UNUSED(options); Q_UNUSED(options);
// Support for selectedFilter is not yet implemented
Q_ASSERT(selectedFilter == NULL);
return _fileDialogResponseSingle(getOpenFileName); return _fileDialogResponseSingle(getOpenFileName);
} }
QStringList UnitTest::_getOpenFileNames(QWidget* parent, QStringList UnitTest::_getOpenFileNames(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
const QString& filter, const QString& dir,
QString* selectedFilter, const QString& filter,
QFileDialog::Options options) QFileDialog::Options options)
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
Q_UNUSED(caption); Q_UNUSED(caption);
...@@ -318,9 +316,6 @@ QStringList UnitTest::_getOpenFileNames(QWidget* parent, ...@@ -318,9 +316,6 @@ QStringList UnitTest::_getOpenFileNames(QWidget* parent,
Q_UNUSED(filter); Q_UNUSED(filter);
Q_UNUSED(options); Q_UNUSED(options);
// Support for selectedFilter is not yet implemented
Q_ASSERT(selectedFilter == NULL);
QStringList retFiles; QStringList retFiles;
if (!_fileDialogResponseSet || _fileDialogExpectedType != getOpenFileNames) { if (!_fileDialogResponseSet || _fileDialogExpectedType != getOpenFileNames) {
...@@ -340,13 +335,13 @@ QStringList UnitTest::_getOpenFileNames(QWidget* parent, ...@@ -340,13 +335,13 @@ QStringList UnitTest::_getOpenFileNames(QWidget* parent,
return retFiles; return retFiles;
} }
QString UnitTest::_getSaveFileName(QWidget* parent, QString UnitTest::_getSaveFileName(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
const QString& filter, const QString& dir,
QString* selectedFilter, const QString& filter,
QFileDialog::Options options, QFileDialog::Options options,
QString* defaultSuffix) QString* defaultSuffix)
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
Q_UNUSED(caption); Q_UNUSED(caption);
...@@ -357,8 +352,5 @@ QString UnitTest::_getSaveFileName(QWidget* parent, ...@@ -357,8 +352,5 @@ QString UnitTest::_getSaveFileName(QWidget* parent,
if(defaultSuffix) if(defaultSuffix)
Q_ASSERT(defaultSuffix->startsWith(".") == false); Q_ASSERT(defaultSuffix->startsWith(".") == false);
// Support for selectedFilter is not yet implemented
Q_ASSERT(selectedFilter == NULL);
return _fileDialogResponseSingle(getSaveFileName); return _fileDialogResponseSingle(getSaveFileName);
} }
...@@ -118,32 +118,33 @@ private: ...@@ -118,32 +118,33 @@ private:
// When the app is running in unit test mode the QGCFileDialog methods are re-routed here. // When the app is running in unit test mode the QGCFileDialog methods are re-routed here.
static QString _getExistingDirectory(QWidget* parent, static QString _getExistingDirectory(
const QString& caption, QWidget* parent,
const QString& dir, const QString& caption,
QFileDialog::Options options); const QString& dir,
QFileDialog::Options options);
static QString _getOpenFileName(QWidget* parent,
const QString& caption, static QString _getOpenFileName(
const QString& dir, QWidget* parent,
const QString& filter, const QString& caption,
QString* selectedFilter, const QString& dir,
QFileDialog::Options options); const QString& filter,
QFileDialog::Options options);
static QStringList _getOpenFileNames(QWidget* parent,
const QString& caption, static QStringList _getOpenFileNames(
const QString& dir, QWidget* parent,
const QString& filter, const QString& caption,
QString* selectedFilter, const QString& dir,
QFileDialog::Options options); const QString& filter,
QFileDialog::Options options);
static QString _getSaveFileName(QWidget* parent,
const QString& caption, static QString _getSaveFileName(
const QString& dir, QWidget* parent,
const QString& filter, const QString& caption,
QString* selectedFilter, const QString& dir,
QFileDialog::Options options, const QString& filter,
QString* defaultSuffix); QFileDialog::Options options,
QString* defaultSuffix);
static QString _fileDialogResponseSingle(enum FileDialogType type); static QString _fileDialogResponseSingle(enum FileDialogType type);
......
...@@ -836,16 +836,18 @@ void MainWindow::configureWindowName() ...@@ -836,16 +836,18 @@ void MainWindow::configureWindowName()
void MainWindow::startVideoCapture() void MainWindow::startVideoCapture()
{ {
// TODO: What is this? What kind of "Video" is saved to bmp?
QString format("bmp"); QString format("bmp");
QString initialPath = QDir::currentPath() + tr("/untitled.") + format; QString initialPath = QDir::currentPath() + tr("/untitled.") + format;
QString screenFileName = QGCFileDialog::getSaveFileName(this, tr("Save As"), QString screenFileName = QGCFileDialog::getSaveFileName(
initialPath, this, tr("Save Video Capture"),
tr("%1 Files (*.%2);;All Files (*)") initialPath,
.arg(format.toUpper()) tr("%1 Files (*.%2);;All Files (*)")
.arg(format), .arg(format.toUpper())
0,0, .arg(format),
&format); 0,
&format);
delete videoTimer; delete videoTimer;
videoTimer = new QTimer(this); videoTimer = new QTimer(this);
} }
......
...@@ -106,7 +106,7 @@ void QGCBaseParamWidget::saveParametersToFile() ...@@ -106,7 +106,7 @@ void QGCBaseParamWidget::saveParametersToFile()
if (!mav) if (!mav)
return; return;
QString defaultSuffix("txt"); QString defaultSuffix("txt");
QString fileName = QGCFileDialog::getSaveFileName(this, tr("Save File"), qgcApp()->savedParameterFilesLocation(), tr("Parameter File (*.txt)"), 0, 0, &defaultSuffix); QString fileName = QGCFileDialog::getSaveFileName(this, tr("Save Parameters"), qgcApp()->savedParameterFilesLocation(), tr("Parameter File (*.txt)"), 0, &defaultSuffix);
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
return; return;
...@@ -123,7 +123,7 @@ void QGCBaseParamWidget::loadParametersFromFile() ...@@ -123,7 +123,7 @@ void QGCBaseParamWidget::loadParametersFromFile()
if (!mav) if (!mav)
return; return;
QString fileName = QGCFileDialog::getOpenFileName(this, tr("Load File"), qgcApp()->savedParameterFilesLocation(), tr("Parameter file (*.txt)")); QString fileName = QGCFileDialog::getOpenFileName(this, tr("Load Parameters"), qgcApp()->savedParameterFilesLocation(), tr("Parameter file (*.txt)"));
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return; return;
......
...@@ -119,7 +119,7 @@ QString QGCDataPlot2D::getSavePlotFilename() ...@@ -119,7 +119,7 @@ QString QGCDataPlot2D::getSavePlotFilename()
QString fileName = QGCFileDialog::getSaveFileName( QString fileName = QGCFileDialog::getSaveFileName(
this, "Export File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), this, "Export File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
"PDF Documents (*.pdf);;SVG Images (*.svg)", "PDF Documents (*.pdf);;SVG Images (*.svg)",
0,0, 0,
&defaultSuffix); &defaultSuffix);
return fileName; return fileName;
} }
...@@ -694,7 +694,7 @@ void QGCDataPlot2D::saveCsvLog() ...@@ -694,7 +694,7 @@ void QGCDataPlot2D::saveCsvLog()
QString fileName = QGCFileDialog::getSaveFileName( QString fileName = QGCFileDialog::getSaveFileName(
this, "Export CSV File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), this, "Export CSV File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
"CSV file (*.csv);;Text file (*.txt)", "CSV file (*.csv);;Text file (*.txt)",
0,0, 0,
&defaultSuffix); &defaultSuffix);
if (fileName.isEmpty()) if (fileName.isEmpty())
......
...@@ -218,7 +218,7 @@ void WaypointList::setUAS(UASInterface* uas) ...@@ -218,7 +218,7 @@ void WaypointList::setUAS(UASInterface* uas)
void WaypointList::saveWaypoints() void WaypointList::saveWaypoints()
{ {
QString defaultSuffix("txt"); QString defaultSuffix("txt");
QString fileName = QGCFileDialog::getSaveFileName(this, tr("Save File"), "./waypoints.txt", tr("Waypoint File (*.txt)"), 0, 0, &defaultSuffix); QString fileName = QGCFileDialog::getSaveFileName(this, tr("Save File"), "./waypoints.txt", tr("Waypoint File (*.txt)"), 0, &defaultSuffix);
WPM->saveWaypoints(fileName); WPM->saveWaypoints(fileName);
} }
......
...@@ -574,10 +574,10 @@ void QGCToolWidget::exportWidget() ...@@ -574,10 +574,10 @@ void QGCToolWidget::exportWidget()
QString defaultSuffix("qgw"); QString defaultSuffix("qgw");
const QString widgetFileExtension(".qgw"); const QString widgetFileExtension(".qgw");
QString fileName = QGCFileDialog::getSaveFileName( QString fileName = QGCFileDialog::getSaveFileName(
this, tr("Specify File Name"), this, tr("Specify Widget File Name"),
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
tr("QGroundControl Widget (*%1)").arg(widgetFileExtension), tr("QGroundControl Widget (*%1)").arg(widgetFileExtension),
0,0, 0,
&defaultSuffix); &defaultSuffix);
//-- Note that if the user enters foo.bar, this will end up foo.bar.qgw //-- Note that if the user enters foo.bar, this will end up foo.bar.qgw
if (!fileName.endsWith(widgetFileExtension)) if (!fileName.endsWith(widgetFileExtension))
......
...@@ -435,10 +435,10 @@ QString LinechartWidget::getLogSaveFilename() ...@@ -435,10 +435,10 @@ QString LinechartWidget::getLogSaveFilename()
{ {
QString defaultSuffix("log"); QString defaultSuffix("log");
QString fileName = QGCFileDialog::getSaveFileName(this, QString fileName = QGCFileDialog::getSaveFileName(this,
tr("Specify log file name"), tr("Specify Log File Name"),
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
tr("Logfile (*.log)"), tr("Log file (*.log)"),
0,0, 0,
&defaultSuffix); &defaultSuffix);
return fileName; return fileName;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment