-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
2,727 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ add_subdirectory(lib) | |
if (ENABLE_CONFIG_QT) | ||
add_subdirectory(configtool) | ||
endif() | ||
|
||
add_subdirectory(migrator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
add_subdirectory(app) | ||
add_subdirectory(lib) | ||
add_subdirectory(pinyin) | ||
add_subdirectory(skk) | ||
add_subdirectory(kkc) | ||
add_subdirectory(rime) | ||
add_subdirectory(global) | ||
add_subdirectory(table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_executable(fcitx5-migrator main.cpp mainwindow.cpp welcomepage.cpp taskpage.cpp progresspage.cpp) | ||
set_target_properties(fcitx5-migrator PROPERTIES AUTOMOC TRUE AUTOUIC TRUE) | ||
target_link_libraries(fcitx5-migrator pinyinmigrator skkmigrator rimemigrator kkcmigrator globalconfigmigrator tablemigrator Qt5::Widgets KF5::WidgetsAddons configlib migrator Fcitx5Qt5::DBusAddons) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "mainwindow.h" | ||
#include <QApplication> | ||
#include <QDebug> | ||
#include <QPluginLoader> | ||
#include <QtPlugin> | ||
|
||
Q_IMPORT_PLUGIN(PinyinMigratorPlugin); | ||
Q_IMPORT_PLUGIN(SkkMigratorPlugin); | ||
Q_IMPORT_PLUGIN(KkcMigratorPlugin); | ||
Q_IMPORT_PLUGIN(RimeMigratorPlugin); | ||
Q_IMPORT_PLUGIN(GlobalConfigMigratorPlugin); | ||
Q_IMPORT_PLUGIN(TableMigratorPlugin); | ||
|
||
int main(int argc, char *argv[]) { | ||
QApplication app(argc, argv); | ||
|
||
fcitx::MainWindow window; | ||
window.show(); | ||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2020~2020 CSSlayer <wengxt@gmail.com> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
*/ | ||
#include "mainwindow.h" | ||
#include "progresspage.h" | ||
#include "taskpage.h" | ||
#include "welcomepage.h" | ||
#include <fcitx-utils/i18n.h> | ||
|
||
namespace fcitx { | ||
|
||
MainWindow::MainWindow(QWidget *parent) | ||
: QWizard(parent), dbus_(this), welcomePage_(new WelcomePage(this)), | ||
taskPage_(new TaskPage(this)), progressPage_(new ProgressPage(this)) { | ||
addPage(welcomePage_); | ||
addPage(taskPage_); | ||
addPage(progressPage_); | ||
setMinimumSize(QSize(700, 480)); | ||
setWindowIcon(QIcon::fromTheme("fcitx")); | ||
setWindowTitle(_("Migration Tool")); | ||
} | ||
|
||
Pipeline *MainWindow::createPipeline() { return taskPage_->createPipeline(); } | ||
|
||
} // namespace fcitx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2020~2020 CSSlayer <wengxt@gmail.com> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
*/ | ||
#ifndef _FCITX5_CONFIGTOOL_MIGRATOR_APP_MAINWINDOW_H_ | ||
#define _FCITX5_CONFIGTOOL_MIGRATOR_APP_MAINWINDOW_H_ | ||
|
||
#include "dbusprovider.h" | ||
#include "migratorfactory.h" | ||
#include "pipeline.h" | ||
#include <QWizard> | ||
#include <fcitxqtwatcher.h> | ||
|
||
namespace fcitx { | ||
|
||
class WelcomePage; | ||
class TaskPage; | ||
class ProgressPage; | ||
|
||
class MainWindow : public QWizard { | ||
Q_OBJECT | ||
public: | ||
explicit MainWindow(QWidget *parent = nullptr); | ||
|
||
auto *dbus() { return &dbus_; } | ||
auto *factory() const { return &factory_; } | ||
Pipeline *createPipeline(); | ||
|
||
private: | ||
kcm::DBusProvider dbus_; | ||
MigratorFactory factory_; | ||
WelcomePage *welcomePage_; | ||
TaskPage *taskPage_; | ||
ProgressPage *progressPage_; | ||
}; | ||
|
||
} // namespace fcitx | ||
|
||
#endif // _FCITX5_CONFIGTOOL_MIGRATOR_APP_MAINWINDOW_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2020~2020 CSSlayer <wengxt@gmail.com> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
*/ | ||
#include "progresspage.h" | ||
#include "mainwindow.h" | ||
#include <QAbstractButton> | ||
#include <fcitx-utils/i18n.h> | ||
|
||
namespace fcitx { | ||
|
||
ProgressPage::ProgressPage(MainWindow *parent) | ||
: QWizardPage(parent), parent_(parent) { | ||
setupUi(this); | ||
setFinalPage(true); | ||
} | ||
|
||
bool ProgressPage::isComplete() const { return done_; } | ||
|
||
void ProgressPage::appendMessage(const QString &icon, const QString &message) { | ||
QListWidgetItem *item = | ||
new QListWidgetItem(QIcon::fromTheme(icon), message, listWidget); | ||
listWidget->addItem(item); | ||
listWidget->scrollToItem(item); | ||
} | ||
|
||
void ProgressPage::initializePage() { | ||
if (pipeline_) { | ||
delete pipeline_; | ||
} | ||
listWidget->clear(); | ||
pipeline_ = parent_->createPipeline(); | ||
done_ = false; | ||
|
||
connect(pipeline_, &Pipeline::message, this, &ProgressPage::appendMessage); | ||
|
||
connect(pipeline_, &Pipeline::finished, this, [this](bool success) { | ||
if (success) { | ||
done_ = true; | ||
parent_->button(QWizard::CancelButton)->setEnabled(false); | ||
appendMessage("dialog-positive", | ||
_("All migration tasks are completed successfully.")); | ||
emit completeChanged(); | ||
} else { | ||
appendMessage( | ||
"dialog-error", | ||
_("One of the task is failed. Terminating the migration.")); | ||
} | ||
}); | ||
pipeline_->start(); | ||
} | ||
|
||
} // namespace fcitx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2020~2020 CSSlayer <wengxt@gmail.com> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
*/ | ||
#ifndef _FCITX5_CONFIGTOOL_MIGRATOR_APP_PROGRESSPAGE_H_ | ||
#define _FCITX5_CONFIGTOOL_MIGRATOR_APP_PROGRESSPAGE_H_ | ||
|
||
#include "pipeline.h" | ||
#include "ui_progresspage.h" | ||
#include <QWizardPage> | ||
|
||
namespace fcitx { | ||
|
||
class MainWindow; | ||
|
||
class ProgressPage : public QWizardPage, public Ui::ProgressPage { | ||
Q_OBJECT | ||
public: | ||
explicit ProgressPage(MainWindow *parent); | ||
|
||
bool isComplete() const override; | ||
void initializePage() override; | ||
|
||
void appendMessage(const QString &icon, const QString &message); | ||
|
||
private: | ||
MainWindow *parent_; | ||
Pipeline *pipeline_ = nullptr; | ||
bool done_ = false; | ||
}; | ||
|
||
} // namespace fcitx | ||
|
||
#endif // _FCITX5_CONFIGTOOL_MIGRATOR_APP_PROGRESSPAGE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>ProgressPage</class> | ||
<widget class="QWizardPage" name="ProgressPage"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string/> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QListWidget" name="listWidget"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.