Browse Source

Make tray options translatable

tags/v5.0.0^2
ArsenArsen 5 years ago
parent
commit
433ee87ce5
No known key found for this signature in database GPG Key ID: C631EC9C50708CF4
  1. 30
      mainwindow.cpp
  2. 1
      mainwindow.hpp
  3. BIN
      translations/sr_RS.qm
  4. 47
      translations/sr_RS.ts

30
mainwindow.cpp

@ -38,20 +38,10 @@ void MainWindow::rec() {
#define ACTION(english, menu) \
[&]() -> QAction * { \
QAction *a = menu->addAction(tr(english)); \
acts.insert(a, english); \
QAction *a = menu->addAction(english); \
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) {
hotkeying::load(name, action);
}
@ -64,19 +54,19 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
tray->setToolTip("KShare");
tray->setVisible(true);
menu = new QMenu(this);
QAction *quit = ACTION("Quit", menu);
QAction *shtoggle = ACTION("Show/Hide", menu);
QAction *fullscreen = ACTION("Take fullscreen shot", menu);
QAction *area = ACTION("Take area shot", menu);
QAction *quit = ACTION(tr("Quit"), menu);
QAction *shtoggle = ACTION(tr("Show/Hide"), menu);
QAction *fullscreen = ACTION(tr("Take fullscreen shot"), menu);
QAction *area = ACTION(tr("Take area shot"), menu);
#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(); });
#endif
QAction *picker = ACTION("Show color picker", menu);
QAction *rec = ACTION("Record screen", menu);
QAction *recoff = ACTION("Stop recording", menu);
QAction *recabort = ACTION("Abort recording", menu);
QAction *picker = ACTION(tr("Show color picker"), menu);
QAction *rec = ACTION(tr("Record screen"), menu);
QAction *recoff = ACTION(tr("Stop recording"), menu);
QAction *recabort = ACTION(tr("Abort recording"), menu);
menu->addActions({ quit, shtoggle, picker });
menu->addSeparator();
menu->addActions({ fullscreen, area });

1
mainwindow.hpp

@ -45,7 +45,6 @@ public slots:
private:
bool val = false;
QMap<QAction *, const char *> acts;
QMenu *menu;
static MainWindow *instance;

BIN
translations/sr_RS.qm

Binary file not shown.

47
translations/sr_RS.ts

@ -285,7 +285,7 @@
<translation>Otkaži</translation>
</message>
<message>
<location filename="../cropeditor/cropscene.cpp" line="210"/>
<location filename="../cropeditor/cropscene.cpp" line="211"/>
<source>KShare Crop Editor</source>
<translation>KShare Urednik Slika</translation>
</message>
@ -740,6 +740,51 @@ p, li { white-space: pre-wrap; }
<source>Recording format not set in settings. Aborting.</source>
<translation>Format snjimanja nije podešen! Otkazujem.</translation>
</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>
<name>QObject</name>

Loading…
Cancel
Save