KXNeurApp::KXNeurApp() : KUniqueApplication() { xnkb = KXNKeyboard::self(); trayicon = new KXNeurTray(); setMainWidget( trayicon ); trayicon->show(); xneur_pid = 0; xnconf = NULL; cur_lang = -1; prev_lang = -1; if ( KXNeurSettings::self()->RunXNeur() ) xneur_start(); // TODO: проверить старт else { trayicon->run->setText(i18n("Start xneur daemon")); trayicon->run->setIcon("fork"); trayicon->mode->setEnabled(false); xnconf_reload(); } cur_lang = xnkb->getGroupNo(); refreshLang(); trayicon->setPixmap(langs[cur_lang]->pic); QObject::connect(xnkb, SIGNAL(groupChanged(int)), this, SLOT(groupChange(int))); QObject::connect(xnkb, SIGNAL(layoutChanged()), this, SLOT(refreshLang())); QObject::connect(trayicon, SIGNAL(clicked()), this, SLOT(setNextLang())); QObject::connect(trayicon, SIGNAL(quitSelected()), this, SLOT(slotExit())); }
KXNeurApp::KXNeurApp() : KUniqueApplication() // : KApplication() { KGlobal::dirs()->addResourceDir("appdata", "."); all_langs = new KConfig("langs", true, true, "appdata"); all_langs->setGroup("Languages"); xnkb = KXNKeyboard::self(); trayicon = new KXNeurTray(); setMainWidget( trayicon ); trayicon->show(); xneur_pid = 0; xnconf = NULL; cur_lang = -1; prev_lang = -1; if ( !(KXNeurSettings::self()->RunXNeur() && xneur_start()) ) { // printf("start -- ok\n"); // else { trayicon->run->setText(i18n("Start xneur daemon")); trayicon->run->setIcon("fork"); trayicon->mode->setEnabled(false); xnconf_reload(); } cur_lang = xnkb->getGroupNo(); refreshLang(); trayicon->setPixmap(langs[cur_lang]->pic); QObject::connect(xnkb, SIGNAL(groupChanged(int)), this, SLOT(groupChange(int))); QObject::connect(xnkb, SIGNAL(layoutChanged()), this, SLOT(refreshLang())); QObject::connect(trayicon, SIGNAL(clicked()), this, SLOT(setNextLang())); QObject::connect(trayicon, SIGNAL(quitSelected()), this, SLOT(slotExit())); }
Widget::Widget(QWidget *parent) { refreshLang(); subscribe(Lang::Current().updated(), [this] { refreshLang(); }); _inner = setInnerWidget(object_ptr<InnerWidget>(this)); setCloseClickHandler([]() { Ui::hideSettingsAndLayer(); }); }
void KXNeurApp::slotPref() { KXNeurConf dlg(this); dlg.exec(); refreshLang(); trayicon->setPixmap(langs[cur_lang]->pic); }
AbstractBox::AbstractBox(not_null<Window::LayerStackWidget*> layer, object_ptr<BoxContent> content) : LayerWidget(layer) , _layer(layer) , _content(std::move(content)) { subscribe(Lang::Current().updated(), [this] { refreshLang(); }); _content->setParent(this); _content->setDelegate(this); }
void KXNeurApp::slotPref() { KXNeurConf dlg(this); // bool st = xneur_stop(); dlg.exec(); /*if ( st ) xneur_start(); else printf("without restart\n");*/ refreshLang(); trayicon->setPixmap(langs[cur_lang]->pic); }
CodeWidget::CodeWidget(QWidget *parent, Widget::Data *data) : Step(parent, data) , _noTelegramCode(this, lang(lng_code_no_telegram), st::introLink) , _code(this, st::introCode, langFactory(lng_code_ph)) , _callTimer(this) , _callStatus(getData()->callStatus) , _callTimeout(getData()->callTimeout) , _callLabel(this, st::introDescription) , _checkRequest(this) { subscribe(Lang::Current().updated(), [this] { refreshLang(); }); connect(_code, SIGNAL(changed()), this, SLOT(onInputChange())); connect(_callTimer, SIGNAL(timeout()), this, SLOT(onSendCall())); connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest())); connect(_noTelegramCode, SIGNAL(clicked()), this, SLOT(onNoTelegramCode())); _code->setDigitsCountMax(getData()->codeLength); setErrorBelowLink(true); setTitleText([text = App::formatPhone(getData()->phone)] { return text; }); updateDescText(); }