53 #include "ui_preferencespathpage.h"
54 #include "../vmisc/vsettings.h"
55 #include "../../options.h"
56 #include "../../core/vapplication.h"
59 #include <QFileDialog>
95 const int row =
ui->pathTable->currentRow();
96 QTableWidgetItem *item =
ui->pathTable->item(row, 1);
126 item->setToolTip(path);
132 const int row =
ui->pathTable->currentRow();
133 QTableWidgetItem *item =
ui->pathTable->item(row, 1);
140 path =
qApp->Seamly2DSettings()->GetPathIndividualMeasurements();
143 path =
qApp->Seamly2DSettings()->GetPathMultisizeMeasurements();
147 path =
qApp->Seamly2DSettings()->GetPathPattern();
150 path =
qApp->Seamly2DSettings()->getLayoutPath();
153 path =
qApp->Seamly2DSettings()->GetPathTemplate();
156 path =
qApp->Seamly2DSettings()->GetPathLabelTemplate();
162 bool usedNotExistedDir =
false;
163 QDir directory(path);
164 if (not directory.exists())
166 usedNotExistedDir = directory.mkpath(
".");
169 const QString dir = QFileDialog::getExistingDirectory(
this, tr(
"Open Directory"), path,
170 QFileDialog::ShowDirsOnly
171 | QFileDialog::DontResolveSymlinks
172 | QFileDialog::DontUseNativeDialog);
175 if (usedNotExistedDir)
177 QDir directory(path);
178 directory.rmpath(
".");
185 item->setToolTip(dir);
187 if (usedNotExistedDir)
189 QDir directory(path);
190 directory.rmpath(
".");
197 ui->pathTable->setRowCount(6);
198 ui->pathTable->setColumnCount(2);
203 ui->pathTable->setItem(0, 0,
new QTableWidgetItem(tr(
"My Individual Measurements")));
206 ui->pathTable->setItem(0, 1, item);
210 ui->pathTable->setItem(1, 0,
new QTableWidgetItem(tr(
"My Multisize Measurements")));
213 ui->pathTable->setItem(1, 1, item);
217 ui->pathTable->setItem(2, 0,
new QTableWidgetItem(tr(
"My Patterns")));
218 QTableWidgetItem *item =
new QTableWidgetItem(settings->
GetPathPattern());
220 ui->pathTable->setItem(2, 1, item);
224 ui->pathTable->setItem(3, 0,
new QTableWidgetItem(tr(
"My Layouts")));
225 QTableWidgetItem *item =
new QTableWidgetItem(settings->
getLayoutPath());
227 ui->pathTable->setItem(3, 1, item);
231 ui->pathTable->setItem(4, 0,
new QTableWidgetItem(tr(
"My Templates")));
232 QTableWidgetItem *item =
new QTableWidgetItem(settings->
GetPathTemplate());
234 ui->pathTable->setItem(4, 1, item);
238 ui->pathTable->setItem(5, 0,
new QTableWidgetItem(tr(
"My label templates")));
241 ui->pathTable->setItem(5, 1, item);
244 ui->pathTable->verticalHeader()->setDefaultSectionSize(20);
245 ui->pathTable->resizeColumnsToContents();
246 ui->pathTable->resizeRowsToContents();
248 connect(
ui->pathTable, &QTableWidget::itemSelectionChanged,
this, [
this]()
250 ui->defaultButton->setEnabled(true);
251 ui->defaultButton->setDefault(false);
253 ui->editButton->setEnabled(true);
254 ui->editButton->setDefault(true);
virtual ~PreferencesPathPage()
Ui::PreferencesPathPage * ui
PreferencesPathPage(QWidget *parent=nullptr)
void SetPathLabelTemplate(const QString &value)
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)
QString GetPathLabelTemplate() const
static QString GetDefPathIndividualMeasurements()
void SetPathTemplate(const QString &value)
void SetPathMultisizeMeasurements(const QString &value)
static QString GetDefPathLabelTemplate()
static QString GetDefPathLayout()
static QString GetDefPathPattern()
void SetPathPattern(const QString &value)
void SetPathLayout(const QString &value)
QString GetPathPattern() const
QString getLayoutPath() const