53 #include "ui_seamlymepreferencespathpage.h"
54 #include "../../mapplication.h"
55 #include "../vmisc/vseamlymesettings.h"
58 #include <QFileDialog>
91 const int row =
ui->pathTable->currentRow();
92 QTableWidgetItem *item =
ui->pathTable->item(row, 1);
112 item->setToolTip(path);
118 const int row =
ui->pathTable->currentRow();
119 QTableWidgetItem *item =
ui->pathTable->item(row, 1);
126 path =
qApp->SeamlyMeSettings()->GetPathIndividualMeasurements();
129 path =
qApp->SeamlyMeSettings()->GetPathMultisizeMeasurements();
133 path =
qApp->SeamlyMeSettings()->GetPathTemplate();
139 bool usedNotExistedDir =
false;
140 QDir directory(path);
141 if (not directory.exists())
143 usedNotExistedDir = directory.mkpath(
".");
146 const QString dir = QFileDialog::getExistingDirectory(
this, tr(
"Open Directory"), path,
147 QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
150 if (usedNotExistedDir)
152 QDir directory(path);
153 directory.rmpath(
".");
161 item->setToolTip(dir);
167 ui->pathTable->setRowCount(3);
168 ui->pathTable->setColumnCount(2);
173 ui->pathTable->setItem(0, 0,
new QTableWidgetItem(tr(
"My Individual Measurements")));
176 ui->pathTable->setItem(0, 1, item);
180 ui->pathTable->setItem(1, 0,
new QTableWidgetItem(tr(
"My Multisize Measurements")));
183 ui->pathTable->setItem(1, 1, item);
187 ui->pathTable->setItem(2, 0,
new QTableWidgetItem(tr(
"My Templates")));
188 QTableWidgetItem *item =
new QTableWidgetItem(settings->
GetPathTemplate());
190 ui->pathTable->setItem(2, 1, item);
193 ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
194 ui->pathTable->resizeColumnsToContents();
195 ui->pathTable->resizeRowsToContents();
196 ui->pathTable->horizontalHeader()->setStretchLastSection(
true);
198 connect(
ui->pathTable, &QTableWidget::itemSelectionChanged,
this, [
this]()
200 ui->defaultButton->setEnabled(true);
201 ui->defaultButton->setDefault(false);
203 ui->editButton->setEnabled(true);
204 ui->editButton->setDefault(true);
virtual ~SeamlyMePreferencesPathPage()
Ui::SeamlyMePreferencesPathPage * ui
SeamlyMePreferencesPathPage(QWidget *parent=nullptr)
static QString GetDefPathMultisizeMeasurements()
static QString GetDefPathTemplate()
static QString PrepareMultisizeTables(const QString ¤tPath)
QString GetPathIndividualMeasurements() const
QString GetPathTemplate() const
QString GetPathMultisizeMeasurements() const
void SetPathIndividualMeasurements(const QString &value)
static QString GetDefPathIndividualMeasurements()
void SetPathTemplate(const QString &value)
void SetPathMultisizeMeasurements(const QString &value)