mirror of
https://github.com/openharmony/ace_engine_lite.git
synced 2026-07-21 00:35:30 -04:00
add ace simulator
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
|
||||
|
||||
|
||||
SimulatorConfig& SimulatorConfig::GetInstance()
|
||||
{
|
||||
static SimulatorConfig instance;
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user