mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-99 Add a Path chooser to the name of the INI file for better ease of use.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2119 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
b8b1fd61b7
commit
213e582f56
@ -45,6 +45,11 @@ ImportExportGadgetWidget::ImportExportGadgetWidget(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->configFile->setExpectedKind(Utils::PathChooser::File);
|
||||||
|
ui->configFile->setPromptDialogFilter(tr("INI file (*.ini);; XML file (*.xml)"));
|
||||||
|
ui->configFile->setPromptDialogTitle(tr("Choose filename"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportExportGadgetWidget::~ImportExportGadgetWidget()
|
ImportExportGadgetWidget::~ImportExportGadgetWidget()
|
||||||
@ -68,12 +73,12 @@ void ImportExportGadgetWidget::loadConfiguration(const ImportExportGadgetConfigu
|
|||||||
if ( !config )
|
if ( !config )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ui->configFile->setText(config->getIniFile());
|
ui->configFile->setPath(config->getIniFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportExportGadgetWidget::on_exportButton_clicked()
|
void ImportExportGadgetWidget::on_exportButton_clicked()
|
||||||
{
|
{
|
||||||
QString file = ui->configFile->text();
|
QString file = ui->configFile->path();
|
||||||
qDebug() << "Export pressed! Write to file " << QFileInfo(file).absoluteFilePath();
|
qDebug() << "Export pressed! Write to file " << QFileInfo(file).absoluteFilePath();
|
||||||
|
|
||||||
if ( QFileInfo(file).exists() ){
|
if ( QFileInfo(file).exists() ){
|
||||||
@ -142,7 +147,7 @@ void ImportExportGadgetWidget::writeError(const QString& msg) const
|
|||||||
|
|
||||||
void ImportExportGadgetWidget::on_importButton_clicked()
|
void ImportExportGadgetWidget::on_importButton_clicked()
|
||||||
{
|
{
|
||||||
QString file = ui->configFile->text();
|
QString file = ui->configFile->path();
|
||||||
qDebug() << "Import pressed! Read from file " << QFileInfo(file).absoluteFilePath();
|
qDebug() << "Import pressed! Read from file " << QFileInfo(file).absoluteFilePath();
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
if (! QFileInfo(file).isReadable()) {
|
if (! QFileInfo(file).isReadable()) {
|
||||||
|
@ -18,13 +18,26 @@
|
|||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Config File</string>
|
<string>Config File</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="configFile"/>
|
<widget class="Utils::PathChooser" name="configFile" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@ -110,6 +123,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>Utils::PathChooser</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>utils/pathchooser.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user