Skip to content

Commit

Permalink
IDE: Add Monitor toolbar.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrruiz committed Apr 21, 2015
1 parent ad94e23 commit 5c272c2
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 28 deletions.
2 changes: 1 addition & 1 deletion icons/LICENSE-OPEN-ICONIC
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Files: enter-16x16.png bar-chart-16x16.png
Files: enter-16x16.png bar-chart-24x24.png
Author: Open Iconic — www.useiconic.com/open

The MIT License (MIT)
Expand Down
Binary file added icons/bar-chart-24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed icons/bar-chart-2x.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<file>../icons/chip-micro-24x24.png</file>
<file>../icons/usb-24x24.png</file>
<file>../icons/enter-16x16.png</file>
<file>../icons/bar-chart-2x.png</file>
<file>../icons/bar-chart-24x24.png</file>
</qresource>
<qresource prefix="/">
<file>../icons/splashscreen.png</file>
Expand Down
19 changes: 16 additions & 3 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);

// Align last toolbar action to the right
QWidget* empty = new QWidget(this);
QWidget *empty = new QWidget(this);
empty->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
ui->mainToolBar->insertWidget(ui->actionMonitor, empty);

// Align last action to the right in the monitor toolbar
QWidget *emptyMonitor = new QWidget(this);
emptyMonitor->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
ui->monitorToolBar->insertWidget(ui->actionMonitor, emptyMonitor);
// Hide monitor toolbar
ui->monitorToolBar->setVisible(false);

// Hide graphs widget
ui->graphsWidget->setVisible(false);

Expand Down Expand Up @@ -191,12 +198,12 @@ void MainWindow::actionGraph() {
// Show graph
ui->consoleText->setVisible(false);
ui->graphsWidget->setVisible(true);
ui->graphButton->setChecked(true);
ui->actionGraph->setChecked(true);
} else {
// Hide graph
ui->consoleText->setVisible(true);
ui->graphsWidget->setVisible(false);
ui->graphButton->setChecked(false);
ui->actionGraph->setChecked(false);
}
}

Expand Down Expand Up @@ -227,10 +234,16 @@ void MainWindow::actionMonitor() {
if (ui->widgetConsole->isVisible()) {
serialPortClose();
ui->actionMonitor->setChecked(false);
// Show main toolbar, hide monitor toolbar
ui->mainToolBar->setVisible(true);
ui->monitorToolBar->setVisible(false);
} else {
serialPortOpen();
ui->consoleEdit->setFocus();
ui->actionMonitor->setChecked(true);
// Hide main toolbar, show monitor toolbar
ui->mainToolBar->setVisible(false);
ui->monitorToolBar->setVisible(true);
}
}

Expand Down
66 changes: 43 additions & 23 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
Expand Down Expand Up @@ -113,20 +116,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="graphButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Resources.qrc">
<normaloff>:/icons/icons/bar-chart-2x.png</normaloff>:/icons/icons/bar-chart-2x.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -469,6 +458,22 @@ pressed: { border: 1px };</string>
<bool>true</bool>
</property>
</widget>
<widget class="QToolBar" name="monitorToolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionGraph"/>
<addaction name="actionMonitor"/>
</widget>
<action name="actionVerify">
<property name="icon">
<iconset resource="Resources.qrc">
Expand Down Expand Up @@ -677,6 +682,21 @@ pressed: { border: 1px };</string>
<string>Examples...</string>
</property>
</action>
<action name="actionGraph">
<property name="checkable">
<bool>true</bool>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="Resources.qrc">
<normaloff>:/icons/icons/bar-chart-24x24.png</normaloff>:/icons/icons/bar-chart-24x24.png</iconset>
</property>
<property name="text">
<string>Graph</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
Expand Down Expand Up @@ -1091,14 +1111,14 @@ pressed: { border: 1px };</string>
</hints>
</connection>
<connection>
<sender>graphButton</sender>
<signal>clicked()</signal>
<sender>actionShow_hide_icon_labels</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>actionGraph()</slot>
<slot>actionIconLabels()</slot>
<hints>
<hint type="sourcelabel">
<x>789</x>
<y>110</y>
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
Expand All @@ -1107,10 +1127,10 @@ pressed: { border: 1px };</string>
</hints>
</connection>
<connection>
<sender>actionShow_hide_icon_labels</sender>
<sender>actionExamples</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>actionIconLabels()</slot>
<slot>actionExamples()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
Expand All @@ -1123,10 +1143,10 @@ pressed: { border: 1px };</string>
</hints>
</connection>
<connection>
<sender>actionExamples</sender>
<sender>actionGraph</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>actionExamples()</slot>
<slot>actionGraph()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
Expand Down

0 comments on commit 5c272c2

Please sign in to comment.