File indexing completed on 2024-12-15 04:00:59
0001 /* 0002 * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #include <QApplication> 0008 0009 #include <QMainWindow> 0010 #include <QSplashScreen> 0011 #include <QLabel> 0012 0013 #include "main_window.hpp" 0014 #include "glaxnimate_app.hpp" 0015 #include "app_info.hpp" 0016 #include "android_style.hpp" 0017 #include "android_intent_handler.hpp" 0018 0019 // #include "android_file_picker.hpp" 0020 // #include <QDebug> 0021 0022 #ifdef Q_OS_ANDROID 0023 Q_DECL_EXPORT 0024 #endif 0025 int main(int argc, char *argv[]) 0026 { 0027 using namespace glaxnimate; 0028 using namespace glaxnimate::android; 0029 0030 gui::GlaxnimateApp app(argc, argv); 0031 0032 AppInfo::instance().init_qapplication(); 0033 0034 app.setStyle(new AndroidStyle); 0035 app.setStyleSheet(R"( 0036 QPushButton { 0037 border: 1px solid #8f8f8f; 0038 border-radius: 6px; 0039 background-color: #f3f3f3; 0040 } 0041 0042 QToolButton { 0043 border: 1px solid transparent; 0044 border-radius: 6px; 0045 background-color: transparent; 0046 } 0047 0048 QToolButton:pressed, QToolButton:checked, QPushButton:pressed, QPushButton:checked { 0049 border: 1px solid #8f8f8f; 0050 background-color: #dedede; 0051 } 0052 0053 QMenu { 0054 overflow: hidden; 0055 border: 1px solid #8f8f8f; 0056 margin: 0; 0057 padding: -1px; 0058 border-radius: 6px; 0059 background-color: #f3f3f3; 0060 color: #000; 0061 } 0062 0063 QMenu::item { 0064 padding: 2px 25px 2px 20px; 0065 border: 1px solid transparent; 0066 min-width: 400px; 0067 } 0068 0069 QMenu::item:selected, QMenu::item:checked { 0070 border-color: #8f8f8f; 0071 background: #dedede; 0072 } 0073 )"); 0074 0075 app.initialize(); 0076 0077 #ifdef Q_OS_ANDROID 0078 QIcon::setThemeSearchPaths({"assets:/share/glaxnimate/glaxnimate/icons"}); 0079 #endif 0080 QIcon::setThemeName("icons"); 0081 0082 0083 0084 // qDebug() << "\n\n\x1b[31m================================\x1b[m"; 0085 // qDebug() << AndroidFilePicker::list_assets("icons/icons"); 0086 // qDebug() << AndroidFilePicker::list_assets("images/icons"); 0087 // qDebug() << GlaxnimateApp::instance()->data_file("images/icons/keyframe-record.svg"); 0088 // QIcon icon("assets:/images/icons/keyframe-record.svg"); 0089 // qDebug() << icon.isNull() << icon.pixmap(24).isNull(); 0090 // qDebug() << "\x1b[31m================================\x1b[m\n\n"; 0091 0092 MainWindow window; 0093 window.show(); 0094 0095 QUrl intent = AndroidIntentHandler::instance()->view_uri(); 0096 if ( !intent.isEmpty() ) 0097 window.open_intent(intent); 0098 0099 QObject::connect( 0100 AndroidIntentHandler::instance(), &AndroidIntentHandler::view_uri_changed, 0101 &window, &MainWindow::open_intent, 0102 Qt::QueuedConnection 0103 ); 0104 0105 int ret = app.exec(); 0106 0107 app.finalize(); 0108 0109 return ret; 0110 }