-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d0a11e
commit 20be07b
Showing
5 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
**/.idea | ||
**/cmake-build* | ||
**/.DS_Store | ||
|
||
# This file is used to ignore files which are generated | ||
# ---------------------------------------------------------------------------- | ||
|
||
*~ | ||
*.autosave | ||
*.a | ||
*.core | ||
*.moc | ||
*.o | ||
*.obj | ||
*.orig | ||
*.rej | ||
*.so | ||
*.so.* | ||
*_pch.h.cpp | ||
*_resource.rc | ||
*.qm | ||
.#* | ||
*.*# | ||
core | ||
!core/ | ||
tags | ||
.DS_Store | ||
.directory | ||
*.debug | ||
Makefile* | ||
*.prl | ||
*.app | ||
moc_*.cpp | ||
ui_*.h | ||
qrc_*.cpp | ||
Thumbs.db | ||
*.res | ||
*.rc | ||
/.qmake.cache | ||
/.qmake.stash | ||
|
||
# qtcreator generated files | ||
*.pro.user* | ||
|
||
# xemacs temporary files | ||
*.flc | ||
|
||
# Vim temporary files | ||
.*.swp | ||
|
||
# Visual Studio generated files | ||
*.ib_pdb_index | ||
*.idb | ||
*.ilk | ||
*.pdb | ||
*.sln | ||
*.suo | ||
*.vcproj | ||
*vcproj.*.*.user | ||
*.ncb | ||
*.sdf | ||
*.opensdf | ||
*.vcxproj | ||
*vcxproj.* | ||
|
||
# MinGW generated files | ||
*.Debug | ||
*.Release | ||
|
||
# Python byte code | ||
*.pyc | ||
|
||
# Binaries | ||
# -------- | ||
*.dll | ||
*.exe | ||
|
||
build** | ||
*.user | ||
|
||
!loc/*qm | ||
|
||
!img/*.rc | ||
|
||
!lib/** | ||
|
||
**/.DS_Store |
67 changes: 67 additions & 0 deletions
67
...itchEd25519.BlazorWebApp.Qt/GlitchedPolygons.GlitchEd25519.BlazorWebApp.Qt/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(GlitchEd25519 VERSION 1.0 LANGUAGES CXX) | ||
|
||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets WebView WebEngineWidgets) | ||
|
||
set(PROJECT_SOURCES ${CMAKE_CURRENT_LIST_DIR}/main.cpp ${CMAKE_CURRENT_LIST_DIR}/ico.qrc) | ||
set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_LIST_DIR}/winico.rc") | ||
|
||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) | ||
qt_add_executable(GlitchEd25519 | ||
MANUAL_FINALIZATION | ||
${PROJECT_SOURCES} | ||
${APP_ICON_RESOURCE_WINDOWS} | ||
) | ||
# Define target properties for Android with Qt 6 as: | ||
# set_property(TARGET GlitchEd25519 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/android) | ||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation | ||
else() | ||
if(ANDROID) | ||
add_library(GlitchEd25519 SHARED | ||
${PROJECT_SOURCES} | ||
) | ||
# Define properties for Android with Qt 5 after find_package() calls as: | ||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") | ||
else() | ||
add_executable(GlitchEd25519 | ||
${PROJECT_SOURCES} | ||
) | ||
endif() | ||
endif() | ||
|
||
target_link_libraries(GlitchEd25519 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::WebView Qt${QT_VERSION_MAJOR}::WebEngineWidgets) | ||
|
||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. | ||
# If you are developing for iOS or macOS you should consider setting an | ||
# explicit, fixed bundle identifier manually though. | ||
if(${QT_VERSION} VERSION_LESS 6.1.0) | ||
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.glitchedpolygons.ed25519) | ||
endif() | ||
set_target_properties(GlitchEd25519 PROPERTIES | ||
${BUNDLE_ID_OPTION} | ||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} | ||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} | ||
MACOSX_BUNDLE TRUE | ||
WIN32_EXECUTABLE TRUE | ||
) | ||
|
||
include(GNUInstallDirs) | ||
install(TARGETS GlitchEd25519 | ||
BUNDLE DESTINATION . | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
|
||
if(QT_VERSION_MAJOR EQUAL 6) | ||
qt_finalize_executable(GlitchEd25519) | ||
endif() |
Binary file added
BIN
+131 KB
....GlitchEd25519.BlazorWebApp.Qt/GlitchedPolygons.GlitchEd25519.BlazorWebApp.Qt/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
...gons.GlitchEd25519.BlazorWebApp.Qt/GlitchedPolygons.GlitchEd25519.BlazorWebApp.Qt/ico.qrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>favicon.ico</file> | ||
</qresource> | ||
</RCC> |
61 changes: 61 additions & 0 deletions
61
...ons.GlitchEd25519.BlazorWebApp.Qt/GlitchedPolygons.GlitchEd25519.BlazorWebApp.Qt/main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include <QApplication> | ||
#include <QtWebView> | ||
#include <QWebEngineView> | ||
#include <QWebEnginePage> | ||
#include <QWebEngineProfile> | ||
#include <QWebEngineSettings> | ||
|
||
static const QString APP_NAME("GlitchEd25519"); | ||
static const QString SETTING_ID_WINDOW_WIDTH("WindowWidth"); | ||
static const QString SETTING_ID_WINDOW_HEIGHT("WindowHeight"); | ||
static const QString SETTING_ID_WINDOW_MAXIMIZED("WindowMaximized"); | ||
static const QString PROFILE_NAME("GlitchedPolygons.Qt.WebEngine.Profile"); | ||
static const QUrl URL("https://ed25519.glitchedpolygons.com"); | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
const QApplication app(argc, argv); | ||
|
||
app.setOrganizationName("Glitched Polygons"); | ||
app.setOrganizationDomain("glitchedpolygons.com"); | ||
app.setApplicationVersion("1.0.0"); | ||
app.setApplicationName(APP_NAME); | ||
app.setApplicationDisplayName(APP_NAME); | ||
app.setWindowIcon(QIcon(":/favicon.ico")); | ||
|
||
QWebEngineProfile profile(PROFILE_NAME); | ||
|
||
profile.settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, true); | ||
profile.setPersistentStoragePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); | ||
|
||
QWebEnginePage page(&profile); | ||
page.load(URL); | ||
|
||
QSettings::setDefaultFormat(QSettings::IniFormat); | ||
QSettings settings; | ||
|
||
const int savedWindowWidth = settings.value(SETTING_ID_WINDOW_WIDTH, QVariant(1024)).toInt(); | ||
const int savedWindowHeight = settings.value(SETTING_ID_WINDOW_HEIGHT, QVariant(768)).toInt(); | ||
const bool savedWindowMaximizationState = settings.value(SETTING_ID_WINDOW_MAXIMIZED, QVariant(true)).toBool(); | ||
|
||
QWebEngineView view; | ||
view.setPage(&page); | ||
view.resize(savedWindowWidth, savedWindowHeight); | ||
|
||
if (savedWindowMaximizationState) | ||
{ | ||
view.showMaximized(); | ||
} | ||
else | ||
{ | ||
view.show(); | ||
} | ||
|
||
const int r = app.exec(); | ||
|
||
settings.setValue(SETTING_ID_WINDOW_WIDTH, QVariant(view.width())); | ||
settings.setValue(SETTING_ID_WINDOW_HEIGHT, QVariant(view.height())); | ||
settings.setValue(SETTING_ID_WINDOW_MAXIMIZED, QVariant(view.isMaximized())); | ||
|
||
return r; | ||
} |