Esempio n. 1
0
SettingDlg::SettingDlg():MyBaseDlg()
{
    isCancel = true;
    isFullScreenMode = false;

    setMainWidgetTitle("App Setting");

    form0 = new ZFormContainer(this, 0, ZSkinService::clsZFormContainer);
    //listBox0 = new ZListBox("%C%M", this);
    form1 = new ZFormContainer(this, 0, ZSkinService::clsZFormContainer);
    form2 = new ZFormContainer(this, 0, ZSkinService::clsZFormContainer);
    form3 = new ZFormContainer(this, 0, ZSkinService::clsZFormContainer);
    form4 = new ZFormContainer(this, 0, ZSkinService::clsZFormContainer);

    tabWidget = new ZNavTabWidget(this);
    this->setContentWidget(tabWidget);
    tabWidget->stopNextWhenKeyRepeat(true);

    QPixmap imgTab;
    imgTab.load(getAppDir()+"/img/tab0.png");
    tabWidget->addTab(form0, QIconSet(imgTab), "");
    imgTab.load(getAppDir()+"/img/tab1.png");
    tabWidget->addTab(form1, QIconSet(imgTab), "");
    imgTab.load(getAppDir()+"/img/tab2.png");
    tabWidget->addTab(form2, QIconSet(imgTab), "");
    imgTab.load(getAppDir()+"/img/tab3.png");
    tabWidget->addTab(form3, QIconSet(imgTab), ""); ;
    imgTab.load(getAppDir()+"/img/tab4.png");
    tabWidget->addTab(form4, QIconSet(imgTab), "");

    ZSoftKey *softKey = new ZSoftKey ( NULL, this, this );
    softKey->setText(ZSoftKey::LEFT,  lng->tr("FT_SELECT"), (ZSoftKey::TEXT_PRIORITY)0);
    softKey->setText(ZSoftKey::RIGHT, lng->tr("FT_CANCEL"), (ZSoftKey::TEXT_PRIORITY)0);
    softKey->setClickedSlot(ZSoftKey::RIGHT, this, SLOT (reject()));
    softKey->setClickedSlot(ZSoftKey::LEFT, this, SLOT (accept()));
    setCSTWidget(softKey);

    imei = getIMEI();
    imsi = getIMSI();

    buildTab0();
    buildTab1();
    buildTab2();
    buildTab3();
    buildTab4();

    startTimer(300);
}
CitySelectDlg::CitySelectDlg(QString str1,QString str2,QString str3):ZPopup()
{
    setTitle(str1);
    listBox = new ZListBox("%I%M",this);
    
    // insert menu items with images from SysRegistry
    ZConfig config ( getAppDir() + "cities.ini", false );
    QStringList grouplist;
    config.getGroupsKeyList ( grouplist );
    QString cityCode = "";
    
    for ( QStringList::Iterator it = grouplist.begin(); it != grouplist.end(); ++it ) 
    {
        cityCode = config.readEntry(*it, "Code", "");
        City *city = new City(listBox);
        qDebug(*it);
        qDebug(cityCode);
        city->setName(*it);
        city->setCode(cityCode);
        
        listBox->insertItem(city);
        city->appendSubItem(1,ctr(city->getName()));
        
    }
    
    insertChild(listBox);
    setSoftkeyText(str2,str3);
    connect(this,SIGNAL(leftSoftkeyClicked()),this,SLOT(slotSelected()));
    connect(listBox,SIGNAL(returnPressed(ZSettingItem *)),this,SLOT(slotItemClicked(ZSettingItem *)));
    
}
Esempio n. 3
0
void SettingDlg::getLngList()
{
    QString curLang = cfg->lngStr;

    QDir dir( QString("%1/lng").arg(getAppDir()) );
    dir.setFilter(QDir::Files);
    if ( !dir.isReadable() )
        return;

    QString qname;
    QStringList entries;
    QStringList::ConstIterator p;
    entries = dir.entryList();

    int i = 0;
    for (p=entries.begin(); p!=entries.end(); p++)
    {
        if ( *p == "." || *p == ".." )
            continue;
        qname = QString(*p);
        if (qname.find(".qm") > -1)
        {
#ifdef DEBUG
            std::cout<<"getLngList: LNG->"<< qname<<std::endl;
#endif
            lngcb->insertItem( qname, i);
            if(qname == curLang)
                lngcb->setCurrentItem(i);
            ++i;
        }
    }
}
Esempio n. 4
0
void SettingDlg::buildTab2()
{
    QString text = "IMEI : "+imei+"\n"+"IMSI : "+imsi;
    tab2Label = new ZLabel(text, form2, "ZLabel" , 0, (ZSkinService::WidgetClsID)4);
    tab2Label->setAutoResize(true);
    tab2Label->setFixedWidth ( SCREEN_WHIDTH );
    form2->addChild(tab2Label);

    ZSeparator *sep = new ZSeparator(form2);
    form2->addChild(sep);

    if( !codeComp->cpcp() )
    {
        regcb = new ZComboBox(form2);
        regcb->setTitle(lng->tr("FT_CHOOSE_REGTYPE"));
        regcb->setDlgTitle(lng->tr("FT_REGTYPE"));
        regcb->insertItem("IMEI", 0);
        regcb->insertItem("IMSI", 1);
        form2->addChild(regcb);

        if( cfg->reg_type == "IMEI" )
            regcb->setCurrentItem(0);
        else if ( cfg->reg_type == "IMSI" )
            regcb->setCurrentItem(1);

        sep = new ZSeparator(form2);
        form2->addChild(sep);

        QPixmap bt;
        bt.load(getAppDir()+"/img/reg.png");
        button = new ZPressButton(bt, lng->tr("FT_CONFIRM_REG") ,form2);
        button->setTitlePosition(ZPressButton::TitleLeft);
        form2->addChild(button);

        sep = new ZSeparator(form2);
        form2->addChild(sep);
        sep = new ZSeparator(form2);
        form2->addChild(sep);
        sep = new ZSeparator(form2);
        form2->addChild(sep);

        connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
    }
}
Esempio n. 5
0
void DeployDevCommand::runObject()
{
    USES_CONVERSION;

    EAppType app_type = getAppTypeFromCmdLine();
    TCHAR params_buf[MAX_PATH + 16];
    int new_copy = 0;
    TCHAR *app_dir = new TCHAR[MAX_PATH];
    getAppDir(&app_dir);

	HANDLE hFind;
	CE_FIND_DATA findData;

	hFind = CeFindFirstFile(app_dir, &findData);
	if (INVALID_HANDLE_VALUE == hFind) {
		_tprintf( TEXT("Application directory on device was not found\n"));
				
		new_copy = 1;

		if (!CeCreateDirectory(app_dir, NULL)) {
			printf ("Failed to create app directory\n");
			goto stop_emu_deploy;
		}
	}
	FindClose( hFind);

	if ((!new_copy) && (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))) {
		_tprintf( TEXT("Error: target directory is file\n"));
		goto stop_emu_deploy;
	}

	TCHAR remote_bundle_path[MAX_PATH];

	_tcscpy(remote_bundle_path, app_dir);
	_tcscat(remote_bundle_path, _T("\\rho"));

	hFind = CeFindFirstFile(remote_bundle_path, &findData);
	if (INVALID_HANDLE_VALUE == hFind) {
		_tprintf( TEXT("Bundle directory on device was not found\n"));

		if (!CeCreateDirectory(remote_bundle_path, NULL)) {
			printf ("Failed to create bundle directory\n");
			goto stop_emu_deploy;
		}
	}
	FindClose( hFind);

    int retval = EXIT_SUCCESS;

    if (exe_change)
    {
        retval = file::copyExecutable (app_exe, app_dir, use_shared_runtime);
        if (retval != EXIT_SUCCESS) {
            printf ("Failed to copy application executable\n");
            if (retval == 32) {
                printf ("Please, stop application on device and try again.\n");
            }
            releaseDeploy();
        }
    }
    else
    {
        printf ("%s executable POSTPONE.\n", app_exe);
    }

	if(!use_shared_runtime)
        retval = file::copyLicenseDll(lcdll_path, app_dir);
	if (retval != EXIT_SUCCESS) {
		printf ("Failed to copy license dll\n");
		if (retval == 32) {
			printf ("Please, stop application on device and try again.\n");
		}
		goto stop_emu_deploy;
	}

    if (file::copyBundle(bundle_path, _T("/"), remote_bundle_path) == EXIT_FAILURE) {
		printf ("Failed to copy bundle\n");
		goto stop_emu_deploy;
	}

	// establish network connectivity of the device from Windows Mobile Device Center (if applicable)
    wmdc::connectWMDC();

	Sleep(2 * 1000);

	_tprintf( TEXT("Starting application..."));
	TCHAR params[MAX_PATH];
	params[0] = 0;
	if (use_shared_runtime) {
		_tcscpy(params_buf, RE2_RUNTIME);
	    if (app_type == eRuby) {
		    _tcscpy(params, _T("-approot='\\Program Files\\"));
        }
        else {
            _tcscpy(params, _T("-jsapproot='\\Program Files\\"));
        }
		_tcscat(params, app_name);
		_tcscat(params, _T("'"));
	} else {
		_tcscpy(params_buf, TEXT("\\Program Files\\"));
		_tcscat(params_buf, app_name);
		_tcscat(params_buf, _T("\\"));
		_tcscat(params_buf, app_name);
		_tcscat(params_buf, _T(".exe"));
	}
	//_tcscat(params, _T("-log="));
	//_tcscat(params, log_port);
	_tprintf( TEXT("%s %s\n"), params_buf, params);

    if(!rapi::wceRunProcess(T2A(params_buf), T2A(params))) {
		_tprintf( TEXT("FAILED\n"));
		goto stop_emu_deploy;
	}
	_tprintf( TEXT("DONE\n"));

	ExitProcess(EXIT_SUCCESS);
    return;

stop_emu_deploy:
    releaseDeploy();
}
Esempio n. 6
0
void DeployEmuCabCommand::runObject()
{
    USES_CONVERSION;

    EAppType app_type = getAppTypeFromCmdLine();
    int new_copy = 0;
    TCHAR params_buf[MAX_PATH + 16];

    TCHAR *app_dir = new TCHAR[MAX_PATH];
    getAppDir(&app_dir);

    CreateThread(NULL, 0, rapi::startDEM, NULL, 0, NULL);

    _tprintf( TEXT("Starting emulator... "));
    if (!rapi::emuConnect (emu_name)) {
        _tprintf( TEXT("FAILED\n"));
        goto stop_emu_deploy;
    }
    _tprintf( TEXT("DONE\n"));

    _tprintf( TEXT("Cradle emulator... "));
    if(!rapi::emuCradle (emu_name)) {
        _tprintf( TEXT("FAILED\n"));
        goto stop_emu_deploy;
    }
    _tprintf( TEXT("DONE\n"));

    // start Windows Mobile Device Center for network connectivity of the device emulator (if applicable)
    wmdc::startWMDC();

    _tprintf( TEXT("Loading cab file..."));		
    if (!rapi::wcePutFile (T2A(cab_file), "")) {
        _tprintf( TEXT("FAILED\n"));
        goto stop_emu_deploy;
    }
    _tprintf( TEXT("DONE\n"));

    _tprintf( TEXT("Loading utility dll..."));
    if (!rapi::wcePutFile (RHOSETUP_DLL, "")) {
        _tprintf( TEXT("FAILED\n"));
        goto stop_emu_deploy;
    }
    _tprintf( TEXT("DONE\n"));

    _tprintf( TEXT("Setup application..."));

    //FIXME: rake gives pathname with unix-like '/' file separators,
    //so if we want to use this tool outside of rake, we should remember this
    //or check and convert cab_file
    TCHAR *p = _tcsrchr (cab_file, '/');
    if (p) p++;
    _tcscpy(params_buf, TEXT("/noui "));
    _tcscat(params_buf, p != NULL ? p : cab_file);

    if(!rapi::wceInvokeCabSetup(T2A(params_buf))) {
        _tprintf( TEXT("FAILED\n"));
        goto stop_emu_deploy;
    }
    _tprintf( TEXT("DONE\n"));

    // establish network connectivity of the device emulator from Windows Mobile Device Center (if applicable)
    wmdc::connectWMDC();

    rapi::emuBringToFront(emu_name);

    _tprintf( TEXT("Starting application..."));
    TCHAR params[MAX_PATH];
    params[0] = 0;
    if (use_shared_runtime) {
        _tcscpy(params_buf, RE2_RUNTIME);
        if (app_type == eRuby) {
            _tcscpy(params, _T("-approot='\\Program Files\\"));
        }
        else {
            _tcscpy(params, _T("-jsapproot='\\Program Files\\"));
        }
        _tcscat(params, app_name);
        _tcscat(params, _T("'"));
    } else {
        _tcscpy(params_buf, TEXT("\\Program Files\\"));
        _tcscat(params_buf, app_name);
        _tcscat(params_buf, _T("\\"));
        _tcscat(params_buf, app_name);
        _tcscat(params_buf, _T(".exe"));
    }
    //_tcscat(params, _T("-log="));
    //_tcscat(params, log_port);
    _tprintf( TEXT("%s %s\n"), params_buf, params);

    if(!rapi::wceRunProcess(T2A(params_buf), T2A(params))) {
        _tprintf( TEXT("FAILED\n"));
        goto stop_emu_deploy;
    }
    _tprintf( TEXT("DONE\n"));

    CoUninitialize();
    ExitProcess(EXIT_SUCCESS);
    return;

stop_emu_deploy:
    releaseDeploy();
}
int main(int argc, char** argv)
{
	ZApplication *a = new ZApplication(argc, argv);
	ZConfig conf("/ezxlocal/download/appwrite/setup/ezx_theme.cfg");
	QString skinpath = conf.readEntry("THEME_GROUP_LOG", "CurrentTheme");
	qDebug(skinpath);

	ZConfig conf2(skinpath);
	QString oriwallpaper = conf2.readEntry("THEME_CONFIG_TABLE", "WallPaper");
	qDebug(oriwallpaper);
	
	QPixmap *ori_pixmap = new QPixmap(oriwallpaper);//QWallpaper::sysWallpaper();//new QPixmap(wallpaper);
	if(ori_pixmap->isNull())
	{
	qDebug("DEBUG::  wallpaper is null");
	return 0;
	}
	QWallpaper::setSysWallpaper(ori_pixmap);
	ori_pixmap = QWallpaper::sysWallpaper();
	
	ZConfig setupconf(SETUPPATH);
	QString cityid = setupconf.readEntry("SETUP", "cityid");
	QString curskin = setupconf.readEntry("SETUP", "skin");
	QPixmap *wppanel = new QPixmap(getAppDir()+"skins/"+curskin+"/wp/wpweather.png");
	QPixmap *alarmpanel = new QPixmap(getAppDir()+"skins/"+curskin+"/wp/wpalarm.png");	
	QString alarmtext = setupconf.readEntry("WP", "text");
	int panel_x = setupconf.readNumEntry("WP", "panel_x"); 
	int panel_y = setupconf.readNumEntry("WP", "panel_y");
	int alarmpanel_x = setupconf.readNumEntry("WP", "alarmpanel_x");
	int alarmpanel_y = setupconf.readNumEntry("WP", "alarmpanel_y");
	bool showwp = setupconf.readBoolEntry("SETUP", "showweather");
	bool showalarm = setupconf.readBoolEntry("SETUP", "showwpalarm");
	
	ZConfig wsconf(getAppDir()+"skins/"+curskin+"/skin.ini");
	QString weatherpath = wsconf.readEntry("panel1", "weathericon");
	

	int weather_x = wsconf.readNumEntry("WP", "weather_x"); 
	int weather_y = wsconf.readNumEntry("WP", "weather_y"); 
	int city_x = wsconf.readNumEntry("WP", "city_x"); 
	int city_y = wsconf.readNumEntry("WP", "city_y"); 
	int weathertext_x = wsconf.readNumEntry("WP", "weathertext_x"); 
	int weathertext_y = wsconf.readNumEntry("WP", "weathertext_y"); 
	int size_city = wsconf.readUIntEntry("WP", "size_city");
	int size_weather = wsconf.readUIntEntry("WP", "size_weather");
	QColor textcolor(wsconf.readUIntEntry("WP", "text_R"),wsconf.readUIntEntry("WP", "text_G"),wsconf.readUIntEntry("WP", "text_B"));
	
	

	int alarmtext_x = wsconf.readNumEntry("WPALARM", "alarmtext_x");
	int alarmtext_y = wsconf.readNumEntry("WPALARM", "alarmtext_y");
	QColor alarmcolor(wsconf.readUIntEntry("WPALARM", "alarm_R"),wsconf.readUIntEntry("WPALARM", "alarm_G"),wsconf.readUIntEntry("WPALARM", "alarm_B"));
	int size_alarm = wsconf.readUIntEntry("WPALARM", "size_alarmtext");
	
	ZConfig infoconf(INFOPATH);
	int img1 = infoconf.readUIntEntry(cityid, "img1");
	QString city = infoconf.readEntry(cityid,"city");
	QString weathertext = infoconf.readEntry(cityid, "weather1")+infoconf.readEntry(cityid, "temp1");
	QPixmap *weather;
	if(img1<10)
	weather = new QPixmap(QString(getAppDir()+"weathericon/"+weatherpath+"/smallicon/"+"s000%1"+".png").arg(img1));
	else
	weather = new QPixmap(QString(getAppDir()+"weathericon/"+weatherpath+"/smallicon/"+"s00%1"+".png").arg(img1));

	
	
	
	QPainter painter;
	painter.begin(ori_pixmap);
	if(showwp)
	{
	painter.drawPixmap(panel_x, panel_y, *wppanel);
	painter.drawPixmap(weather_x+panel_x, weather_y+panel_y, *weather);
	painter.setFont(QFont("AMSCL", size_city, QFont::Bold));
	painter.setPen(textcolor);
	painter.drawText(city_x+panel_x, city_y+panel_y, city);
	painter.setFont(QFont("AMSCL", size_weather, QFont::Normal));
	painter.drawText(weathertext_x+panel_x, weathertext_y+panel_y, weathertext);
	}
	if(showalarm)
	{
	painter.drawPixmap(alarmpanel_x, alarmpanel_y, *alarmpanel);
	painter.setFont(QFont("AMSCL", size_alarm, QFont::Bold));
	painter.setPen(alarmcolor);
	painter.drawText(alarmpanel_x+alarmtext_x, alarmpanel_y+alarmtext_y, alarmtext);
	}
	
	
	painter.end();
	QWallpaper::setSysWallpaper(ori_pixmap);
	//int i = a->exec();
	delete ori_pixmap;
	delete wppanel;
	delete weather;
	delete a;
	delete alarmpanel;
	//return i;
	//qApp->quit();
	
}