diff --git a/frameworks/tools/qt/simulator/entry/main.cpp b/frameworks/tools/qt/simulator/entry/main.cpp index 65d1079..f593370 100644 --- a/frameworks/tools/qt/simulator/entry/main.cpp +++ b/frameworks/tools/qt/simulator/entry/main.cpp @@ -51,9 +51,6 @@ namespace { void InitPage(OHOS::MainWidget *mainWidget, int16_t jsWindowHeight, int16_t jsWindowWidth, int16_t childPageHeight) { - int16_t defaultHeapSize = 64; // KB - const int16_t minJSHeapSize = 48; // KB - const int16_t maxJSHeapSize = 512; // KB QString jsBundlePath = SimulatorConfig::GetInstance().GetConfigValue(CONFIG_KEY_JSBUNDLE_PATH); if (jsBundlePath.isNull() || jsBundlePath.isEmpty()) { jsBundlePath = ""; @@ -63,10 +60,11 @@ namespace { jsBundlePath = ""; } } + int16_t defaultHeapSize = DEFAULT_JSHEAP_SIZE; // KB QString jsHeapSize = SimulatorConfig::GetInstance().GetConfigValue(CONFIG_KEY_JSHEAP_SIZE); if (!jsHeapSize.isNull() && !jsHeapSize.isEmpty()) { int tempSize = jsHeapSize.toInt(); - if (tempSize >= minJSHeapSize && tempSize <= maxJSHeapSize) { + if (tempSize >= MIN_JSHEAP_SIZE && tempSize <= MAX_JSHEAP_SIZE) { defaultHeapSize = tempSize; } } @@ -81,15 +79,13 @@ namespace { int main(int argc, char* argv[]) { - const int16_t childPageHeight = 100; // pixel - const int16_t defaultJSWindowWidth = 960; // pixel - const int16_t defaultJSWindowHeight = 480; // pixel + QApplication app(argc, argv); InitUIkit(); OHOS::MainWidget mainWidget; mainWidget.setWindowTitle("ACE Simulator"); - mainWidget.setFixedSize(defaultJSWindowWidth, defaultJSWindowHeight + childPageHeight); - InitPage(&mainWidget, defaultJSWindowHeight, defaultJSWindowWidth, childPageHeight); + mainWidget.setFixedSize(DEFAULT_JSWINDOW_WIDTH, DEFAULT_JSWINDOW_HEIGHT + CHILD_PAGE_HEIGHT); + InitPage(&mainWidget, DEFAULT_JSWINDOW_HEIGHT, DEFAULT_JSWINDOW_WIDTH, CHILD_PAGE_HEIGHT); mainWidget.show(); return app.exec(); } diff --git a/frameworks/tools/qt/simulator/entry/simulator_config.cpp b/frameworks/tools/qt/simulator/entry/simulator_config.cpp index 7c3ac4a..ebf4a8a 100644 --- a/frameworks/tools/qt/simulator/entry/simulator_config.cpp +++ b/frameworks/tools/qt/simulator/entry/simulator_config.cpp @@ -19,8 +19,6 @@ #include #include - - SimulatorConfig& SimulatorConfig::GetInstance() { static SimulatorConfig instance; diff --git a/frameworks/tools/qt/simulator/entry/simulator_config.h b/frameworks/tools/qt/simulator/entry/simulator_config.h index cbef700..1b04bea 100644 --- a/frameworks/tools/qt/simulator/entry/simulator_config.h +++ b/frameworks/tools/qt/simulator/entry/simulator_config.h @@ -23,6 +23,12 @@ const QString CONFIG_FILE_PATH = QDir::currentPath() + "/qt.ini"; const QString CONFIG_KEY_JSBUNDLE_PATH = "JSBundlePath"; const QString CONFIG_KEY_JSHEAP_SIZE = "JSHeapSize"; +const int16_t DEFAULT_JSHEAP_SIZE = 64; // KB +const int16_t MIN_JSHEAP_SIZE = 48; // KB +const int16_t MAX_JSHEAP_SIZE = 512; // KB +const int16_t DEFAULT_JSWINDOW_WIDTH = 960; // pixel +const int16_t DEFAULT_JSWINDOW_HEIGHT = 480; // pixel +const int16_t CHILD_PAGE_HEIGHT = 100; // pixel class SimulatorConfig { public: