Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/SettingsDialog/SaveOptionsPage.cpp
Show All 40 Lines | 39 | { | |||
---|---|---|---|---|---|
41 | setLayout(mainLayout); | 41 | setLayout(mainLayout); | ||
42 | 42 | | |||
43 | // Save location | 43 | // Save location | ||
44 | mUrlRequester = new KUrlRequester; | 44 | mUrlRequester = new KUrlRequester; | ||
45 | mUrlRequester->setMode(KFile::Directory); | 45 | mUrlRequester->setMode(KFile::Directory); | ||
46 | connect(mUrlRequester, &KUrlRequester::textChanged, this, &SaveOptionsPage::markDirty); | 46 | connect(mUrlRequester, &KUrlRequester::textChanged, this, &SaveOptionsPage::markDirty); | ||
47 | mainLayout->addRow(i18n("Save Location:"), mUrlRequester); | 47 | mainLayout->addRow(i18n("Save Location:"), mUrlRequester); | ||
48 | 48 | | |||
49 | // autosave the image to the location 'mUrlRequester' with the name from 'mSaveNameFormat' | ||||
50 | mAutoSaveImage = new QCheckBox(i18n("Autosave the image to 'Save location' with 'Filename'"), this); | ||||
51 | connect(mAutoSaveImage, &QCheckBox::toggled, this, &SaveOptionsPage::markDirty); | ||||
52 | mainLayout->addRow(QString(), mAutoSaveImage); | ||||
53 | | ||||
49 | // copy file location to clipboard after saving | 54 | // copy file location to clipboard after saving | ||
50 | mCopyPathToClipboard = new QCheckBox(i18n("Copy file location to clipboard after saving"), this); | 55 | mCopyPathToClipboard = new QCheckBox(i18n("Copy file location to clipboard after saving"), this); | ||
51 | connect(mCopyPathToClipboard, &QCheckBox::toggled, this, &SaveOptionsPage::markDirty); | 56 | connect(mCopyPathToClipboard, &QCheckBox::toggled, this, &SaveOptionsPage::markDirty); | ||
52 | mainLayout->addRow(QString(), mCopyPathToClipboard); | 57 | mainLayout->addRow(QString(), mCopyPathToClipboard); | ||
53 | 58 | | |||
54 | 59 | | |||
55 | mainLayout->addItem(new QSpacerItem(0, 18, QSizePolicy::Fixed, QSizePolicy::Fixed)); | 60 | mainLayout->addItem(new QSpacerItem(0, 18, QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
56 | 61 | | |||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 165 | { | |||
162 | 167 | | |||
163 | SpectacleConfig *cfgManager = SpectacleConfig::instance(); | 168 | SpectacleConfig *cfgManager = SpectacleConfig::instance(); | ||
164 | 169 | | |||
165 | // save the data | 170 | // save the data | ||
166 | 171 | | |||
167 | cfgManager->setDefaultSaveLocation(mUrlRequester->url()); | 172 | cfgManager->setDefaultSaveLocation(mUrlRequester->url()); | ||
168 | cfgManager->setAutoSaveFilenameFormat(mSaveNameFormat->text()); | 173 | cfgManager->setAutoSaveFilenameFormat(mSaveNameFormat->text()); | ||
169 | cfgManager->setSaveImageFormat(mSaveImageFormat->currentText().toLower()); | 174 | cfgManager->setSaveImageFormat(mSaveImageFormat->currentText().toLower()); | ||
175 | cfgManager->setAutoSaveImage(mAutoSaveImage->checkState() == Qt::Checked); | ||||
170 | cfgManager->setCopySaveLocationToClipboard(mCopyPathToClipboard->checkState() == Qt::Checked); | 176 | cfgManager->setCopySaveLocationToClipboard(mCopyPathToClipboard->checkState() == Qt::Checked); | ||
171 | cfgManager->setCompressionQuality(mQualitySlider->value()); | 177 | cfgManager->setCompressionQuality(mQualitySlider->value()); | ||
172 | 178 | | |||
173 | // done | 179 | // done | ||
174 | 180 | | |||
175 | mChangesMade = false; | 181 | mChangesMade = false; | ||
176 | } | 182 | } | ||
177 | 183 | | |||
178 | void SaveOptionsPage::resetChanges() | 184 | void SaveOptionsPage::resetChanges() | ||
179 | { | 185 | { | ||
180 | // bring up the configuration reader | 186 | // bring up the configuration reader | ||
181 | 187 | | |||
182 | SpectacleConfig *cfgManager = SpectacleConfig::instance(); | 188 | SpectacleConfig *cfgManager = SpectacleConfig::instance(); | ||
183 | 189 | | |||
184 | // read in the data | 190 | // read in the data | ||
185 | 191 | | |||
186 | mSaveNameFormat->setText(cfgManager->autoSaveFilenameFormat()); | 192 | mSaveNameFormat->setText(cfgManager->autoSaveFilenameFormat()); | ||
187 | mUrlRequester->setUrl(cfgManager->defaultSaveLocation()); | 193 | mUrlRequester->setUrl(cfgManager->defaultSaveLocation()); | ||
194 | mAutoSaveImage->setChecked(cfgManager->autoSaveImage()); | ||||
188 | mCopyPathToClipboard->setChecked(cfgManager->copySaveLocationToClipboard()); | 195 | mCopyPathToClipboard->setChecked(cfgManager->copySaveLocationToClipboard()); | ||
189 | mQualitySlider->setSliderPosition(cfgManager->compressionQuality()); | 196 | mQualitySlider->setSliderPosition(cfgManager->compressionQuality()); | ||
190 | 197 | | |||
191 | // read in the save image format and calculate its index | 198 | // read in the save image format and calculate its index | ||
192 | 199 | | |||
193 | { | 200 | { | ||
194 | int index = mSaveImageFormat->findText(cfgManager->saveImageFormat().toUpper()); | 201 | int index = mSaveImageFormat->findText(cfgManager->saveImageFormat().toUpper()); | ||
195 | if (index >= 0) { | 202 | if (index >= 0) { | ||
Show All 29 Lines |