Skip to content

Commit

Permalink
Merge pull request #125 from lebarsfa/master
Browse files Browse the repository at this point in the history
Add keys to be able to change numbers size and update of executables generation
  • Loading branch information
lebarsfa authored May 1, 2024
2 parents 5803263 + 7fc0d74 commit 01f15f8
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 26 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/dockermatrix.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
on:
push:
# branches: '**'
branches: '**'
# branches: 'master'
branches: 'devel'
# branches: 'devel'
tags: '' # Restrict to blank tags
pull_request:
branches: 'devel'
# branches: 'devel'

jobs:
dockermatrix:
Expand All @@ -18,26 +18,27 @@ jobs:
matrix:
cfg:
#
# Still /bin/bash: ./appimagetool-828-aarch64.AppImage: cannot execute binary file: Exec format error for both configurations, need to run on a Mac vm...
# Still /bin/bash: ./appimagetool-831-aarch64.AppImage: cannot execute binary file: Exec format error for both configurations, need to run on a Mac vm...
#
- { img: 'lebarsfa/pi-64:focal-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: focal, desc: 'Ubuntu 20.04 arm64' }
#- { img: 'lebarsfa/pi-64:focal-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: focal, desc: 'Ubuntu 20.04 arm64' }
#- { img: 'arm64v8/ubuntu:focal', shell: bash, arch: arm64, bitness: 64, runtime: focal, docker_flags: '--platform linux/arm64', desc: 'Ubuntu 20.04 arm64' }
- { img: 'amd64/ubuntu:focal', shell: bash, arch: amd64, bitness: 64, runtime: focal, docker_flags: '--platform linux/amd64', desc: 'Ubuntu 20.04 amd64' }
name: ${{ matrix.cfg.desc }}
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get -y install qemu binfmt-support qemu-user-static || true
#docker run --rm --privileged multiarch/qemu-user-static:register --reset
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
if: (matrix.cfg.arch!='x86_64')&&(matrix.cfg.arch!='i386')
if: (matrix.cfg.arch!='amd64')&&(matrix.cfg.arch!='x86_64')&&(matrix.cfg.arch!='i386')
- run: |
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 ; \
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 ; \
uname -a ; cat /etc/os-release ; lsb_release -a ; cd ${PWD} && pwd && \
sudo apt-get -q update && sudo apt-get -y install qt5-default libqt5svg5-dev cmake git build-essential libfuse2 lsb-release file wget || true && \
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 && \
cd viewer && \
mkdir build ; cd build && \
cmake ${{ matrix.cfg.cmake_params }} .. && \
cmake --build . -j 4 --config Release && \
cmake --build . --config Release && \
cd ../.. && \
cd viewer/build && \
cp -rf ../AppDir AppDir && \
Expand All @@ -51,9 +52,10 @@ jobs:
chmod +x appimagetool-*.AppImage && \
file ./appimagetool-*.AppImage && \
uname -a ; cat /etc/os-release ; lsb_release -a && \
./appimagetool-*.AppImage -s deploy AppDir/usr/share/applications/VIBes-viewer.desktop && \
./appimagetool-*.AppImage AppDir && \
./appimagetool-*.AppImage --appimage-extract-and-run -s deploy AppDir/usr/share/applications/VIBes-viewer.desktop && \
./appimagetool-*.AppImage --appimage-extract-and-run AppDir && \
mv -f ./VIBes-viewer*.AppImage ./VIBes-viewer_${{ matrix.cfg.arch }}.AppImage && \
rm -rf ./VIBes-viewer_automoc.cpp ; \
cd ../.."
- uses: xresloader/upload-to-github-release@v1
env:
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/unixmatrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- { 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' }
- { os: windows-2022, shell: cmd, arch: x64, bitness: 64, runtime: mingw11, cmake_params: '-G "MinGW Makefiles"', desc: 'Windows MinGW 11.2.0 x64' }
- { 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' }
- { 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.
#- { 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.
#
# 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...
# Current workaround is to use Intel app with Rosetta...
Expand Down Expand Up @@ -76,8 +76,8 @@ jobs:
choco install -y -r --no-progress aqt --version=3.1.9 ${{ matrix.cfg.choco_flags }}
choco install -y -r --no-progress qt5-default --version=5.15.2.20240217 --params "'/Path'" ${{ matrix.cfg.choco_flags }}
if: startsWith(matrix.cfg.runtime, 'mingw')&&(matrix.cfg.arch=='x86')
# - 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
- run: sudo apt-get -q update ; sudo apt-get -y install qt5-default libqt5svg5-dev cmake git build-essential libfuse2 || true
# - 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
- run: sudo apt-get -q update ; sudo apt-get -y install qtbase5-dev libqt5svg5-dev cmake git build-essential libfuse2 patchelf || true
if: runner.os=='Linux'
- run: |
brew install qt@5
Expand All @@ -104,7 +104,18 @@ jobs:
if [ ${{ matrix.cfg.arch }} = 'x86' ]; then cp -f /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw*/bin/libgcc_s_dw2-1.dll VIBes-viewer/ ;
else cp -f /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw*/bin/libgcc_s_seh-1.dll VIBes-viewer/ ; fi
cp -rf /c/ProgramData/chocolatey/lib/mingw/tools/install/mingw*/bin/libstdc++-6.dll VIBes-viewer/
zip -q -r ./VIBes-viewer_${{ matrix.cfg.arch }}.zip VIBes-viewer/
#wget https://www.7-zip.org/a/lzma2301.7z --no-check-certificate -nv
#7z x lzma2301.7z -o"lzma2301" -y
wget https://github.com/github/ghfw-build-extra/raw/69bd5e6f85e4842f07db71c9618a621154c52254/7-Zip/7zSD.sfx --no-check-certificate -nv
echo ';!@Install@!UTF-8!'>config.txt
echo 'RunProgram="VIBes-viewer\VIBes-viewer.exe"'>>config.txt
echo 'GUIMode="2"'>>config.txt
echo ';!@InstallEnd@!'>>config.txt
7z a VIBes-viewer.7z VIBes-viewer -y
#cmd //c "copy /b /y lzma2301\\bin\\7zSD.sfx + config.txt + VIBes-viewer.7z VIBes-viewer_${{ matrix.cfg.arch }}.exe"
cmd //c "copy /b /y 7zSD.sfx + config.txt + VIBes-viewer.7z VIBes-viewer_${{ matrix.cfg.arch }}.exe"
rm -rf VIBes-viewer.7z
#zip -q -r ./VIBes-viewer_${{ matrix.cfg.arch }}.zip VIBes-viewer/
rm -rf VIBes-viewer/
cd ../..
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ The use of a separate viewer application enables an easy set-up on every system.

You should have git, cmake, qt5/6 and its svg module installed. On a Debian-like distribution, you can install them via:
```bash
sudo apt-get install qt6-base-dev libgl1-mesa-dev libqt6svg6-dev cmake git build-essential
sudo apt-get install qtbase5-dev libqt5svg5-dev cmake git build-essential
```
or
```bash
sudo apt-get install qt5-default qtbase5-dev libqt5svg5-dev cmake git build-essential
sudo apt-get install qt6-base-dev libgl1-mesa-dev libqt6svg6-dev cmake git build-essential
```
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.

Expand Down
2 changes: 1 addition & 1 deletion viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,5 @@ install(DIRECTORY ../client-api/C++/src DESTINATION "Vibes C++")
install(DIRECTORY ../client-api/C++/examples DESTINATION "Vibes C++")

add_library(VIBES STATIC ../client-api/C++/src/vibes.h ../client-api/C++/src/vibes.cpp)
install(TARGETS VIBES LIBRARY DESTINATION lib)
install(TARGETS VIBES ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
install(FILES ../client-api/C++/src/vibes.h DESTINATION include)
51 changes: 44 additions & 7 deletions viewer/figure2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ Figure2D::Figure2D(QWidget *parent) :
QGraphicsView(parent),
lbProjX(new QLabel("xlabelhere",this)),
lbProjY(new QLabel("ylabelhere",this)),
showAxis(true)
showAxis(true),
fontSize(11),
xTicksSpacing(50),
yTicksSpacing(35)
{
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);

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

// Min spacing between ticks (divisor is min spacing in px)
double nb_ticks_x = this->viewport()->width() / 50.0;
double nb_ticks_y = this->viewport()->height() / 35.0;
double nb_ticks_x = this->viewport()->width() / (double)xTicksSpacing;
double nb_ticks_y = this->viewport()->height() / (double)yTicksSpacing;

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

QFont axisTicksFont("Helvetica", 11);
QFont axisTicksFont("Helvetica", fontSize);
axisTicksFont.setStyleHint(QFont::Helvetica);
painter->setFont(axisTicksFont);
painter->setPen(QColor(0,0,0));
Expand All @@ -184,7 +187,7 @@ void Figure2D::drawForeground(QPainter *painter, const QRectF &rect)
xtick_txt.setNum(xtick, 'f', 0);
else
xtick_txt.setNum(xtick, 'g');
painter->drawText(x_wnd+4,12, xtick_txt);
painter->drawText(x_wnd+3,fontSize+3, xtick_txt);
}

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

Expand Down Expand Up @@ -246,6 +249,40 @@ void Figure2D::keyPressEvent(QKeyEvent *event)
case Qt::Key_W:
this->scale(0.8,0.8);
break;
case Qt::Key_X:
this->xTicksSpacing = this->xTicksSpacing < 512? this->xTicksSpacing+1: 512;
this->scene()->update();
break;
case Qt::Key_S:
this->xTicksSpacing = this->xTicksSpacing > 1? this->xTicksSpacing-1: 1;
this->scene()->update();
break;
case Qt::Key_Y:
this->yTicksSpacing = this->yTicksSpacing < 512? this->yTicksSpacing+1: 512;
this->scene()->update();
break;
case Qt::Key_H:
this->yTicksSpacing = this->yTicksSpacing > 1? this->yTicksSpacing-1: 1;
this->scene()->update();
break;
case Qt::Key_Asterisk:
case Qt::Key_F:
this->fontSize = this->fontSize < 512? this->fontSize+1: 512;
this->scene()->update();
break;
case Qt::Key_Slash:
case Qt::Key_V:
this->fontSize = this->fontSize > 1? this->fontSize-1: 1;
this->scene()->update();
break;
case Qt::Key_Space:
// Back to default settings
this->showAxis = true;
this->xTicksSpacing = 50;
this->yTicksSpacing = 35;
this->fontSize = 11;
this->scene()->update();
break;
default:
QGraphicsView::keyPressEvent(event);
}
Expand Down Expand Up @@ -293,7 +330,7 @@ void Figure2D::exportGraphics(QString fileName)
|| fileName.endsWith(".png", Qt::CaseInsensitive)
|| fileName.endsWith(".bmp", Qt::CaseInsensitive))
{
QImage image(this->size()*2, QImage::Format_ARGB32);
QImage image(this->size(), QImage::Format_ARGB32);
image.fill(QColor(255,255,255,0));
QPainter painter;
painter.begin(&image);
Expand Down
4 changes: 4 additions & 0 deletions viewer/figure2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class Figure2D : public QGraphicsView

// bool to indicate if axis needs to be drawn or not
bool showAxis;

int fontSize;
int xTicksSpacing;
int yTicksSpacing;
signals:

public slots:
Expand Down
12 changes: 11 additions & 1 deletion viewer/vibeswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,17 @@ void VibesWindow::exportCurrentFigureGraphics()

void VibesWindow::openHelpDialog()
{
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"));
QMessageBox::information(this, "VIBes", tr("Open a figure: O or double-click\n"
"Hide a figure: H\n"
"Close a figure: DEL\n"
"Edit group properties: P or double-click\n"
"Right-click on an item opens a menu with the same options\n"
"Zoom in: + or Q\n"
"Zoom out: - or W\n"
"Toggle axis view: A\n"
"Change axis ticks: repeated press on X, S, Y, H\n"
"Change font size: * or F and / or V\n"
"Default view settings: SPACE"));
}

void VibesWindow::readFile()
Expand Down

0 comments on commit 01f15f8

Please sign in to comment.