77#include < string>
88#include < unistd.h>
99#include " environment.h"
10- #include " evdev-lst-layouts.h"
1110#include " find-themes.h"
12- #include " layoutmodel.h"
1311#include " log.h"
1412#include " macros.h"
1513#include " maindialog.h"
1917MainDialog::MainDialog (QWidget *parent) : QDialog(parent), ui(new Ui::MainDialog)
2018{
2119 ui->setupUi (this );
22-
2320 ui->list ->setFixedWidth (ui->list ->sizeHintForColumn (0 ) + 2 * ui->list ->frameWidth ());
24-
25- m_model = new LayoutModel (this );
26- ui->layoutView ->setModel (m_model);
27-
2821 QObject::connect (ui->buttonBox , &QDialogButtonBox::clicked, [&](QAbstractButton *button) {
2922 if (ui->buttonBox ->standardButton (button) == QDialogButtonBox::Apply) {
3023 onApply ();
3124 }
3225 });
33-
34- connect (ui->layoutAdd , &QPushButton::pressed, this , &MainDialog::addSelectedLayout);
35- connect (ui->layoutRemove , &QPushButton::pressed, this , &MainDialog::deleteSelectedLayout);
36-
3726 activate ();
3827}
3928
@@ -43,51 +32,20 @@ MainDialog::~MainDialog()
4332 xml_finish ();
4433}
4534
46- void MainDialog::addSelectedLayout (void )
47- {
48- const char *description = ui->layoutCombo ->currentText ().toLatin1 ().data ();
49- for (auto layout : evdev_lst_layouts) {
50- if (!strcmp (description, layout.description )) {
51- m_model->addLayout (QString (layout.code ), QString (layout.description ));
52- }
53- }
54- }
55-
56- void MainDialog::deleteSelectedLayout (void )
57- {
58- m_model->deleteLayout (ui->layoutView ->currentIndex ().row ());
59- }
60-
6135void MainDialog::activate ()
6236{
6337 ui->pageAppearance ->activate ();
6438 ui->pageBehaviour ->activate ();
6539 ui->pageMouse ->activate ();
66-
67- /* # LANGUAGE */
68-
69- /* Keyboard Layout */
70- ui->layoutCombo ->addItem (tr (" Select layout to add..." ));
71- for (auto layout : evdev_lst_layouts) {
72- ui->layoutCombo ->addItem (QString (layout.description ));
73- }
40+ ui->pageLanguage ->activate ();
7441}
7542
7643void MainDialog::onApply ()
7744{
7845 ui->pageAppearance ->onApply ();
7946 ui->pageBehaviour ->onApply ();
8047 ui->pageMouse ->onApply ();
81-
82- /*
83- * We include variants in XKB_DEFAULT_LAYOUT, for example "latam(deadtilde),ru(phonetic),gr",
84- * so XKB_DEFAULT_VARIANT is set to empty.
85- */
86- QString layout = m_model->getXkbDefaultLayout ();
87- if (!layout.isEmpty ()) {
88- environmentSet (" XKB_DEFAULT_LAYOUT" , layout);
89- environmentSet (" XKB_DEFAULT_VARIANT" , " " );
90- }
48+ ui->pageLanguage ->onApply ();
9149
9250 // TODO: Get filename in a more consistent way - share common code with main.cpp
9351 std::string config_home = std::getenv (" HOME" ) + std::string (" /.config/labwc" );
0 commit comments