Make tray options translatable
This commit is contained in:
parent
b081b5adc1
commit
433ee87ce5
@ -38,20 +38,10 @@ void MainWindow::rec() {
|
|||||||
|
|
||||||
#define ACTION(english, menu) \
|
#define ACTION(english, menu) \
|
||||||
[&]() -> QAction * { \
|
[&]() -> QAction * { \
|
||||||
QAction *a = menu->addAction(tr(english)); \
|
QAction *a = menu->addAction(english); \
|
||||||
acts.insert(a, english); \
|
|
||||||
return a; \
|
return a; \
|
||||||
}()
|
}()
|
||||||
|
|
||||||
void MainWindow::changeEvent(QEvent *e) {
|
|
||||||
if (e->type() == QEvent::LocaleChange) {
|
|
||||||
ui->retranslateUi(this);
|
|
||||||
for (auto key : acts.keys()) {
|
|
||||||
key->setText(tr(acts.value(key)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void addHotkey(QString name, std::function<void()> action) {
|
void addHotkey(QString name, std::function<void()> action) {
|
||||||
hotkeying::load(name, action);
|
hotkeying::load(name, action);
|
||||||
}
|
}
|
||||||
@ -64,19 +54,19 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
tray->setToolTip("KShare");
|
tray->setToolTip("KShare");
|
||||||
tray->setVisible(true);
|
tray->setVisible(true);
|
||||||
menu = new QMenu(this);
|
menu = new QMenu(this);
|
||||||
QAction *quit = ACTION("Quit", menu);
|
QAction *quit = ACTION(tr("Quit"), menu);
|
||||||
QAction *shtoggle = ACTION("Show/Hide", menu);
|
QAction *shtoggle = ACTION(tr("Show/Hide"), menu);
|
||||||
QAction *fullscreen = ACTION("Take fullscreen shot", menu);
|
QAction *fullscreen = ACTION(tr("Take fullscreen shot"), menu);
|
||||||
QAction *area = ACTION("Take area shot", menu);
|
QAction *area = ACTION(tr("Take area shot"), menu);
|
||||||
|
|
||||||
#ifdef PLATFORM_CAPABILITY_ACTIVEWINDOW
|
#ifdef PLATFORM_CAPABILITY_ACTIVEWINDOW
|
||||||
QAction *active = ACTION("Screenshot active window", menu);
|
QAction *active = ACTION(tr("Screenshot active window"), menu);
|
||||||
connect(active, &QAction::triggered, this, [] { screenshotter::activeDelayed(); });
|
connect(active, &QAction::triggered, this, [] { screenshotter::activeDelayed(); });
|
||||||
#endif
|
#endif
|
||||||
QAction *picker = ACTION("Show color picker", menu);
|
QAction *picker = ACTION(tr("Show color picker"), menu);
|
||||||
QAction *rec = ACTION("Record screen", menu);
|
QAction *rec = ACTION(tr("Record screen"), menu);
|
||||||
QAction *recoff = ACTION("Stop recording", menu);
|
QAction *recoff = ACTION(tr("Stop recording"), menu);
|
||||||
QAction *recabort = ACTION("Abort recording", menu);
|
QAction *recabort = ACTION(tr("Abort recording"), menu);
|
||||||
menu->addActions({ quit, shtoggle, picker });
|
menu->addActions({ quit, shtoggle, picker });
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addActions({ fullscreen, area });
|
menu->addActions({ fullscreen, area });
|
||||||
|
@ -45,7 +45,6 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool val = false;
|
bool val = false;
|
||||||
QMap<QAction *, const char *> acts;
|
|
||||||
QMenu *menu;
|
QMenu *menu;
|
||||||
static MainWindow *instance;
|
static MainWindow *instance;
|
||||||
|
|
||||||
|
Binary file not shown.
@ -285,7 +285,7 @@
|
|||||||
<translation>Otkaži</translation>
|
<translation>Otkaži</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../cropeditor/cropscene.cpp" line="210"/>
|
<location filename="../cropeditor/cropscene.cpp" line="211"/>
|
||||||
<source>KShare Crop Editor</source>
|
<source>KShare Crop Editor</source>
|
||||||
<translation>KShare Urednik Slika</translation>
|
<translation>KShare Urednik Slika</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -740,6 +740,51 @@ p, li { white-space: pre-wrap; }
|
|||||||
<source>Recording format not set in settings. Aborting.</source>
|
<source>Recording format not set in settings. Aborting.</source>
|
||||||
<translation>Format snjimanja nije podešen! Otkazujem.</translation>
|
<translation>Format snjimanja nije podešen! Otkazujem.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="57"/>
|
||||||
|
<source>Quit</source>
|
||||||
|
<translation>Izađi</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="58"/>
|
||||||
|
<source>Show/Hide</source>
|
||||||
|
<translation>Prikaži/Sakrij</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="59"/>
|
||||||
|
<source>Take fullscreen shot</source>
|
||||||
|
<translation>Slikaj ceo ekran</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="60"/>
|
||||||
|
<source>Take area shot</source>
|
||||||
|
<translation>Slikaj deo ekrana</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="63"/>
|
||||||
|
<source>Screenshot active window</source>
|
||||||
|
<translation>Slikaj trenutni prozor</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="66"/>
|
||||||
|
<source>Show color picker</source>
|
||||||
|
<translation>Prikaži birač boja</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="67"/>
|
||||||
|
<source>Record screen</source>
|
||||||
|
<translation>Snjimi ekran</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="68"/>
|
||||||
|
<source>Stop recording</source>
|
||||||
|
<translation>Zaustavi snjimanje</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="69"/>
|
||||||
|
<source>Abort recording</source>
|
||||||
|
<translation>Obustavi snjimanje</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>QObject</name>
|
<name>QObject</name>
|
||||||
|
Loading…
Reference in New Issue
Block a user