diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-02-07 21:48:40 +0000 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2016-04-08 18:46:46 +0100 |
commit | 5ac0166388ac9a493491a30fbc3570f23950dc51 (patch) | |
tree | 8fe2019a8d3376042d1f92b7a2127bd73d3c97e3 /utils/regtools/qeditor/mainwindow.cpp | |
parent | cc4c9b70bcac048fc388d0f553b7621f52449526 (diff) | |
download | rockbox-5ac0166388ac9a493491a30fbc3570f23950dc51.tar.gz rockbox-5ac0166388ac9a493491a30fbc3570f23950dc51.zip |
qeditor: port to the new hwstub library and add features
This commit adds support for the version of the hwstub library, which requires
a lot of changes. It also adds some editing features, such as register access
and much better editing of fields using the mouse (double click on a field
to be able to resize and move it).
Change-Id: I3c4e4cc855cb44911c72bc8127bad841b68efe52
Diffstat (limited to 'utils/regtools/qeditor/mainwindow.cpp')
-rw-r--r-- | utils/regtools/qeditor/mainwindow.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/utils/regtools/qeditor/mainwindow.cpp b/utils/regtools/qeditor/mainwindow.cpp index 8b83be6bae..69138a91b7 100644 --- a/utils/regtools/qeditor/mainwindow.cpp +++ b/utils/regtools/qeditor/mainwindow.cpp | |||
@@ -107,12 +107,18 @@ void DocumentTabWidget::OnCloseTab(int index) | |||
107 | MainWindow::MainWindow(Backend *backend) | 107 | MainWindow::MainWindow(Backend *backend) |
108 | :m_backend(backend) | 108 | :m_backend(backend) |
109 | { | 109 | { |
110 | QAction *new_regtab_act = new QAction(QIcon::fromTheme("document-new"), tr("Register &Tab"), this); | 110 | QAction *new_regtab_act = new QAction(YIconManager::Get()->GetIcon(YIconManager::DocumentNew), |
111 | QAction *new_regedit_act = new QAction(QIcon::fromTheme("document-edit"), tr("Register &Editor"), this); | 111 | tr("Register &Tab"), this); |
112 | QAction *load_desc_act = new QAction(QIcon::fromTheme("document-open"), tr("&Soc Description"), this); | 112 | QAction *new_regedit_act = new QAction(YIconManager::Get()->GetIcon(YIconManager::DocumentEdit), |
113 | QAction *quit_act = new QAction(QIcon::fromTheme("application-exit"), tr("&Quit"), this); | 113 | tr("Register &Editor"), this); |
114 | QAction *about_act = new QAction(QIcon::fromTheme("help-about"), tr("&About"), this); | 114 | QAction *load_desc_act = new QAction(YIconManager::Get()->GetIcon(YIconManager::DocumentOpen), |
115 | QAction *about_qt_act = new QAction(QIcon::fromTheme("help-about"), tr("About &Qt"), this); | 115 | tr("&Soc Description"), this); |
116 | QAction *quit_act = new QAction(YIconManager::Get()->GetIcon(YIconManager::ApplicationExit), | ||
117 | tr("&Quit"), this); | ||
118 | QAction *about_act = new QAction(YIconManager::Get()->GetIcon(YIconManager::HelpAbout), | ||
119 | tr("&About"), this); | ||
120 | QAction *about_qt_act = new QAction(YIconManager::Get()->GetIcon(YIconManager::HelpAbout), | ||
121 | tr("About &Qt"), this); | ||
116 | 122 | ||
117 | connect(new_regtab_act, SIGNAL(triggered()), this, SLOT(OnNewRegTab())); | 123 | connect(new_regtab_act, SIGNAL(triggered()), this, SLOT(OnNewRegTab())); |
118 | connect(new_regedit_act, SIGNAL(triggered()), this, SLOT(OnNewRegEdit())); | 124 | connect(new_regedit_act, SIGNAL(triggered()), this, SLOT(OnNewRegEdit())); |
@@ -121,9 +127,10 @@ MainWindow::MainWindow(Backend *backend) | |||
121 | connect(about_act, SIGNAL(triggered()), this, SLOT(OnAbout())); | 127 | connect(about_act, SIGNAL(triggered()), this, SLOT(OnAbout())); |
122 | connect(about_qt_act, SIGNAL(triggered()), this, SLOT(OnAboutQt())); | 128 | connect(about_qt_act, SIGNAL(triggered()), this, SLOT(OnAboutQt())); |
123 | 129 | ||
124 | QMenu *file_menu = menuBar()->addMenu(tr("&File")); | 130 | QMenu *app_menu = new QMenu; |
125 | QMenu *new_submenu = file_menu->addMenu(QIcon::fromTheme("document-new"), "&New"); | 131 | QMenu *file_menu = app_menu->addMenu(tr("&File")); |
126 | QMenu *load_submenu = file_menu->addMenu(QIcon::fromTheme("document-open"), "&Load"); | 132 | QMenu *new_submenu = file_menu->addMenu(YIconManager::Get()->GetIcon(YIconManager::DocumentNew), "&New"); |
133 | QMenu *load_submenu = file_menu->addMenu(YIconManager::Get()->GetIcon(YIconManager::DocumentOpen), "&Load"); | ||
127 | file_menu->addAction(quit_act); | 134 | file_menu->addAction(quit_act); |
128 | 135 | ||
129 | new_submenu->addAction(new_regtab_act); | 136 | new_submenu->addAction(new_regtab_act); |
@@ -131,17 +138,24 @@ MainWindow::MainWindow(Backend *backend) | |||
131 | 138 | ||
132 | load_submenu->addAction(load_desc_act); | 139 | load_submenu->addAction(load_desc_act); |
133 | 140 | ||
134 | QMenu *about_menu = menuBar()->addMenu(tr("&About")); | 141 | QMenu *about_menu = app_menu->addMenu(tr("&About")); |
135 | about_menu->addAction(about_act); | 142 | about_menu->addAction(about_act); |
136 | about_menu->addAction(about_qt_act); | 143 | about_menu->addAction(about_qt_act); |
137 | 144 | ||
138 | m_tab = new DocumentTabWidget(); | 145 | m_tab = new DocumentTabWidget(); |
139 | m_tab->setTabOpenable(true); | 146 | m_tab->setTabOpenable(true); |
140 | m_tab->setTabOpenMenu(new_submenu); | 147 | m_tab->setTabOpenMenu(new_submenu); |
148 | m_tab->setOtherMenu(app_menu); | ||
141 | 149 | ||
142 | setCentralWidget(m_tab); | 150 | setCentralWidget(m_tab); |
143 | 151 | ||
144 | ReadSettings(); | 152 | ReadSettings(); |
153 | #ifdef HAVE_HWSTUB | ||
154 | /* acquire hwstub manager */ | ||
155 | HWStubManager::Get()->setParent(this); | ||
156 | #endif | ||
157 | /* acquire icon manager */ | ||
158 | YIconManager::Get()->setParent(this); | ||
145 | 159 | ||
146 | OnNewRegTab(); | 160 | OnNewRegTab(); |
147 | } | 161 | } |
@@ -167,12 +181,12 @@ void MainWindow::OnAbout() | |||
167 | .arg(soc_desc::MINOR_VERSION).arg(soc_desc::REVISION_VERSION); | 181 | .arg(soc_desc::MINOR_VERSION).arg(soc_desc::REVISION_VERSION); |
168 | QMessageBox::about(this, "About", | 182 | QMessageBox::about(this, "About", |
169 | "<h1>QEditor</h1>" | 183 | "<h1>QEditor</h1>" |
170 | "<h2>Version "APP_VERSION"</h2>" | 184 | "<h2>Version " APP_VERSION "</h2>" |
171 | "<p>Written by Amaury Pouly</p>" | 185 | "<p>Written by Amaury Pouly</p>" |
172 | "<p>Libraries:</p>" | 186 | "<p>Libraries:</p>" |
173 | "<ul><li>soc_desc: " + soc_desc_ver + "</li>" | 187 | "<ul><li>soc_desc: " + soc_desc_ver + "</li>" |
174 | #ifdef HAVE_HWSTUB | 188 | #ifdef HAVE_HWSTUB |
175 | "<li>hwstub: "HWSTUB_VERSION"</li>" | 189 | "<li>hwstub: " HWSTUB_VERSION "</li>" |
176 | #else | 190 | #else |
177 | "<li>hwstub: not compiled in</li>" | 191 | "<li>hwstub: not compiled in</li>" |
178 | #endif | 192 | #endif |