-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbusdict.cpp
More file actions
34 lines (29 loc) · 795 Bytes
/
Copy pathdbusdict.cpp
File metadata and controls
34 lines (29 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <QString>
#include <QThread>
#include "dbusdict.h"
#include "mainwindow.h"
ZKanjiDBusDict::ZKanjiDBusDict(QObject *parent, ZDict::ZDictController *dictManager) :
QObject(parent), m_wnd(nullptr)
{
m_dictManager = dictManager;
}
void ZKanjiDBusDict::setMainWindow(ZMainWindow *wnd)
{
m_wnd = wnd;
}
void ZKanjiDBusDict::findWordTranslation(const QString &text)
{
QThread *th = QThread::create([this,text]{
QString res = m_dictManager->loadArticle(text);
Q_EMIT gotWordTranslation(res);
});
connect(th,&QThread::finished,th,&QThread::deleteLater);
th->start();
}
void ZKanjiDBusDict::showDictionaryWindow(const QString &text)
{
m_wnd->showNormal();
m_wnd->raise();
m_wnd->activateWindow();
m_wnd->setScratchPadText(text);
}