Skip to content

Commit 33cc720

Browse files
authored
Add toolbar icons for zooming amplitude (#158)
* Add toolbar icons for zooming amplitude * Add PR link
1 parent 5f5eaf5 commit 33cc720

10 files changed

Lines changed: 99 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## [UNRELEASED] · YYYY-MM-DD
22
### ✨ Added
33
- Add DMG background and Applications shortcut for macOS installer
4+
- Add new toolbar icons for zooming in/out all channels' amplitudes ([#158](https://github.com/cbrnr/sigviewer/pull/158) by [Clemens Brunner](https://github.com/cbrnr))
45

56
### 🔧 Fixed
67
- Show error message when loading EDF files containing only annotations instead of hanging in the loading dialog

src/gui/commands/zoom_gui_command.cpp

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ QString const ZoomGuiCommand::GOTO_()
3535

3636
QString const ZoomGuiCommand::ZOOM_IN_VERTICAL_()
3737
{
38-
static QString value = tr("Zoom In Channels");
38+
static QString value = tr("Show Fewer Channels");
3939

4040
return value;
4141
}
4242

4343
QString const ZoomGuiCommand::ZOOM_OUT_VERTICAL_()
4444
{
45-
static QString value = tr("Zoom Out Channels");
45+
static QString value = tr("Show More Channels");
4646

4747
return value;
4848
}
@@ -82,6 +82,20 @@ QString const ZoomGuiCommand::AUTO_ZOOM_VERTICAL_()
8282
return value;
8383
}
8484

85+
QString const ZoomGuiCommand::ZOOM_IN_ALL_CHANNELS_()
86+
{
87+
static QString value = tr("Zoom In Amplitude");
88+
89+
return value;
90+
}
91+
92+
QString const ZoomGuiCommand::ZOOM_OUT_ALL_CHANNELS_()
93+
{
94+
static QString value = tr("Zoom Out Amplitude");
95+
96+
return value;
97+
}
98+
8599
QStringList const ZoomGuiCommand::ACTIONS_()
86100
{
87101
static QStringList result = {
@@ -92,6 +106,8 @@ QStringList const ZoomGuiCommand::ACTIONS_()
92106
ZoomGuiCommand::GOTO_(),
93107
ZoomGuiCommand::SCALE_X_AXIS_(),
94108
ZoomGuiCommand::CHANNEL_PER_PAGE_(),
109+
ZoomGuiCommand::ZOOM_IN_ALL_CHANNELS_(),
110+
ZoomGuiCommand::ZOOM_OUT_ALL_CHANNELS_(),
95111
};
96112

97113
return result;
@@ -115,10 +131,12 @@ ZoomGuiCommand::ZoomGuiCommand ()
115131
void ZoomGuiCommand::init ()
116132
{
117133
getQAction (GOTO_())->setIcon (QIcon::fromTheme("directions_walk"));
118-
getQAction (ZOOM_IN_VERTICAL_())->setIcon (QIcon::fromTheme("zoom_in_vertical"));
119-
getQAction (ZOOM_OUT_VERTICAL_())->setIcon (QIcon::fromTheme("zoom_out_vertical"));
134+
getQAction (ZOOM_IN_VERTICAL_())->setIcon (QIcon::fromTheme("playlist_remove"));
135+
getQAction (ZOOM_OUT_VERTICAL_())->setIcon (QIcon::fromTheme("playlist_add"));
120136
getQAction (ZOOM_IN_HORIZONTAL_())->setIcon (QIcon::fromTheme("zoom_in_horizontal"));
121137
getQAction (ZOOM_OUT_HORIZONTAL_())->setIcon (QIcon::fromTheme("zoom_out_horizontal"));
138+
getQAction (ZOOM_IN_ALL_CHANNELS_())->setIcon (QIcon::fromTheme("zoom_in_vertical"));
139+
getQAction (ZOOM_OUT_ALL_CHANNELS_())->setIcon (QIcon::fromTheme("zoom_out_vertical"));
122140

123141

124142
QList<QKeySequence> zoomInVertical;
@@ -139,6 +157,8 @@ void ZoomGuiCommand::init ()
139157
resetActionTriggerSlot (ZOOM_OUT_HORIZONTAL_(), SLOT(zoomOutHorizontal()));
140158
resetActionTriggerSlot (SCALE_X_AXIS_(), SLOT(scaleXAxis()));
141159
resetActionTriggerSlot (CHANNEL_PER_PAGE_(), SLOT(setChannelsPerPage()));
160+
resetActionTriggerSlot (ZOOM_IN_ALL_CHANNELS_(), SLOT(zoomInAllChannels()));
161+
resetActionTriggerSlot (ZOOM_OUT_ALL_CHANNELS_(), SLOT(zoomOutAllChannels()));
142162
}
143163

144164
//-------------------------------------------------------------------------
@@ -167,6 +187,8 @@ void ZoomGuiCommand::evaluateEnabledness ()
167187
getQAction (ZOOM_IN_VERTICAL_())->setEnabled (zoom_in_vertical_possible);
168188
getQAction (ZOOM_OUT_HORIZONTAL_())->setEnabled (zoom_out_horizontal_possible);
169189
getQAction (ZOOM_IN_HORIZONTAL_())->setEnabled (zoom_in_horizontal_possible);
190+
getQAction (ZOOM_IN_ALL_CHANNELS_())->setEnabled (true);
191+
getQAction (ZOOM_OUT_ALL_CHANNELS_())->setEnabled (true);
170192
disableIfNoFileIsOpened (QStringList() << GOTO_() << SCALE_X_AXIS_() << CHANNEL_PER_PAGE_());
171193
}
172194

@@ -247,6 +269,18 @@ void ZoomGuiCommand::autoZoomVertical ()
247269
{
248270
}
249271

272+
//-----------------------------------------------------------------------------
273+
void ZoomGuiCommand::zoomInAllChannels ()
274+
{
275+
currentVisModel()->zoomInAll();
276+
}
277+
278+
//-----------------------------------------------------------------------------
279+
void ZoomGuiCommand::zoomOutAllChannels ()
280+
{
281+
currentVisModel()->zoomOutAll();
282+
}
283+
250284

251285
//-------------------------------------------------------------------------
252286
void ZoomGuiCommand::scaleXAxis ()

src/gui/commands/zoom_gui_command.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ private slots:
4343
//-------------------------------------------------------------------------
4444
void autoZoomVertical ();
4545

46+
//-------------------------------------------------------------------------
47+
void zoomInAllChannels ();
48+
49+
//-------------------------------------------------------------------------
50+
void zoomOutAllChannels ();
51+
4652
//-------------------------------------------------------------------------
4753
void scaleXAxis ();
4854

@@ -73,6 +79,8 @@ private slots:
7379
static QString const SCALE_X_AXIS_();
7480
static QString const CHANNEL_PER_PAGE_();
7581
static QString const AUTO_ZOOM_VERTICAL_();
82+
static QString const ZOOM_IN_ALL_CHANNELS_();
83+
static QString const ZOOM_OUT_ALL_CHANNELS_();
7684
static QStringList const ACTIONS_();
7785

7886
static GuiActionFactoryRegistrator registrator_;

src/gui/main_window.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ void MainWindow::initToolBars()
132132
file_toolbar_->addSeparator();
133133
file_toolbar_->addAction(action(tr("Channels...")));
134134
file_toolbar_->addAction(action(tr("Scale...")));
135-
file_toolbar_->addAction(action(tr("Zoom In Channels")));
136-
file_toolbar_->addAction(action(tr("Zoom Out Channels")));
135+
file_toolbar_->addAction(action(tr("Show More Channels")));
136+
file_toolbar_->addAction(action(tr("Show Fewer Channels")));
137+
file_toolbar_->addAction(action(tr("Zoom In Amplitude")));
138+
file_toolbar_->addAction(action(tr("Zoom Out Amplitude")));
137139
file_toolbar_->addAction(action(tr("Zoom In Time")));
138140
file_toolbar_->addAction(action(tr("Zoom Out Time")));
139141
file_toolbar_->addSeparator();
@@ -252,8 +254,10 @@ void MainWindow::initMenus (QSharedPointer<ApplicationContext> application_conte
252254
view_menu_->addAction(action(tr("Channels...")));
253255
view_menu_->addAction(action(tr("Scale...")));
254256
view_menu_->addSeparator();
255-
view_menu_->addAction(action(tr("Zoom In Channels")));
256-
view_menu_->addAction(action(tr("Zoom Out Channels")));
257+
view_menu_->addAction(action(tr("Show More Channels")));
258+
view_menu_->addAction(action(tr("Show Fewer Channels")));
259+
view_menu_->addAction(action(tr("Zoom In Amplitude")));
260+
view_menu_->addAction(action(tr("Zoom Out Amplitude")));
257261
view_menu_->addAction(action(tr("Zoom In Time")));
258262
view_menu_->addAction(action(tr("Zoom Out Time")));
259263
view_menu_->addSeparator();

src/gui/signal_visualisation_model.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ class SignalVisualisationModel : public QObject, public EventView
100100
//-------------------------------------------------------------------------
101101
virtual SignalVisualisationView const* view () const = 0;
102102

103+
//-------------------------------------------------------------------------
104+
virtual void zoomInAll () {}
105+
106+
//-------------------------------------------------------------------------
107+
virtual void zoomOutAll () {}
108+
103109
//-------------------------------------------------------------------------
104110
QWidget* infoWidget ();
105111
public slots:
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 16 additions & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 16 additions & 0 deletions
Loading

src/src.qrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
<file>icons/light/actions/undo.svg</file>
2828
<file>icons/light/actions/zoom_in_horizontal.svg</file>
2929
<file>icons/light/actions/menu.svg</file>
30+
<file>icons/light/actions/playlist_add.svg</file>
31+
<file>icons/light/actions/playlist_remove.svg</file>
3032
<file>icons/light/actions/zoom_in_vertical.svg</file>
3133
<file>icons/light/actions/zoom_out_horizontal.svg</file>
3234
<file>icons/light/actions/zoom_out_vertical.svg</file>
@@ -58,6 +60,8 @@
5860
<file>icons/dark/actions/undo.svg</file>
5961
<file>icons/dark/actions/zoom_in_horizontal.svg</file>
6062
<file>icons/dark/actions/menu.svg</file>
63+
<file>icons/dark/actions/playlist_add.svg</file>
64+
<file>icons/dark/actions/playlist_remove.svg</file>
6165
<file>icons/dark/actions/zoom_in_vertical.svg</file>
6266
<file>icons/dark/actions/zoom_out_horizontal.svg</file>
6367
<file>icons/dark/actions/zoom_out_vertical.svg</file>

0 commit comments

Comments
 (0)