Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
LiangliangNan committed Sep 26, 2024
1 parent 7660884 commit 2ec67cc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.12)

set(Easy3D_VERSION_MAJOR 2)
set(Easy3D_VERSION_MINOR 5)
set(Easy3D_VERSION_PATCH 3)
set(Easy3D_VERSION_PATCH 4)
set(Easy3D_VERSION_STRING ${Easy3D_VERSION_MAJOR}.${Easy3D_VERSION_MINOR}.${Easy3D_VERSION_PATCH})
set(Easy3D_VERSION_NUMBER 10${Easy3D_VERSION_MAJOR}0${Easy3D_VERSION_MINOR}0${Easy3D_VERSION_PATCH})

Expand Down
26 changes: 15 additions & 11 deletions applications/Mapple/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include <QStyleFactory>
#include <QSurfaceFormat>
#include <QGLFormat>
#include <QElapsedTimer>
#include <QException>

Expand Down Expand Up @@ -111,6 +112,7 @@ int main(int argc, char *argv[]) {
format.setProfile(QSurfaceFormat::CoreProfile);
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
format.setSamples(4);
#ifndef NDEBUG
format.setOption(QSurfaceFormat::DebugContext);
Expand All @@ -122,26 +124,19 @@ int main(int argc, char *argv[]) {

QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
#if (defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
//QApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
#endif

#ifdef __APPLE__
//QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
#endif

Mapple app(argc, argv);

#ifndef __APPLE__
// to have similar style on different platforms (macOS.
#ifndef Q_OS_MAC
// to have similar style on different platforms (macOS)
app.setStyle(QStyleFactory::create("Fusion"));
#endif

QDir workingDir = QCoreApplication::applicationDirPath();
#ifdef __APPLE__
#ifdef Q_OS_MAC
// This makes sure that our "working directory" is not within the application bundle
if (workingDir.dirName() == "MacOS") {
workingDir.cdUp();
Expand Down Expand Up @@ -169,6 +164,15 @@ int main(int argc, char *argv[]) {
}
#endif

if (!QGLFormat::hasOpenGL()) {
LOG(ERROR) << "Mapple needs OpenGL to run";
return EXIT_FAILURE;
}
if ((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_3_2) == 0) {
LOG(ERROR) << "Mapple needs OpenGL 3.2 at least to run";
return EXIT_FAILURE;
}

try {
MainWindow win;
if (!logging::log_file().empty())
Expand Down
2 changes: 1 addition & 1 deletion applications/Mapple/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ void MainWindow::onAbout()
title += QMessageBox::tr("<h3>Mapple (%1 bit)</h3>").arg(bits);
#endif

title += QMessageBox::tr("<h4>based on Easy3D v%1 (%2) and Qt v%3</h4>").arg(EASY3D_VERSION_STR).arg(EASY3D_RELEASE_DATE).arg(QT_VERSION_STR);
title += QMessageBox::tr("<h4>based on Easy3D v%1 (%2) and Qt v%3</h4>").arg(EASY3D_VERSION_STR).arg(EASY3D_RELEASE_DATE).arg(QT_VERSION_STR); // __DATE__

QString text = QMessageBox::tr(
"<p>Mapple is software for processing and rendering 3D data (e.g., point clouds, graphs, surface meshes, "
Expand Down
4 changes: 2 additions & 2 deletions easy3d/util/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ namespace easy3d {
#define EASY3D_VERSION_STR Easy3D_VERSION_STRING

/// Easy3D version number, in the format 10[MAJOR]0[MINOR]0[PATCH].
#define EASY3D_VERSION_NR 1020503
#define EASY3D_VERSION_NR 1020504

/// Easy3D release date, in the format YYYYMMDD.
#define EASY3D_RELEASE_DATE 20240916
#define EASY3D_RELEASE_DATE 20240926


#endif // EASY3D_UTIL_VERSION_H

0 comments on commit 2ec67cc

Please sign in to comment.