Skip to content

Commit 01f15f8

Browse files
authored
Merge pull request #125 from lebarsfa/master
Add keys to be able to change numbers size and update of executables generation
2 parents 5803263 + 7fc0d74 commit 01f15f8

File tree

7 files changed

+90
-26
lines changed

7 files changed

+90
-26
lines changed

.github/workflows/dockermatrix.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
on:
22
push:
3-
# branches: '**'
3+
branches: '**'
44
# branches: 'master'
5-
branches: 'devel'
5+
# branches: 'devel'
66
tags: '' # Restrict to blank tags
77
pull_request:
8-
branches: 'devel'
8+
# branches: 'devel'
99

1010
jobs:
1111
dockermatrix:
@@ -18,26 +18,27 @@ jobs:
1818
matrix:
1919
cfg:
2020
#
21-
# Still /bin/bash: ./appimagetool-828-aarch64.AppImage: cannot execute binary file: Exec format error for both configurations, need to run on a Mac vm...
21+
# Still /bin/bash: ./appimagetool-831-aarch64.AppImage: cannot execute binary file: Exec format error for both configurations, need to run on a Mac vm...
2222
#
23-
- { img: 'lebarsfa/pi-64:focal-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: focal, desc: 'Ubuntu 20.04 arm64' }
23+
#- { img: 'lebarsfa/pi-64:focal-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: focal, desc: 'Ubuntu 20.04 arm64' }
2424
#- { img: 'arm64v8/ubuntu:focal', shell: bash, arch: arm64, bitness: 64, runtime: focal, docker_flags: '--platform linux/arm64', desc: 'Ubuntu 20.04 arm64' }
25+
- { img: 'amd64/ubuntu:focal', shell: bash, arch: amd64, bitness: 64, runtime: focal, docker_flags: '--platform linux/amd64', desc: 'Ubuntu 20.04 amd64' }
2526
name: ${{ matrix.cfg.desc }}
2627
steps:
2728
- uses: actions/checkout@v4
2829
- run: |
2930
sudo apt-get -y install qemu binfmt-support qemu-user-static || true
3031
#docker run --rm --privileged multiarch/qemu-user-static:register --reset
3132
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
32-
if: (matrix.cfg.arch!='x86_64')&&(matrix.cfg.arch!='i386')
33+
if: (matrix.cfg.arch!='amd64')&&(matrix.cfg.arch!='x86_64')&&(matrix.cfg.arch!='i386')
3334
- run: |
34-
docker run ${{ matrix.cfg.docker_flags }} -i -v "${PWD}/..:${PWD}/.." ${{ matrix.cfg.img }} /bin/bash -c "uname -a ; cat /etc/os-release ; apt-get -q update --allow-releaseinfo-change ; export DEBIAN_FRONTEND=noninteractive ; export UCF_FORCE_CONFFOLD=1 ; apt-get -y install sudo apt-transport-https ca-certificates gnupg gnupg-agent qt5-default libqt5svg5-dev cmake git build-essential libfuse2 lsb-release file wget --no-install-recommends ; \
35+
docker run ${{ matrix.cfg.docker_flags }} --privileged -i -v "${PWD}/..:${PWD}/.." ${{ matrix.cfg.img }} /bin/bash -c "uname -a ; cat /etc/os-release ; apt-get -q update ; export DEBIAN_FRONTEND=noninteractive ; export UCF_FORCE_CONFFOLD=1 ; apt-get -y install sudo apt-transport-https ca-certificates gnupg gnupg-agent qtbase5-dev libqt5svg5-dev cmake git build-essential libfuse2 lsb-release file wget --no-install-recommends ; \
3536
uname -a ; cat /etc/os-release ; lsb_release -a ; cd ${PWD} && pwd && \
36-
sudo apt-get -q update && sudo apt-get -y install qt5-default libqt5svg5-dev cmake git build-essential libfuse2 lsb-release file wget || true && \
37+
sudo apt-get -q update && sudo apt-get -y install qtbase5-dev libqt5svg5-dev cmake git build-essential libfuse2 patchelf lsb-release file wget || true && \
3738
cd viewer && \
3839
mkdir build ; cd build && \
3940
cmake ${{ matrix.cfg.cmake_params }} .. && \
40-
cmake --build . -j 4 --config Release && \
41+
cmake --build . --config Release && \
4142
cd ../.. && \
4243
cd viewer/build && \
4344
cp -rf ../AppDir AppDir && \
@@ -51,9 +52,10 @@ jobs:
5152
chmod +x appimagetool-*.AppImage && \
5253
file ./appimagetool-*.AppImage && \
5354
uname -a ; cat /etc/os-release ; lsb_release -a && \
54-
./appimagetool-*.AppImage -s deploy AppDir/usr/share/applications/VIBes-viewer.desktop && \
55-
./appimagetool-*.AppImage AppDir && \
55+
./appimagetool-*.AppImage --appimage-extract-and-run -s deploy AppDir/usr/share/applications/VIBes-viewer.desktop && \
56+
./appimagetool-*.AppImage --appimage-extract-and-run AppDir && \
5657
mv -f ./VIBes-viewer*.AppImage ./VIBes-viewer_${{ matrix.cfg.arch }}.AppImage && \
58+
rm -rf ./VIBes-viewer_automoc.cpp ; \
5759
cd ../.."
5860
- uses: xresloader/upload-to-github-release@v1
5961
env:

.github/workflows/unixmatrix.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- { os: windows-2022, shell: cmd, arch: x86, bitness: 32, runtime: vc16, cmake_params: '-G "Visual Studio 17" -T v142 -A Win32', choco_flags: '--x86', desc: 'Windows Visual Studio 2019 x86' }
3333
- { os: windows-2022, shell: cmd, arch: x64, bitness: 64, runtime: mingw11, cmake_params: '-G "MinGW Makefiles"', desc: 'Windows MinGW 11.2.0 x64' }
3434
- { os: windows-2019, shell: cmd, arch: x86, bitness: 32, runtime: mingw8, cmake_params: '-G "MinGW Makefiles"', choco_flags: '--x86', desc: 'Windows MinGW 8.1.0 x86' }
35-
- { os: ubuntu-20.04, shell: bash, arch: amd64, bitness: 64, runtime: focal, desc: 'Ubuntu 20.04 amd64' } # See https://github.com/probonopd/linuxdeployqt/issues/340.
35+
#- { os: ubuntu-20.04, shell: bash, arch: amd64, bitness: 64, runtime: focal, desc: 'Ubuntu 20.04 amd64' } # See https://github.com/probonopd/linuxdeployqt/issues/340.
3636
#
3737
# Still problems for macOS arm64, generated app does not run possibly due to Qt6 problems and Qt5 does not seem supported either, also mandatory code signing of apps might complicate things...
3838
# Current workaround is to use Intel app with Rosetta...
@@ -76,8 +76,8 @@ jobs:
7676
choco install -y -r --no-progress aqt --version=3.1.9 ${{ matrix.cfg.choco_flags }}
7777
choco install -y -r --no-progress qt5-default --version=5.15.2.20240217 --params "'/Path'" ${{ matrix.cfg.choco_flags }}
7878
if: startsWith(matrix.cfg.runtime, 'mingw')&&(matrix.cfg.arch=='x86')
79-
# - run: sudo apt-get -q update ; sudo apt-get -y install qt6-base-dev libgl1-mesa-dev libqt6svg6-dev cmake git build-essential libfuse2 || true
80-
- run: sudo apt-get -q update ; sudo apt-get -y install qt5-default libqt5svg5-dev cmake git build-essential libfuse2 || true
79+
# - run: sudo apt-get -q update ; sudo apt-get -y install qt6-base-dev libgl1-mesa-dev libqt6svg6-dev cmake git build-essential libfuse2 patchelf || true
80+
- run: sudo apt-get -q update ; sudo apt-get -y install qtbase5-dev libqt5svg5-dev cmake git build-essential libfuse2 patchelf || true
8181
if: runner.os=='Linux'
8282
- run: |
8383
brew install qt@5
@@ -104,7 +104,18 @@ jobs:
104104
if [ ${{ matrix.cfg.arch }} = 'x86' ]; then cp -f /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw*/bin/libgcc_s_dw2-1.dll VIBes-viewer/ ;
105105
else cp -f /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw*/bin/libgcc_s_seh-1.dll VIBes-viewer/ ; fi
106106
cp -rf /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw*/bin/libstdc++-6.dll VIBes-viewer/
107-
zip -q -r ./VIBes-viewer_${{ matrix.cfg.arch }}.zip VIBes-viewer/
107+
#wget https://www.7-zip.org/a/lzma2301.7z --no-check-certificate -nv
108+
#7z x lzma2301.7z -o"lzma2301" -y
109+
wget https://github.com/github/ghfw-build-extra/raw/69bd5e6f85e4842f07db71c9618a621154c52254/7-Zip/7zSD.sfx --no-check-certificate -nv
110+
echo ';!@Install@!UTF-8!'>config.txt
111+
echo 'RunProgram="VIBes-viewer\VIBes-viewer.exe"'>>config.txt
112+
echo 'GUIMode="2"'>>config.txt
113+
echo ';!@InstallEnd@!'>>config.txt
114+
7z a VIBes-viewer.7z VIBes-viewer -y
115+
#cmd //c "copy /b /y lzma2301\\bin\\7zSD.sfx + config.txt + VIBes-viewer.7z VIBes-viewer_${{ matrix.cfg.arch }}.exe"
116+
cmd //c "copy /b /y 7zSD.sfx + config.txt + VIBes-viewer.7z VIBes-viewer_${{ matrix.cfg.arch }}.exe"
117+
rm -rf VIBes-viewer.7z
118+
#zip -q -r ./VIBes-viewer_${{ matrix.cfg.arch }}.zip VIBes-viewer/
108119
rm -rf VIBes-viewer/
109120
cd ../..
110121
shell: bash

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ The use of a separate viewer application enables an easy set-up on every system.
2222

2323
You should have git, cmake, qt5/6 and its svg module installed. On a Debian-like distribution, you can install them via:
2424
```bash
25-
sudo apt-get install qt6-base-dev libgl1-mesa-dev libqt6svg6-dev cmake git build-essential
25+
sudo apt-get install qtbase5-dev libqt5svg5-dev cmake git build-essential
2626
```
2727
or
2828
```bash
29-
sudo apt-get install qt5-default qtbase5-dev libqt5svg5-dev cmake git build-essential
29+
sudo apt-get install qt6-base-dev libgl1-mesa-dev libqt6svg6-dev cmake git build-essential
3030
```
3131
Note that `qt5-default` package might not be always available nor mandatory. You might also have issues if you have both qt5 and qt6 installed on your system, so try to check carefully which packages you really need.
3232

viewer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,5 @@ install(DIRECTORY ../client-api/C++/src DESTINATION "Vibes C++")
130130
install(DIRECTORY ../client-api/C++/examples DESTINATION "Vibes C++")
131131

132132
add_library(VIBES STATIC ../client-api/C++/src/vibes.h ../client-api/C++/src/vibes.cpp)
133-
install(TARGETS VIBES LIBRARY DESTINATION lib)
133+
install(TARGETS VIBES ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
134134
install(FILES ../client-api/C++/src/vibes.h DESTINATION include)

viewer/figure2d.cpp

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ Figure2D::Figure2D(QWidget *parent) :
1515
QGraphicsView(parent),
1616
lbProjX(new QLabel("xlabelhere",this)),
1717
lbProjY(new QLabel("ylabelhere",this)),
18-
showAxis(true)
18+
showAxis(true),
19+
fontSize(11),
20+
xTicksSpacing(50),
21+
yTicksSpacing(35)
1922
{
2023
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
2124

@@ -144,8 +147,8 @@ void Figure2D::drawForeground(QPainter *painter, const QRectF &rect)
144147
//painter->drawRect(this->sceneRect());
145148

146149
// Min spacing between ticks (divisor is min spacing in px)
147-
double nb_ticks_x = this->viewport()->width() / 50.0;
148-
double nb_ticks_y = this->viewport()->height() / 35.0;
150+
double nb_ticks_x = this->viewport()->width() / (double)xTicksSpacing;
151+
double nb_ticks_y = this->viewport()->height() / (double)yTicksSpacing;
149152

150153
int log_scale_x = ceil(log10(rect.width()/nb_ticks_x)*3.0);
151154
double scale_x = pow(10.0, floor((double)log_scale_x/3));
@@ -169,7 +172,7 @@ void Figure2D::drawForeground(QPainter *painter, const QRectF &rect)
169172
painter->setTransform(QTransform());
170173
painter->setWindow(this->viewport()->rect());
171174

172-
QFont axisTicksFont("Helvetica", 11);
175+
QFont axisTicksFont("Helvetica", fontSize);
173176
axisTicksFont.setStyleHint(QFont::Helvetica);
174177
painter->setFont(axisTicksFont);
175178
painter->setPen(QColor(0,0,0));
@@ -184,7 +187,7 @@ void Figure2D::drawForeground(QPainter *painter, const QRectF &rect)
184187
xtick_txt.setNum(xtick, 'f', 0);
185188
else
186189
xtick_txt.setNum(xtick, 'g');
187-
painter->drawText(x_wnd+4,12, xtick_txt);
190+
painter->drawText(x_wnd+3,fontSize+3, xtick_txt);
188191
}
189192

190193
for (double ytick=y0; ytick<qMax(rect.top(),rect.bottom()); ytick+=scale_y)
@@ -197,7 +200,7 @@ void Figure2D::drawForeground(QPainter *painter, const QRectF &rect)
197200
ytick_txt.setNum(ytick, 'f', 0);
198201
else
199202
ytick_txt.setNum(ytick, 'g');
200-
painter->drawText(2, y_wnd+12, ytick_txt);
203+
painter->drawText(3, y_wnd+fontSize+3, ytick_txt);
201204
}
202205
}
203206

@@ -246,6 +249,40 @@ void Figure2D::keyPressEvent(QKeyEvent *event)
246249
case Qt::Key_W:
247250
this->scale(0.8,0.8);
248251
break;
252+
case Qt::Key_X:
253+
this->xTicksSpacing = this->xTicksSpacing < 512? this->xTicksSpacing+1: 512;
254+
this->scene()->update();
255+
break;
256+
case Qt::Key_S:
257+
this->xTicksSpacing = this->xTicksSpacing > 1? this->xTicksSpacing-1: 1;
258+
this->scene()->update();
259+
break;
260+
case Qt::Key_Y:
261+
this->yTicksSpacing = this->yTicksSpacing < 512? this->yTicksSpacing+1: 512;
262+
this->scene()->update();
263+
break;
264+
case Qt::Key_H:
265+
this->yTicksSpacing = this->yTicksSpacing > 1? this->yTicksSpacing-1: 1;
266+
this->scene()->update();
267+
break;
268+
case Qt::Key_Asterisk:
269+
case Qt::Key_F:
270+
this->fontSize = this->fontSize < 512? this->fontSize+1: 512;
271+
this->scene()->update();
272+
break;
273+
case Qt::Key_Slash:
274+
case Qt::Key_V:
275+
this->fontSize = this->fontSize > 1? this->fontSize-1: 1;
276+
this->scene()->update();
277+
break;
278+
case Qt::Key_Space:
279+
// Back to default settings
280+
this->showAxis = true;
281+
this->xTicksSpacing = 50;
282+
this->yTicksSpacing = 35;
283+
this->fontSize = 11;
284+
this->scene()->update();
285+
break;
249286
default:
250287
QGraphicsView::keyPressEvent(event);
251288
}
@@ -293,7 +330,7 @@ void Figure2D::exportGraphics(QString fileName)
293330
|| fileName.endsWith(".png", Qt::CaseInsensitive)
294331
|| fileName.endsWith(".bmp", Qt::CaseInsensitive))
295332
{
296-
QImage image(this->size()*2, QImage::Format_ARGB32);
333+
QImage image(this->size(), QImage::Format_ARGB32);
297334
image.fill(QColor(255,255,255,0));
298335
QPainter painter;
299336
painter.begin(&image);

viewer/figure2d.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class Figure2D : public QGraphicsView
3333

3434
// bool to indicate if axis needs to be drawn or not
3535
bool showAxis;
36+
37+
int fontSize;
38+
int xTicksSpacing;
39+
int yTicksSpacing;
3640
signals:
3741

3842
public slots:

viewer/vibeswindow.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,17 @@ void VibesWindow::exportCurrentFigureGraphics()
515515

516516
void VibesWindow::openHelpDialog()
517517
{
518-
QMessageBox::information(this, "VIBes", tr("Open a figure: O or double-click\nHide a figure: H\nClose a figure: DEL\nEdit group properties: P or double-click\nRight-click on an item opens a menu with the same options"));
518+
QMessageBox::information(this, "VIBes", tr("Open a figure: O or double-click\n"
519+
"Hide a figure: H\n"
520+
"Close a figure: DEL\n"
521+
"Edit group properties: P or double-click\n"
522+
"Right-click on an item opens a menu with the same options\n"
523+
"Zoom in: + or Q\n"
524+
"Zoom out: - or W\n"
525+
"Toggle axis view: A\n"
526+
"Change axis ticks: repeated press on X, S, Y, H\n"
527+
"Change font size: * or F and / or V\n"
528+
"Default view settings: SPACE"));
519529
}
520530

521531
void VibesWindow::readFile()

0 commit comments

Comments
 (0)