Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/SettingsDialog/SaveOptionsPage.cpp
Show All 14 Lines | |||||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "SaveOptionsPage.h" | 20 | #include "SaveOptionsPage.h" | ||
21 | 21 | | |||
22 | #include "SpectacleConfig.h" | 22 | #include "SpectacleConfig.h" | ||
23 | #include "ExportManager.h" | ||||
23 | 24 | | |||
24 | #include <KIOWidgets/KUrlRequester> | 25 | #include <KIOWidgets/KUrlRequester> | ||
25 | #include <KLocalizedString> | 26 | #include <KLocalizedString> | ||
26 | 27 | | |||
27 | #include <QLineEdit> | 28 | #include <QLineEdit> | ||
28 | #include <QLabel> | 29 | #include <QLabel> | ||
29 | #include <QFormLayout> | 30 | #include <QFormLayout> | ||
30 | #include <QGroupBox> | 31 | #include <QGroupBox> | ||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 115 | mSaveImageFormat->addItems([&](){ | |||
118 | } | 119 | } | ||
119 | return items; | 120 | return items; | ||
120 | }()); | 121 | }()); | ||
121 | connect(mSaveImageFormat, &QComboBox::currentTextChanged, this, &SaveOptionsPage::markDirty); | 122 | connect(mSaveImageFormat, &QComboBox::currentTextChanged, this, &SaveOptionsPage::markDirty); | ||
122 | saveFieldLayout->addWidget(mSaveImageFormat); | 123 | saveFieldLayout->addWidget(mSaveImageFormat); | ||
123 | saveNameLayout->addLayout(saveFieldLayout); | 124 | saveNameLayout->addLayout(saveFieldLayout); | ||
124 | 125 | | |||
125 | // now the save filename format layout | 126 | // now the save filename format layout | ||
126 | const QString helpText = i18nc("%1 is the default filename of a screenshot", | 127 | QString helpText = i18n( | ||
127 | "<p>You can use the following placeholders in the filename, which will be replaced " | 128 | "You can use the following placeholders in the filename, which will be replaced " | ||
128 | "with actual text when the file is saved:</p>" | 129 | "with actual text when the file is saved:<blockquote>" | ||
129 | | ||||
130 | "<blockquote>" | | |||
131 | "<b>%Y</b>: Year (4 digit)<br />" | | |||
132 | "<b>%y</b>: Year (2 digit)<br />" | | |||
133 | "<b>%M</b>: Month<br />" | | |||
134 | "<b>%D</b>: Day<br />" | | |||
135 | "<b>%H</b>: Hour<br />" | | |||
136 | "<b>%m</b>: Minute<br />" | | |||
137 | "<b>%S</b>: Second<br />" | | |||
138 | "<b>%T</b>: Window title<br />" | | |||
139 | "<b>%d</b>: Sequential numbering<br />" | | |||
140 | "<b>%Nd</b>: Sequential numbering, padded out to N digits" | | |||
141 | "</blockquote>" | | |||
142 | | ||||
143 | "<p>To save to a sub-folder, use slashes, e.g.:</p>" | | |||
144 | | ||||
145 | "<blockquote>" | | |||
146 | "<b>%Y</b>/<b>%M</b>/%1" | | |||
147 | "</blockquote>", | | |||
148 | SpectacleConfig::instance()->defaultFilename() + SpectacleConfig::instance()->defaultTimestampTemplate() | | |||
149 | ); | 130 | ); | ||
150 | 131 | for (auto option = ExportManager::filenamePlaceholders.cbegin(); | |||
132 | option != ExportManager::filenamePlaceholders.cend(); ++option) { | ||||
133 | helpText += QStringLiteral("<a href=%1>%1</a>: %2<br>").arg(option.key(), option.value()); | ||||
134 | } | ||||
135 | helpText += QStringLiteral("<a href='/'>/</a>: ") + i18n("To save to a sub-folder"); | ||||
ngraham: Forgot a space in this string between the character and the explanatory text. | |||||
136 | helpText += QStringLiteral("</blockquote>"); | ||||
151 | QLabel *fmtHelpText = new QLabel(helpText, this); | 137 | QLabel *fmtHelpText = new QLabel(helpText, this); | ||
152 | fmtHelpText->setWordWrap(true); | 138 | fmtHelpText->setWordWrap(true); | ||
153 | fmtHelpText->setTextFormat(Qt::RichText); | 139 | fmtHelpText->setTextFormat(Qt::RichText); | ||
154 | fmtHelpText->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); | 140 | fmtHelpText->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); | ||
141 | connect(fmtHelpText, &QLabel::linkActivated, [this](const QString& placeholder) { | ||||
142 | mSaveNameFormat->insert(placeholder); | ||||
143 | }); | ||||
155 | saveNameLayout->addWidget(fmtHelpText); | 144 | saveNameLayout->addWidget(fmtHelpText); | ||
156 | mainLayout->addRow(i18n("Filename:"), saveNameLayout); | 145 | mainLayout->addRow(i18n("Filename:"), saveNameLayout); | ||
157 | 146 | | |||
158 | // read in the data | 147 | // read in the data | ||
159 | resetChanges(); | 148 | resetChanges(); | ||
160 | } | 149 | } | ||
161 | 150 | | |||
162 | void SaveOptionsPage::markDirty() | 151 | void SaveOptionsPage::markDirty() | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |
Forgot a space in this string between the character and the explanatory text.