1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include "gui\rusificationwidget.h"
- #include "ui_rusificationwidget.h"
- #include "legacyapp.h"
- void doStuffWithEveryItemInMyTree( QTreeWidgetItem *item )
- {
- item->setCheckState(0, Qt::Checked);
- for( int i = 0; i < item->childCount(); ++i )
- doStuffWithEveryItemInMyTree( item->child(i) );
- }
- RusificationWidget::RusificationWidget(LegacyApp *_app, QWidget *parent) :
- QWidget(parent),
- ui(new Ui::RusificationWidget),
- app(_app)
- {
- ui->setupUi(this);
- ui->treeWidget_title->expandAll();
- hideAllImportWidgets();
- ui->database_import_widget->show();
- doStuffWithEveryItemInMyTree(ui->treeWidget_title->invisibleRootItem());
- ui_update_timer.setInterval(500);
- connect(&ui_update_timer, &QTimer::timeout, this, &RusificationWidget::updateUI);
- ui_update_timer.start();
- }
- RusificationWidget::~RusificationWidget()
- {
- delete ui;
- }
- void RusificationWidget::hideAllImportWidgets()
- {
- ui->database_import_widget->hide();
- ui->file_import_widget->hide();
- ui->textfragment_import_widget->hide();
- }
- void RusificationWidget::on_database_import_radiobutton_common_clicked()
- {
- hideAllImportWidgets();
- ui->database_import_widget->show();
- }
- void RusificationWidget::on_file_import_radiobutton_common_clicked()
- {
- hideAllImportWidgets();
- ui->file_import_widget->show();
- }
- void RusificationWidget::on_textfragment_import_radiobutton_common_clicked()
- {
- hideAllImportWidgets();
- ui->textfragment_import_widget->show();
- }
- void RusificationWidget::updateUI()
- {
- if (app->properties.value("settings/expert_mode", 0).toBool()) {
- ui->tabWidget_common->tabBar()->show();
- } else {
- if (ui->tabWidget_common->currentIndex() != 0)
- ui->tabWidget_common->setCurrentIndex(0);
- ui->tabWidget_common->tabBar()->hide();
- }
- }
|