1+ #include " homeaddon.h"
2+
3+ #include < QtWidgets/QApplication>
4+
5+ #include < QMWidgets/ctabbutton.h>
6+ #include < QMWidgets/qmdecoratorv2.h>
7+
8+ #include " ihomewindow.h"
9+ #include " icore.h"
10+
11+ namespace Core ::Internal {
12+
13+ HomeAddOn::HomeAddOn (QObject *parent) : Core::IWindowAddOn(parent) {
14+ }
15+
16+ HomeAddOn::~HomeAddOn () = default ;
17+
18+ void HomeAddOn::initialize () {
19+ newButton = new CTabButton ();
20+ connect (newButton, &QAbstractButton::clicked, this , &HomeAddOn::_q_newButtonClicked);
21+
22+ openButton = new CTabButton ();
23+ connect (openButton, &QAbstractButton::clicked, this , &HomeAddOn::_q_openButtonClicked);
24+
25+ auto iWin = windowHandle ()->cast <Core::IHomeWindow>();
26+ iWin->addFileButton (newButton);
27+ iWin->addFileButton (openButton);
28+
29+ qIDec->installLocale (this , _LOC (HomeAddOn, this ));
30+ }
31+
32+ void HomeAddOn::extensionsInitialized () {
33+ }
34+
35+ void HomeAddOn::reloadStrings () {
36+ newButton->setText (QApplication::translate (" Application" , " New" ));
37+ openButton->setText (QApplication::translate (" Application" , " Open" ));
38+ }
39+
40+ void HomeAddOn::_q_newButtonClicked () {
41+ Q_UNUSED (this )
42+ ICore::instance ()->newFile ();
43+ }
44+
45+ void HomeAddOn::_q_openButtonClicked () {
46+ ICore::instance ()->openFile ({}, windowHandle ()->window ());
47+ }
48+
49+ }
0 commit comments