| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2012~2012 CSSlayer <[email protected]> |
| 3 |
* SPDX-FileCopyrightText: 2017~2017 xzhao |
| 4 |
* [email protected] |
| 5 |
* |
| 6 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef FCITX5QT_GUIWRAPPER_MAINWINDOW_H |
| 10 |
#define FCITX5QT_GUIWRAPPER_MAINWINDOW_H |
| 11 |
|
| 12 |
#include <QDialog> |
| 13 |
|
| 14 |
#include "fcitxqtconfiguiwidget.h" |
| 15 |
#include "ui_mainwindow.h" |
| 16 |
#include <QDBusPendingCallWatcher> |
| 17 |
#include <QWidget> |
| 18 |
|
| 19 |
namespace fcitx { |
| 20 |
|
| 21 |
class FcitxQtControllerProxy; |
| 22 |
class FcitxQtWatcher; |
| 23 |
class MainWindow : public QWidget, public Ui::MainWindow { |
| 24 |
Q_OBJECT |
| 25 |
public: |
| 26 |
explicit MainWindow(const QString &path, |
| 27 |
FcitxQtConfigUIWidget *pluginWidget, |
| 28 |
QWidget *parent = 0); |
| 29 |
|
| 30 |
void setParentWindow(WId id); |
| 31 |
public Q_SLOTS: |
| 32 |
void changed(bool changed); |
| 33 |
void clicked(QAbstractButton *button); |
| 34 |
void availabilityChanged(bool avail); |
| 35 |
void saveSubConfig(const QString &path); |
| 36 |
|
| 37 |
protected: |
| 38 |
void showEvent(QShowEvent *event) override; |
| 39 |
void closeEvent(QCloseEvent *event) override; |
| 40 |
|
| 41 |
private Q_SLOTS: |
| 42 |
void saveFinished(); |
| 43 |
void saveFinishedPhase2(QDBusPendingCallWatcher *watcher); |
| 44 |
|
| 45 |
private: |
| 46 |
QString path_; |
| 47 |
FcitxQtWatcher *watcher_; |
| 48 |
FcitxQtConfigUIWidget *pluginWidget_; |
| 49 |
FcitxQtControllerProxy *proxy_; |
| 50 |
WId wid_ = 0; |
| 51 |
bool closeAfterSave_ = false; |
| 52 |
}; |
| 53 |
} // namespace fcitx |
| 54 |
|
| 55 |
#endif // FCITXQT5_GUIWRAPPER_MAINWINDOW_H |