-
Notifications
You must be signed in to change notification settings - Fork 39
/
MainWindow.cc
911 lines (790 loc) · 26.6 KB
/
MainWindow.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
/*
* Copyright (C) 2017 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <tinyxml2.h>
#include <string>
#include <ignition/common/Console.hh>
#include <ignition/common/Filesystem.hh>
#include "ignition/gui/Application.hh"
#include "ignition/gui/MainWindow.hh"
#include "ignition/gui/Plugin.hh"
#include "ignition/gui/qt.h"
namespace ignition
{
namespace gui
{
class MainWindowPrivate
{
/// \brief Number of plugins on the window
public: int pluginCount{0};
/// \brief Pointer to quick window
public: QQuickWindow *quickWindow{nullptr};
/// \brief Configuration for this window.
public: WindowConfig windowConfig;
/// \brief Counts the times the window has been painted
public: unsigned int paintCount{0};
/// \brief Minimum number of paint events to consider the window to be
/// fully initialized.
public: const unsigned int paintCountMin{20};
};
}
}
using namespace ignition;
using namespace gui;
/// \brief Strip last component from a path.
/// \return Original path without its last component.
/// \ToDo: Move this function to ignition::common::Filesystem
std::string dirName(const std::string &_path)
{
std::size_t found = _path.find_last_of("/\\");
return _path.substr(0, found);
}
/////////////////////////////////////////////////
MainWindow::MainWindow()
: dataPtr(new MainWindowPrivate)
{
// Make MainWindow functions available from all QML files (using root)
App()->Engine()->rootContext()->setContextProperty("MainWindow", this);
// Load QML and keep pointer to generated QQuickWindow
std::string qmlFile("qrc:qml/Main.qml");
App()->Engine()->load(QUrl(QString::fromStdString(qmlFile)));
this->dataPtr->quickWindow = qobject_cast<QQuickWindow *>(
App()->Engine()->rootObjects().value(0));
if (!this->dataPtr->quickWindow)
{
ignerr << "Internal error: Failed to instantiate QML file [" << qmlFile
<< "]" << std::endl;
return;
}
}
/////////////////////////////////////////////////
MainWindow::~MainWindow()
{
}
/////////////////////////////////////////////////
// void MainWindow::paintEvent(QPaintEvent *_event)
// {
// this->dataPtr->paintCount++;
// if (this->dataPtr->paintCount == this->dataPtr->paintCountMin)
// {
// this->dataPtr->windowConfig = this->CurrentWindowConfig();
// }
// _event->accept();
// }
//
///////////////////////////////////////////////////
// void MainWindow::closeEvent(QCloseEvent *_event)
// {
// if (this->dataPtr->paintCount < this->dataPtr->paintCountMin ||
// this->dataPtr->windowConfig.XMLString() ==
// this->CurrentWindowConfig().XMLString())
// {
// _event->accept();
// return;
// }
//
// // Ask for confirmation
// std::string msg = "There are unsaved changes. \n\n";
//
// QMessageBox msgBox(QMessageBox::Warning, QString("Save configuration?"),
// QString(msg.c_str()), QMessageBox::NoButton, this);
// msgBox.setWindowFlags(Qt::Window | Qt::WindowTitleHint |
// Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint);
//
// auto saveButton = msgBox.addButton("Save as default",
// QMessageBox::AcceptRole);
// saveButton->setObjectName("closeConfirmationDialogSaveButton");
// saveButton->setToolTip(QString::fromStdString(
// "Save to default config file \"" + defaultConfigPath() + "\""));
// msgBox.setDefaultButton(saveButton);
// saveButton->setMinimumWidth(160);
//
// auto saveAsButton = msgBox.addButton("Save as...", QMessageBox::AcceptRole);
// saveAsButton->setObjectName("closeConfirmationDialogSaveAsButton");
// saveAsButton->setToolTip("Choose a file on your computer");
//
// auto cancelButton = msgBox.addButton("Cancel", QMessageBox::AcceptRole);
// cancelButton->setObjectName("closeConfirmationDialogCancelButton");
// msgBox.setEscapeButton(cancelButton);
// cancelButton->setToolTip("Don't close window");
//
// auto closeButton = msgBox.addButton("Close without saving",
// QMessageBox::AcceptRole);
// closeButton->setObjectName("closeConfirmationDialogCloseButton");
// closeButton->setToolTip("Close without saving");
// closeButton->setMinimumWidth(180);
//
// msgBox.show();
// msgBox.exec();
//
// // User doesn't want to close window anymore
// if (msgBox.clickedButton() == cancelButton)
// {
// _event->ignore();
// return;
// }
//
// // Save to default config
// if (msgBox.clickedButton() == saveButton)
// {
// this->OnSaveConfig();
// }
//
// // Save to custom file
// if (msgBox.clickedButton() == saveAsButton)
// {
// this->OnSaveConfigAs();
// }
// _event->accept();
// }
/////////////////////////////////////////////////
QStringList MainWindow::PluginListModel() const
{
QStringList pluginNames;
auto plugins = App()->PluginList();
for (auto const &path : plugins)
{
for (auto const &plugin : path.second)
{
// Remove lib and .so
auto pluginName = plugin.substr(3, plugin.find(".") - 3);
// Show?
if (this->dataPtr->windowConfig.pluginsFromPaths ||
std::find(this->dataPtr->windowConfig.showPlugins.begin(),
this->dataPtr->windowConfig.showPlugins.end(),
pluginName) !=
this->dataPtr->windowConfig.showPlugins.end())
{
pluginNames.append(QString::fromStdString(pluginName));
}
}
}
// Error
for (auto plugin : this->dataPtr->windowConfig.showPlugins)
{
if (!pluginNames.contains(QString::fromStdString(plugin)))
{
ignwarn << "Requested to show plugin [" << plugin <<
"] but it doesn't exist." << std::endl;
}
}
return pluginNames;
}
//////////////////////////////////////////////////
void MainWindow::OnLoadConfig(const QString &_path)
{
auto localPath = QUrl(_path).toLocalFile();
if (localPath.isEmpty())
localPath = _path;
App()->LoadConfig(localPath.toStdString());
}
/////////////////////////////////////////////////
void MainWindow::OnSaveConfig()
{
this->SaveConfig(App()->DefaultConfigPath());
}
/////////////////////////////////////////////////
void MainWindow::OnSaveConfigAs(const QString &_path)
{
auto localPath = QUrl(_path).toLocalFile();
if (localPath.isEmpty())
localPath = _path;
this->SaveConfig(localPath.toStdString());
}
/////////////////////////////////////////////////
void MainWindow::SaveConfig(const std::string &_path)
{
this->dataPtr->windowConfig = this->CurrentWindowConfig();
// Create the intermediate directories if needed.
// We check for errors when we try to open the file.
auto dirname = dirName(_path);
ignition::common::createDirectories(dirname);
// Open the file
std::ofstream out(_path.c_str(), std::ios::out);
if (!out)
{
std::string str = "Unable to open file: " + _path;
str += ".\nCheck file permissions.";
this->notify(QString::fromStdString(str));
}
else
out << this->dataPtr->windowConfig.XMLString();
std::string msg("Saved configuration to <b>" + _path + "</b>");
this->notify(QString::fromStdString(msg));
ignmsg << msg << std::endl;
}
/////////////////////////////////////////////////
void MainWindow::OnAddPlugin(QString _plugin)
{
auto plugin = _plugin.toStdString();
ignlog << "Add [" << plugin << "] via menu" << std::endl;
App()->LoadPlugin(plugin);
}
///////////////////////////////////////////////////
bool MainWindow::ApplyConfig(const WindowConfig &_config)
{
if (!this->dataPtr->quickWindow)
return false;
// Window position
if (!_config.IsIgnoring("position_x") &&
!_config.IsIgnoring("position_y") &&
!_config.IsIgnoring("position") &&
_config.posX >= 0 && _config.posY >= 0)
{
// this->move(_config.posX, _config.posY);
}
// Window size
if (!_config.IsIgnoring("width") &&
!_config.IsIgnoring("height") &&
!_config.IsIgnoring("size") &&
_config.width >= 0 && _config.height >= 0)
{
this->QuickWindow()->resize(_config.width, _config.height);
}
// Docks state
if (!_config.IsIgnoring("state") && !_config.state.isEmpty())
{
// if (!this->restoreState(_config.state))
// ignwarn << "Failed to restore state" << std::endl;
}
// Style
if (!_config.IsIgnoring("style"))
{
this->SetMaterialTheme(QString::fromStdString(_config.materialTheme));
this->SetMaterialPrimary(QString::fromStdString(_config.materialPrimary));
this->SetMaterialAccent(QString::fromStdString(_config.materialAccent));
this->SetToolBarColorLight(QString::fromStdString(
_config.toolBarColorLight));
this->SetToolBarTextColorLight(QString::fromStdString(
_config.toolBarTextColorLight));
this->SetToolBarColorDark(QString::fromStdString(_config.toolBarColorDark));
this->SetToolBarTextColorDark(QString::fromStdString(
_config.toolBarTextColorDark));
this->SetPluginToolBarColorLight(QString::fromStdString(
_config.pluginToolBarColorLight));
this->SetPluginToolBarTextColorLight(QString::fromStdString(
_config.pluginToolBarTextColorLight));
this->SetPluginToolBarColorDark(QString::fromStdString(
_config.pluginToolBarColorDark));
this->SetPluginToolBarTextColorDark(QString::fromStdString(
_config.pluginToolBarTextColorDark));
}
// Menus
this->SetShowDrawer(_config.showDrawer);
this->SetShowDefaultDrawerOpts(_config.showDefaultDrawerOpts);
this->SetShowPluginMenu(_config.showPluginMenu);
// Keep a copy
this->dataPtr->windowConfig = _config;
// Notify view
this->configChanged();
return true;
}
/////////////////////////////////////////////////
WindowConfig MainWindow::CurrentWindowConfig() const
{
if (!this->dataPtr->quickWindow)
return this->dataPtr->windowConfig;
WindowConfig config;
// Position
// config.posX = this->pos().x();
// config.posY = this->pos().y();
// Size
config.width = this->QuickWindow()->width();
config.height = this->QuickWindow()->height();
// Docks state
// config.state = this->saveState();
// Style
config.materialTheme = this->QuickWindow()->property("materialTheme")
.toString().toStdString() == "0" ? "Light" : "Dark";
config.materialPrimary = this->QuickWindow()->property("materialPrimary")
.toString().toStdString();
config.materialAccent =
this->QuickWindow()->property("materialAccent").toString().toStdString();
config.toolBarColorLight =
this->QuickWindow()->property("toolBarColorLight").toString().toStdString();
config.toolBarTextColorLight = this->QuickWindow()->property(
"toolBarTextColorLight").toString().toStdString();
config.toolBarColorDark =
this->QuickWindow()->property("toolBarColorDark").toString().toStdString();
config.toolBarTextColorDark = this->QuickWindow()->property(
"toolBarTextColorDark").toString().toStdString();
// Menus configuration and ignored properties are kept the same as the
// initial ones. They might have been changed programatically but we
// don't guarantee that will be saved.
config.showDrawer = this->dataPtr->windowConfig.showDrawer;
config.showDefaultDrawerOpts =
this->dataPtr->windowConfig.showDefaultDrawerOpts;
config.showPluginMenu = this->dataPtr->windowConfig.showPluginMenu;
config.pluginsFromPaths = this->dataPtr->windowConfig.pluginsFromPaths;
config.showPlugins = this->dataPtr->windowConfig.showPlugins;
config.ignoredProps = this->dataPtr->windowConfig.ignoredProps;
// Plugins
auto plugins = this->findChildren<Plugin *>();
for (const auto plugin : plugins)
config.plugins += plugin->ConfigStr();
return config;
}
/////////////////////////////////////////////////
bool WindowConfig::MergeFromXML(const std::string &_windowXml)
{
// TinyXml element from string
tinyxml2::XMLDocument doc;
doc.Parse(_windowXml.c_str());
auto winElem = doc.FirstChildElement("window");
if (!winElem)
return false;
// Position
if (auto xElem = winElem->FirstChildElement("position_x"))
xElem->QueryIntText(&this->posX);
if (auto yElem = winElem->FirstChildElement("position_y"))
yElem->QueryIntText(&this->posY);
// Size
if (auto widthElem = winElem->FirstChildElement("width"))
widthElem->QueryIntText(&this->width);
if (auto heightElem = winElem->FirstChildElement("height"))
heightElem->QueryIntText(&this->height);
// Docks state
if (auto stateElem = winElem->FirstChildElement("state"))
{
auto text = stateElem->GetText();
this->state = QByteArray::fromBase64(text);
}
// Style
if (auto styleElem = winElem->FirstChildElement("style"))
{
auto mTheme = styleElem->Attribute("material_theme");
if (mTheme)
{
this->materialTheme = mTheme;
}
auto mPrimary = styleElem->Attribute("material_primary");
if (mPrimary)
{
this->materialPrimary = mPrimary;
}
auto mAccent = styleElem->Attribute("material_accent");
if (mAccent)
{
this->materialAccent = mAccent;
}
auto tbColorLight = styleElem->Attribute("toolbar_color_light");
if (tbColorLight)
{
this->toolBarColorLight = tbColorLight;
}
auto tbTextColorLight = styleElem->Attribute("toolbar_text_color_light");
if (tbTextColorLight)
{
this->toolBarTextColorLight = tbTextColorLight;
}
auto tbColorDark = styleElem->Attribute("toolbar_color_dark");
if (tbColorDark)
{
this->toolBarColorDark = tbColorDark;
}
auto tbTextColorDark = styleElem->Attribute("toolbar_text_color_dark");
if (tbTextColorDark)
{
this->toolBarTextColorDark = tbTextColorDark;
}
auto pluginTBColorLight =
styleElem->Attribute("plugin_toolbar_color_light");
if (pluginTBColorLight)
{
this->pluginToolBarColorLight = pluginTBColorLight;
}
auto pluginTBTextColorLight =
styleElem->Attribute("plugin_toolbar_text_color_light");
if (pluginTBTextColorLight)
{
this->pluginToolBarTextColorLight = pluginTBTextColorLight;
}
auto pluginTBColorDark = styleElem->Attribute("plugin_toolbar_color_dark");
if (pluginTBColorDark)
{
this->pluginToolBarColorDark = pluginTBColorDark;
}
auto pluginTBTextColorDark =
styleElem->Attribute("plugin_toolbar_text_color_dark");
if (pluginTBTextColorDark)
{
this->pluginToolBarTextColorDark = pluginTBTextColorDark;
}
}
// Menus
if (auto menusElem = winElem->FirstChildElement("menus"))
{
// Drawer
if (auto drawerElem = menusElem->FirstChildElement("drawer"))
{
// Visible
if (drawerElem->Attribute("visible"))
{
bool visible = true;
drawerElem->QueryBoolAttribute("visible", &visible);
this->showDrawer = visible;
}
// Default
if (drawerElem->Attribute("default"))
{
bool def = true;
drawerElem->QueryBoolAttribute("default", &def);
this->showDefaultDrawerOpts = def;
}
}
// Plugins
if (auto pluginsElem = menusElem->FirstChildElement("plugins"))
{
// Visible
if (pluginsElem->Attribute("visible"))
{
bool visible = true;
pluginsElem->QueryBoolAttribute("visible", &visible);
this->showPluginMenu = visible;
}
// From paths
if (pluginsElem->Attribute("from_paths"))
{
bool fromPaths = false;
pluginsElem->QueryBoolAttribute("from_paths", &fromPaths);
this->pluginsFromPaths = fromPaths;
}
// Show individual plugins
for (auto showElem = pluginsElem->FirstChildElement("show");
showElem != nullptr;
showElem = showElem->NextSiblingElement("show"))
{
if (auto pluginName = showElem->GetText())
this->showPlugins.push_back(pluginName);
}
}
}
// Ignore
for (auto ignoreElem = winElem->FirstChildElement("ignore");
ignoreElem != nullptr;
ignoreElem = ignoreElem->NextSiblingElement("ignore"))
{
if (auto prop = ignoreElem->GetText())
this->ignoredProps.insert(prop);
}
return true;
}
/////////////////////////////////////////////////
std::string WindowConfig::XMLString() const
{
tinyxml2::XMLDocument doc;
// Window
auto windowElem = doc.NewElement("window");
doc.InsertEndChild(windowElem);
// Position
if (!this->IsIgnoring("position") && !this->IsIgnoring("position_x"))
{
auto elem = doc.NewElement("position_x");
elem->SetText(std::to_string(this->posX).c_str());
windowElem->InsertEndChild(elem);
}
if (!this->IsIgnoring("position") && !this->IsIgnoring("position_y"))
{
auto elem = doc.NewElement("position_y");
elem->SetText(std::to_string(this->posY).c_str());
windowElem->InsertEndChild(elem);
}
// Docks state
if (!this->IsIgnoring("state"))
{
auto elem = doc.NewElement("state");
elem->SetText(this->state.toBase64().toStdString().c_str());
windowElem->InsertEndChild(elem);
}
// Size
if (!this->IsIgnoring("size") && !this->IsIgnoring("width"))
{
auto elem = doc.NewElement("width");
elem->SetText(std::to_string(this->width).c_str());
windowElem->InsertEndChild(elem);
}
if (!this->IsIgnoring("size") && !this->IsIgnoring("height"))
{
auto elem = doc.NewElement("height");
elem->SetText(std::to_string(this->height).c_str());
windowElem->InsertEndChild(elem);
}
// Style
if (!this->IsIgnoring("style"))
{
auto elem = doc.NewElement("style");
elem->SetAttribute("material_theme", this->materialTheme.c_str());
elem->SetAttribute("material_primary", this->materialPrimary.c_str());
elem->SetAttribute("material_accent", this->materialAccent.c_str());
elem->SetAttribute("toolbar_color_light", this->toolBarColorLight.c_str());
elem->SetAttribute("toolbar_text_color_light",
this->toolBarTextColorLight.c_str());
elem->SetAttribute("toolbar_color_dark", this->toolBarColorDark.c_str());
elem->SetAttribute("toolbar_text_color_dark",
this->toolBarTextColorDark.c_str());
elem->SetAttribute("plugin_toolbar_color_light",
this->pluginToolBarColorLight.c_str());
elem->SetAttribute("plugin_toolbar_text_color_light",
this->pluginToolBarTextColorLight.c_str());
elem->SetAttribute("plugin_toolbar_color_dark",
this->pluginToolBarColorDark.c_str());
elem->SetAttribute("plugin_toolbar_text_color_dark",
this->pluginToolBarTextColorDark.c_str());
windowElem->InsertEndChild(elem);
}
// Menus
{
auto menusElem = doc.NewElement("menus");
windowElem->InsertEndChild(menusElem);
// Drawer
{
auto elem = doc.NewElement("drawer");
// Visible
elem->SetAttribute("visible", this->showDrawer);
// Default
elem->SetAttribute("default", this->showDefaultDrawerOpts);
menusElem->InsertEndChild(elem);
}
// Plugins
{
auto elem = doc.NewElement("plugins");
// Visible
elem->SetAttribute("visible", this->showPluginMenu);
// From paths
elem->SetAttribute("from_paths", this->pluginsFromPaths);
// Show
for (const auto &show : this->showPlugins)
{
auto showElem = doc.NewElement("show");
showElem->SetText(show.c_str());
elem->InsertEndChild(showElem);
}
menusElem->InsertEndChild(elem);
}
windowElem->InsertEndChild(menusElem);
}
// Ignored properties
{
for (const auto &ignore : this->ignoredProps)
{
auto ignoreElem = doc.NewElement("ignore");
ignoreElem->SetText(ignore.c_str());
windowElem->InsertEndChild(ignoreElem);
}
}
tinyxml2::XMLPrinter printer;
doc.Print(&printer);
std::string config = "<?xml version=\"1.0\"?>\n\n";
config += printer.CStr();
config += this->plugins;
return config;
}
/////////////////////////////////////////////////
bool WindowConfig::IsIgnoring(const std::string &_prop) const
{
return this->ignoredProps.find(_prop) != this->ignoredProps.end();
}
/////////////////////////////////////////////////
int MainWindow::PluginCount() const
{
return this->dataPtr->pluginCount;
}
/////////////////////////////////////////////////
void MainWindow::SetPluginCount(const int _pluginCount)
{
this->dataPtr->pluginCount = _pluginCount;
this->PluginCountChanged();
}
/////////////////////////////////////////////////
QString MainWindow::MaterialTheme() const
{
return QString::fromStdString(this->dataPtr->windowConfig.materialTheme);
}
/////////////////////////////////////////////////
void MainWindow::SetMaterialTheme(const QString &_materialTheme)
{
this->dataPtr->windowConfig.materialTheme = _materialTheme.toStdString();
this->MaterialThemeChanged();
}
/////////////////////////////////////////////////
QString MainWindow::MaterialPrimary() const
{
return QString::fromStdString(this->dataPtr->windowConfig.materialPrimary);
}
/////////////////////////////////////////////////
void MainWindow::SetMaterialPrimary(const QString &_materialPrimary)
{
this->dataPtr->windowConfig.materialPrimary = _materialPrimary.toStdString();
this->MaterialPrimaryChanged();
}
/////////////////////////////////////////////////
QString MainWindow::MaterialAccent() const
{
return QString::fromStdString(this->dataPtr->windowConfig.materialAccent);
}
/////////////////////////////////////////////////
void MainWindow::SetMaterialAccent(const QString &_materialAccent)
{
this->dataPtr->windowConfig.materialAccent = _materialAccent.toStdString();
this->MaterialAccentChanged();
}
/////////////////////////////////////////////////
QString MainWindow::ToolBarColorLight() const
{
return QString::fromStdString(this->dataPtr->windowConfig.toolBarColorLight);
}
/////////////////////////////////////////////////
void MainWindow::SetToolBarColorLight(const QString &_toolBarColorLight)
{
this->dataPtr->windowConfig.toolBarColorLight =
_toolBarColorLight.toStdString();
this->ToolBarColorLightChanged();
}
/////////////////////////////////////////////////
QString MainWindow::ToolBarTextColorLight() const
{
return QString::fromStdString(
this->dataPtr->windowConfig.toolBarTextColorLight);
}
/////////////////////////////////////////////////
void MainWindow::SetToolBarTextColorLight(const QString &_toolBarTextColorLight)
{
igndbg << "TOP TEXT LIGHT" << std::endl;
this->dataPtr->windowConfig.toolBarTextColorLight =
_toolBarTextColorLight.toStdString();
this->ToolBarTextColorLightChanged();
}
/////////////////////////////////////////////////
QString MainWindow::ToolBarColorDark() const
{
return QString::fromStdString(this->dataPtr->windowConfig.toolBarColorDark);
}
/////////////////////////////////////////////////
void MainWindow::SetToolBarColorDark(const QString &_toolBarColorDark)
{
this->dataPtr->windowConfig.toolBarColorDark =
_toolBarColorDark.toStdString();
this->ToolBarColorDarkChanged();
}
/////////////////////////////////////////////////
QString MainWindow::ToolBarTextColorDark() const
{
return QString::fromStdString(
this->dataPtr->windowConfig.toolBarTextColorDark);
}
/////////////////////////////////////////////////
void MainWindow::SetToolBarTextColorDark(const QString &_toolBarTextColorDark)
{
this->dataPtr->windowConfig.toolBarTextColorDark =
_toolBarTextColorDark.toStdString();
this->ToolBarTextColorDarkChanged();
}
/////////////////////////////////////////////////
QString MainWindow::PluginToolBarColorLight() const
{
return QString::fromStdString(
this->dataPtr->windowConfig.pluginToolBarColorLight);
}
/////////////////////////////////////////////////
void MainWindow::SetPluginToolBarColorLight(
const QString &_pluginToolBarColorLight)
{
igndbg << "PLUGIN TEXT LIGHT" << std::endl;
this->dataPtr->windowConfig.pluginToolBarColorLight =
_pluginToolBarColorLight.toStdString();
this->PluginToolBarColorLightChanged();
}
/////////////////////////////////////////////////
QString MainWindow::PluginToolBarTextColorLight() const
{
return QString::fromStdString(
this->dataPtr->windowConfig.pluginToolBarTextColorLight);
}
/////////////////////////////////////////////////
void MainWindow::SetPluginToolBarTextColorLight(
const QString &_pluginToolBarTextColorLight)
{
this->dataPtr->windowConfig.pluginToolBarTextColorLight =
_pluginToolBarTextColorLight.toStdString();
this->PluginToolBarTextColorLightChanged();
}
/////////////////////////////////////////////////
QString MainWindow::PluginToolBarColorDark() const
{
return QString::fromStdString(
this->dataPtr->windowConfig.pluginToolBarColorDark);
}
/////////////////////////////////////////////////
void MainWindow::SetPluginToolBarColorDark(
const QString &_pluginToolBarColorDark)
{
this->dataPtr->windowConfig.pluginToolBarColorDark =
_pluginToolBarColorDark.toStdString();
this->PluginToolBarColorDarkChanged();
}
/////////////////////////////////////////////////
QString MainWindow::PluginToolBarTextColorDark() const
{
return QString::fromStdString(
this->dataPtr->windowConfig.pluginToolBarTextColorDark);
}
/////////////////////////////////////////////////
void MainWindow::SetPluginToolBarTextColorDark(
const QString &_pluginToolBarTextColorDark)
{
this->dataPtr->windowConfig.pluginToolBarTextColorDark =
_pluginToolBarTextColorDark.toStdString();
this->PluginToolBarTextColorDarkChanged();
}
/////////////////////////////////////////////////
QQuickWindow *MainWindow::QuickWindow() const
{
return this->dataPtr->quickWindow;
}
/////////////////////////////////////////////////
bool MainWindow::ShowDrawer() const
{
return this->dataPtr->windowConfig.showDrawer;
}
/////////////////////////////////////////////////
void MainWindow::SetShowDrawer(const bool _showDrawer)
{
this->dataPtr->windowConfig.showDrawer = _showDrawer;
this->ShowDrawerChanged();
}
/////////////////////////////////////////////////
bool MainWindow::ShowDefaultDrawerOpts() const
{
return this->dataPtr->windowConfig.showDefaultDrawerOpts;
}
/////////////////////////////////////////////////
void MainWindow::SetShowDefaultDrawerOpts(const bool _showDefaultDrawerOpts)
{
this->dataPtr->windowConfig.showDefaultDrawerOpts =
_showDefaultDrawerOpts;
this->ShowDefaultDrawerOptsChanged();
}
/////////////////////////////////////////////////
bool MainWindow::ShowPluginMenu() const
{
return this->dataPtr->windowConfig.showPluginMenu;
}
/////////////////////////////////////////////////
void MainWindow::SetShowPluginMenu(const bool _showPluginMenu)
{
this->dataPtr->windowConfig.showPluginMenu = _showPluginMenu;
this->ShowPluginMenuChanged();
}