Powerline_RateShowDlg::Powerline_RateShowDlg(QWidget *parent) :
    QDialog(parent)
    ,ui(new Ui::Powerline_RateShowDlg)
	,m_scene(NULL)
	,m_bMove(false)
	,m_TopEdge(NULL)
	,m_TopNode(NULL)
	,m_flags(0)
	,m_isPowerlineShow(false)
	,m_prevPageBtnState(BTNSTATE_NORMAL)
	,m_nextPageBtnState(BTNSTATE_NORMAL)

	,m_totalPage(0)
	,m_curPageIdx(1)
	/*,m_pPLDev(NULL)*/
{
    ui->setupUi(this);
	
	createGraphics();
	initSlot();
	createControlPannel();
	initStyle();
	initLanguage();

#ifdef TEST_PL_CODE
	ui->prevPageBtn->setFlat(false);
	ui->nextPageBtn->setFlat(false);
#endif
}
Example #2
0
bool MMSLabelWidget::create(MMSWindow *root, string className, MMSTheme *theme) {
    this->type = MMSWIDGETTYPE_LABEL;
    this->className = className;

    // init attributes for drawable widgets
    this->da = new MMSWIDGET_DRAWABLE_ATTRIBUTES;
    if (theme) this->da->theme = theme;
    else this->da->theme = globalTheme;
    this->labelWidgetClass = this->da->theme->getLabelWidgetClass(className);
    this->da->baseWidgetClass = &(this->da->theme->labelWidgetClass.widgetClass);
    if (this->labelWidgetClass) this->da->widgetClass = &(this->labelWidgetClass->widgetClass);
    else this->da->widgetClass = NULL;

    // clear
    initLanguage();
    this->fontpath = "";
    this->fontname = "";
    this->fontsize = 0;
    this->font = NULL;
    this->load_font = true;
    this->slide_width = 0;
    this->slide_offset = 0;
    this->frame_delay = 100;
    this->frame_delay_set = false;
    this->labelThread = NULL;
    this->translated = false;
    this->swap_left_right = false;
    this->current_fgset = false;

    return MMSWidget::create(root, true, false, false, true, false, false, false);
}
Example #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    m_strLanguage = tr("English");

    m_spriteMgr = NULL;
    m_pgv = NULL;

    m_settings = new QSettings(QString("njfever"), STR_MY_TITLE);

    initLanguage();

    createViews();

    m_bProjectIsNull = true;
    m_bIsEditedWithoutSave = false;
    m_bIsSceneMouseEvent = false;

    m_strWorkDirectory = "";

    createActions();

    createMenus();

    createToolbarButtons();

    newProject();

    m_actions[ActionKey::SpriteLock]->setChecked(true);
    lockSprites();
}
PowerlinePrompt::PowerlinePrompt(QWidget *parent) :
QDialog(parent),
ui(new Ui::PowerlinePrompt)
,m_bMove(false)
{
	ui->setupUi(this);

	init();
	initLanguage();
}
Example #5
0
void UI::init (ServiceProvider& serviceProvider, EventHandler &eventHandler, IFrontend &frontend)
{
	System.track("step", "initui");
	const std::string& language = Config.getLanguage();
	if (!initLanguage(language))
		initLanguage("en_GB");
	Commands.registerCommand(CMD_UI_PRINTSTACK, bindFunction(UI, printStack));
	Commands.registerCommand(CMD_UI_PUSH, bindFunction(UI, pushCmd));
	Commands.registerCommand(CMD_UI_RESTART, bindFunction(UI, initRestart));
	Commands.registerCommand(CMD_UI_POP, bindFunction(UI, pop));
	Commands.registerCommand(CMD_UI_FOCUS_NEXT, bindFunction(UI, focusNext));
	Commands.registerCommand(CMD_UI_FOCUS_PREV, bindFunction(UI, focusPrev));
	Commands.registerCommand(CMD_UI_EXECUTE, bindFunction(UI, runFocusNode));
	_showCursor = Config.getConfigVar("showcursor", System.wantCursor() ? "true" : "false", true)->getBoolValue();
	_cursor = _showCursor;
	if (_cursor)
		info(LOG_CLIENT, "enable cursor");
	else
		info(LOG_CLIENT, "disable cursor");

	_serviceProvider = &serviceProvider;
	_eventHandler = &eventHandler;
	_frontend = &frontend;
	eventHandler.registerObserver(this);

	info(LOG_CLIENT, "init the texture cache with " + serviceProvider.getTextureDefinition().getTextureSize());
	_textureCache.init(_frontend, serviceProvider.getTextureDefinition());
	_spriteCache.init();

	FontDefinition& fontDef = Singleton<FontDefinition>::getInstance();
	FontDefMapConstIter i = fontDef.begin();
	for (; i != fontDef.end(); ++i) {
		_fonts[i->second->id] = BitmapFontPtr(new BitmapFont(i->second, _frontend));
	}

	Singleton<GameRegistry>::getInstance().getGame()->initUI(_frontend, serviceProvider);

	_mouseCursor = loadTexture("mouse");

	loadGesture(zoominGesture, SDL_arraysize(zoominGesture));
	loadGesture(zoomoutGesture, SDL_arraysize(zoomoutGesture));
}
Example #6
0
File: main.c Project: libcg/PSP_Bot
int main()
{
  SetupCallbacks();

  initLanguage();
  initLevel();
  initGame();
  initDisp();

  sceKernelSleepThread();
  return 0;
}
PowerlineDeviceName::PowerlineDeviceName(QWidget *parent) :
QDialog(parent)
,ui(new Ui::PowerlineDeviceName)
,m_bMove(false)
{
	ui->setupUi(this);


	Init();
	slotInit();
	initLanguage();
	retranslateUi();

}
Example #8
0
bool MMSLabelWidget::init() {
    // init widget basics
    if (!MMSWidget::init())
        return false;

    // init language
    initLanguage();

    // load font
    loadFont();

    // first time the label thread has to be started
    if (getSlidable()) {
        setSlidable(true);
    }

    return true;
}
Example #9
0
MMSWidget *MMSLabelWidget::copyWidget() {
    // create widget
    MMSLabelWidget *newWidget = new MMSLabelWidget(this->rootwindow, className);

    newWidget->className = this->className;
    newWidget->labelWidgetClass = this->labelWidgetClass;
    newWidget->myLabelWidgetClass = this->myLabelWidgetClass;

    newWidget->lang = this->lang;
    newWidget->translated_text = this->translated_text;
    newWidget->current_fgcolor = this->current_fgcolor;

    // copy base widget
    MMSWidget::copyWidget((MMSWidget*)newWidget);

    // reload my font
    initLanguage(newWidget);
    newWidget->fontpath = "";
    newWidget->fontname = "";
    newWidget->fontsize = 0;
    newWidget->font = NULL;
    newWidget->load_font = true;
    newWidget->slide_width = 0;
    newWidget->slide_offset = 0;
    newWidget->frame_delay = 100;
    newWidget->frame_delay_set = false;
    newWidget->labelThread = NULL;
    newWidget->translated = false;
    newWidget->swap_left_right = false;
    newWidget->current_fgset = false;
    if (this->rootwindow) {
        // load font
        loadFont(newWidget);

        // first time the label thread has to be started
        if (newWidget->getSlidable()) {
            newWidget->setSlidable(true);
        }
    }

    return newWidget;
}
Example #10
0
int main(int argc, char* argv[])
{
  SetupCallbacks();
  #ifdef DEBUG
    usbStorage();
  #endif

  strcpy(cwd,argv[0]);
  cwd[strlen(cwd)-strlen("/eboot.pbp")] = '\0';

  configLoad();
  initLanguage();
  initAudio();
  initLua();
  initGame();
  initDisp();

  sceKernelSleepThread();
  return 0;
}
Example #11
0
void CineEngine::initialize() {
	_globalVars.reinit(NUM_MAX_VAR + 1);

	// Initialize all savegames' descriptions to empty strings
	memset(currentSaveName, 0, sizeof(currentSaveName));

	// Resize object table to its correct size and reset all its elements
	g_cine->_objectTable.resize(NUM_MAX_OBJECT);
	resetObjectTable();

	// Resize animation data table to its correct size and reset all its elements
	g_cine->_animDataTable.resize(NUM_MAX_ANIMDATA);
	freeAnimDataTable();

	// Resize zone data table to its correct size and reset all its elements
	g_cine->_zoneData.resize(NUM_MAX_ZONE);
	Common::set_to(g_cine->_zoneData.begin(), g_cine->_zoneData.end(), 0);

	// Resize zone query table to its correct size and reset all its elements
	g_cine->_zoneQuery.resize(NUM_MAX_ZONE);
	Common::set_to(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);

	_timerDelayMultiplier = 12; // Set default speed
	setupOpcodes();

	initLanguage(getLanguage());

	if (getGameType() == Cine::GType_OS) {
		renderer = new OSRenderer;
	} else {
		renderer = new FWRenderer;
	}

	renderer->initialize();

	collisionPage = new byte[320 * 200];
	memset(collisionPage, 0, 320 * 200);

	// Clear part buffer as there's nothing loaded into it yet.
	// Its size will change when loading data into it with the loadPart function.
	g_cine->_partBuffer.clear();

	if (getGameType() == Cine::GType_OS) {
		readVolCnf();
	}

	loadTextData("texte.dat");

	if (getGameType() == Cine::GType_OS && !(getFeatures() & GF_DEMO)) {
		loadPoldatDat("poldat.dat");
		loadErrmessDat("errmess.dat");
	}

	// in case ScummVM engines can be restarted in the future
	g_cine->_scriptTable.clear();
	g_cine->_relTable.clear();
	g_cine->_objectScripts.clear();
	g_cine->_globalScripts.clear();
	g_cine->_bgIncrustList.clear();
	freeAnimDataTable();
	g_cine->_overlayList.clear();
	g_cine->_messageTable.clear();
	resetObjectTable();

	var8 = 0;

	var2 = var3 = var4 = var5 = 0;

	musicIsPlaying = 0;
	currentDatName[0] = 0;

	_preLoad = false;
	if (ConfMan.hasKey("save_slot") && !_restartRequested) {
		char saveNameBuffer[256];

		sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), ConfMan.getInt("save_slot"));

		bool res = makeLoad(saveNameBuffer);

		if (res)
			_preLoad = true;
	}

	if (!_preLoad) {
		loadPrc(BOOT_PRC_NAME);
		strcpy(currentPrcName, BOOT_PRC_NAME);
		setMouseCursor(MOUSE_CURSOR_NORMAL);
	}
}
Example #12
0
void initProgram()
{
	//------------------------
	// start initializing crap
	//------------------------
	defaultExceptionHandler(); // set up the exception handler

    powerON(POWER_ALL_2D); // turn on everything

	#ifndef DEBUG_MODE
	fb_init(); // initialize top screen video
	#else
	debugInit();
	#endif
	bg_init(); // initialize bottom screen video

	setNewOrientation(ORIENTATION_0);

	// set up extra vram banks to be scratch memory
	vramSetBankE(VRAM_E_LCD);
	vramSetBankF(VRAM_F_LCD);
	vramSetBankG(VRAM_G_LCD);
	vramSetBankH(VRAM_H_LCD);
	vramSetBankI(VRAM_I_LCD);

	fb_setBGColor(30653);
	bg_setBGColor(0);
	drawStartSplash();

	lcdMainOnTop(); // set fb to top screen
	fb_swapBuffers();
	bg_swapBuffers();

	// out of order for competition
	irqInit(); // initialize irqs

    irqSet(IRQ_VBLANK, startvBlank);
	irqEnable(IRQ_VBLANK);

	setMode(INITFAT);
	setSoundInterrupt(); // initialize fifo irq

	setGenericSound(11025, 127, 64, 1);
	waitForInit(); // wait until arm7 has loaded and gone to sleep
	initComplexSound(); // initialize sound variables
	initWifi();
	fixGautami();

	setCursorProperties(0, 2, 0, 0);
	initCapture();
	initClipboard();

	// set defaults to english in case we can't load the langauge file for
	// some reason also takes care of partial translations.
	initLanguage();
	initRandomList();
	fixAndTags();

	resetKeyboard();
	setDate();

	if(!DRAGON_InitFiles())
	{
		// oops, no cf card!
		setMode(DISPLAYCOW);

		setFont(font_arial_11);
		setColor(0xFFFF);

		bg_dispSprite(96, 5, errmsg, 0);
		bg_setClipping(5,25,250,181);
		bg_dispString(0,0,l_nofat);
		bg_swapBuffers();

		while(1)
		{
			// wee, la la la!
		  // More or less, we aren't going to do nothing here
		}
	}

	//--------------------------------------------------------------------
	//finished init, now check to make sure the DSOrganize dir is there...
	//--------------------------------------------------------------------

	findDataDirectory();
	makeDirectories();

	if(DRAGON_FileExists("DSOrganize") != FE_DIR)
	{
		setMode(DISPLAYCOW);

		// oops, not there, we must create!
		DRAGON_mkdir("DSOrganize");
		DRAGON_chdir("DSOrganize");
		DRAGON_mkdir("DAY");
		DRAGON_mkdir("HELP");
		DRAGON_mkdir("LANG");
		DRAGON_mkdir("RESOURCES");
		DRAGON_mkdir("REMINDER");
		DRAGON_mkdir("SCRIBBLE");
		DRAGON_mkdir("TODO");
		DRAGON_mkdir("VCARD");
		DRAGON_mkdir("ICONS");
		DRAGON_mkdir("CACHE");
		DRAGON_mkdir("COOKIES");
		DRAGON_mkdir("HOME");
		DRAGON_chdir("/");

		makeDefaultSettings();

		setFont(font_arial_11);
		setColor(0xFFFF);

		bg_dispSprite(96, 5, errmsg, 0);
		bg_setClipping(5,25,250,181);
		bg_dispString(0,0, l_createdir);
		bg_swapBuffers();

		while(!keysDown())
		{
			scanKeys();
		}
	}

	setMode(INITPLUGIN);

	//-------------------------------------------------------------------
	//finished creating dirs, now check to make sure if they extracted it
	//did their extracting program actually get all the dirs?
	//-------------------------------------------------------------------

	DRAGON_chdir(d_base);

	if(DRAGON_FileExists("Day") != FE_DIR)
	{
		DRAGON_mkdir("DAY");
	}
	if(DRAGON_FileExists("Help") != FE_DIR)
	{
		DRAGON_mkdir("HELP");
	}
	if(DRAGON_FileExists("Lang") != FE_DIR)
	{
		DRAGON_mkdir("LANG");
	}
	if(DRAGON_FileExists("Reminder") != FE_DIR)
	{
		DRAGON_mkdir("REMINDER");
	}
	if(DRAGON_FileExists("Scribble") != FE_DIR)
	{
		DRAGON_mkdir("SCRIBBLE");
	}
	if(DRAGON_FileExists("Todo") != FE_DIR)
	{
		DRAGON_mkdir("TODO");
	}
	if(DRAGON_FileExists("VCard") != FE_DIR)
	{
		DRAGON_mkdir("VCARD");
	}
	if(DRAGON_FileExists("Icons") != FE_DIR)
	{
		DRAGON_mkdir("ICONS");
	}
	if(DRAGON_FileExists("Cache") != FE_DIR)
	{
		DRAGON_mkdir("CACHE");
	}
	if(DRAGON_FileExists("Cookies") != FE_DIR)
	{
		DRAGON_mkdir("COOKIES");
	}
	if(DRAGON_FileExists("Home") != FE_DIR)
	{
		DRAGON_mkdir("HOME");
	}

	DRAGON_chdir("/");

	//-------------------------------------------
	//how about we load the settings for them eh?
	//-------------------------------------------
	loadSettings();

	DRAGON_chdir(d_base);

	if(DRAGON_FileExists("startup.wav") == FE_FILE)
	{
		char tStr[256];

		sprintf(tStr, "%sstartup.wav", d_base);
		loadWavToMemory();
		loadSound(tStr);
	}

	DRAGON_chdir("/");
	initStartScreen();

    irqSet(IRQ_VBLANK, vBlank);
	fb_setBGColor(genericFillColor);
	bg_setBGColor(genericFillColor);
}
Example #13
0
int
Atcleci_Init(Tcl_Interp * interp)
{
  int             rc;
  size_t          chunk_bytes = 0;
  void           *eciHandle;
  void           *eciLib;
  // < configure shared library symbols

  eciLib = dlopen(ECILIBRARYNAME, RTLD_LAZY);
  if (eciLib == NULL) {
    Tcl_AppendResult(interp, "Could not load ",
                     ECILIBRARYNAME,
                     "\nPlease install the IBM ViaVoice Outloud RTK",
                     NULL);
    return TCL_ERROR;
  }

  _eciVersion =
      (void (*)(char *)) (unsigned long) dlsym(eciLib, "eciVersion");
  _eciGetAvailableLanguages =
      (int (*)(enum ECILanguageDialect *, int *)) (unsigned long)
      dlsym(eciLib, "eciGetAvailableLanguages");
  _eciNewEx = (void *(*)(enum ECILanguageDialect)) (unsigned long)
      dlsym(eciLib, "eciNewEx");
  _eciDelete =
      (void (*)(void *)) (unsigned long) dlsym(eciLib, "eciDelete");
  _eciReset = (int (*)(void *)) (unsigned long) dlsym(eciLib, "eciReset");
  _eciStop = (int (*)(void *)) (unsigned long) dlsym(eciLib, "eciStop");
  _eciClearInput =
      (int (*)(void *)) (unsigned long) dlsym(eciLib, "eciClearInput");
  _eciPause =
      (int (*)(void *, int)) (unsigned long) dlsym(eciLib, "eciPause");
  _eciSynthesize =
      (int (*)(void *)) (unsigned long) dlsym(eciLib, "eciSynthesize");
  _eciSynchronize =
      (int (*)(void *)) (unsigned long) dlsym(eciLib, "eciSynchronize");
  _eciSpeaking =
      (int (*)(void *)) (unsigned long) dlsym(eciLib, "eciSpeaking");
  _eciInsertIndex =
      (int (*)(void *, int)) (unsigned long) dlsym(eciLib,
                                                   "eciInsertIndex");
  _eciAddText =
      (int (*)(void *, char *)) (unsigned long) dlsym(eciLib,
                                                      "eciAddText");
  _eciSetParam =
      (int (*)(void *, int, int)) (unsigned long) dlsym(eciLib,
                                                        "eciSetParam");
  _eciGetVoiceParam = (int (*)(void *, int, int))
      (unsigned long) dlsym(eciLib, "eciGetVoiceParam");
  _eciSetVoiceParam = (int (*)(void *, int, int, int))
      (unsigned long) dlsym(eciLib, "eciSetVoiceParam");
  _eciRegisterCallback = (void
                          (*)(void *,
                              int (*)(void *, int, long,
                                      void *), void *)) (unsigned long)
      dlsym(eciLib, "eciRegisterCallback");
  _eciSetOutputBuffer = (int (*)(void *, int, short *)) (unsigned long)
      dlsym(eciLib, "eciSetOutputBuffer");
  _eciSetOutputDevice =
      (int (*)(void *, int)) (unsigned long) dlsym(eciLib,
                                                   "eciSetOutputDevice");

  // >
  // < check for needed symbols

  int             okay = 1;
  if (!_eciNewEx) {
    okay = 0;
    Tcl_AppendResult(interp, "eciNewEx undef\n", NULL);
  }
  if (!_eciDelete) {
    okay = 0;
    Tcl_AppendResult(interp, "eciDelete undef\n", NULL);
  }
  if (!_eciReset) {
    okay = 0;
    Tcl_AppendResult(interp, "eciReset undef\n", NULL);
  }
  if (!_eciStop) {
    okay = 0;
    Tcl_AppendResult(interp, "eciStop undef\n", NULL);
  }
  if (!_eciClearInput) {
    okay = 0;
    Tcl_AppendResult(interp, "eciClearInput undef\n", NULL);
  }
  if (!_eciPause) {
    okay = 0;
    Tcl_AppendResult(interp, "eciPause undef\n", NULL);
  }
  if (!_eciSynthesize) {
    okay = 0;
    Tcl_AppendResult(interp, "eciSynthesize undef\n", NULL);
  }
  if (!_eciSpeaking) {
    okay = 0;
    Tcl_AppendResult(interp, "eciSpeaking undef\n", NULL);
  }
  if (!_eciInsertIndex) {
    okay = 0;
    Tcl_AppendResult(interp, "eciInsertIndex undef\n", NULL);
  }
  if (!_eciAddText) {
    okay = 0;
    Tcl_AppendResult(interp, "eciAddText undef\n", NULL);
  }
  if (!_eciSetParam) {
    okay = 0;
    Tcl_AppendResult(interp, "eciSetParam undef\n", NULL);
  }
  if (!_eciSetParam) {
    okay = 0;
    Tcl_AppendResult(interp, "eciSetParam undef\n", NULL);
  }
  if (!_eciGetVoiceParam) {
    okay = 0;
    Tcl_AppendResult(interp, "eciGetVoiceParam undef\n", NULL);
  }
  if (!_eciSetVoiceParam) {
    okay = 0;
    Tcl_AppendResult(interp, "eciSetVoiceParam undef\n", NULL);
  }
  if (!_eciRegisterCallback) {
    okay = 0;
    Tcl_AppendResult(interp, "eciRegisterCallback undef\n", NULL);
  }
  if (!_eciSetOutputBuffer) {
    okay = 0;
    Tcl_AppendResult(interp, "eciSetOutputBuffer undef\n", NULL);
  }
  if (!_eciSetOutputDevice) {
    okay = 0;
    Tcl_AppendResult(interp, "eciSetOutputDevice undef\n", NULL);
  }
  if (!_eciGetAvailableLanguages) {
    okay = 0;
    Tcl_AppendResult(interp, "_eciGetAvailableLanguages undef\n", NULL);
  }
  if (!okay) {
    Tcl_AppendResult(interp, "Missing symbols from ",
                     ECILIBRARYNAME, NULL);
    return TCL_ERROR;
  }
  // >
  // <setup package, create tts handle

  if (Tcl_PkgProvide(interp, PACKAGENAME, PACKAGEVERSION) != TCL_OK) {
    Tcl_AppendResult(interp, "Error loading ", PACKAGENAME, NULL);
    return TCL_ERROR;
  }

  static enum ECILanguageDialect aLanguages[LANG_INFO_MAX];
  int             nLanguages = LANG_INFO_MAX;
  _eciGetAvailableLanguages(aLanguages, &nLanguages);

  enum ECILanguageDialect aDefaultLanguage =
      initLanguage(interp, aLanguages, nLanguages);
  if (aDefaultLanguage == NODEFINEDCODESET) {
    Tcl_AppendResult(interp, "No language found", PACKAGENAME, NULL);
    return TCL_ERROR;
  }

  eciHandle = _eciNewEx(aDefaultLanguage);
  if (eciHandle == 0) {
    Tcl_AppendResult(interp, "Could not open text-to-speech engine", NULL);
    return TCL_ERROR;
  }
  // >
  // <initialize alsa
  chunk_bytes = alsa_init();
  // <Finally, allocate waveBuffer

  fprintf(stderr, "allocating %d samples\n", chunk_bytes);
  waveBuffer = (short *) malloc(chunk_bytes * sizeof(short));
  if (waveBuffer == NULL) {
    fprintf(stderr, "not enough memory");
    exit(EXIT_FAILURE);
  }
  // >
  // >
  // <initialize TTS

  if ((_eciSetParam(eciHandle, eciInputType, 1) == -1)
      || (_eciSetParam(eciHandle, eciSynthMode, 1) == -1)
      || (_eciSetParam(eciHandle, eciSampleRate, 1) == -1)) {
    Tcl_AppendResult(interp, "Could not initialized tts", NULL);
    _eciDelete(eciHandle);
    return TCL_ERROR;
  }
  _eciRegisterCallback(eciHandle, eciCallback, interp);

  // >
  // <set output to buffer

  rc = _eciSynchronize(eciHandle);
  if (!rc) {
    Tcl_AppendResult(interp, "Error  resetting TTS engine.\n", NULL);
    return TCL_ERROR;
  }
  rc = _eciSetOutputBuffer(eciHandle, chunk_bytes, waveBuffer);
  if (!rc) {
    Tcl_AppendResult(interp, "Error setting output buffer.\n", NULL);
    return TCL_ERROR;
  }
  fprintf(stderr,
          "output buffered to waveBuffer with size %d\n", chunk_bytes);

  // >
  // <register tcl commands

  Tcl_CreateObjCommand(interp, "setRate", SetRate,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "getRate", GetRate,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "ttsVersion", getTTSVersion,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "alsaState", showAlsaState,
                       (ClientData) NULL, TclEciFree);
  Tcl_CreateObjCommand(interp, "say", Say,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "synth", Say, (ClientData) eciHandle, NULL);
  Tcl_CreateObjCommand(interp, "synchronize", Synchronize,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "stop", Stop,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "speakingP", SpeakingP,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "pause", Pause,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "resume", Resume,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "setOutput", setOutput,
                       (ClientData) eciHandle, TclEciFree);
  Tcl_CreateObjCommand(interp, "setLanguage", SetLanguage,
                       (ClientData) eciHandle, TclEciFree);
  // >
  // <set up index processing

  rc = Tcl_Eval(interp, "proc index x {global tts; \
set tts(last_index) $x}");
void
#elif  __linux__
int 
#endif
main(int argc, char **argv)
{
   // Directory
   std::string sDir = argv[1];
#ifdef _WIN32
   HANDLE          hList;
   WIN32_FIND_DATA FileData;
   std::string sDirPattern;
#elif  __linux__
   // Directory pointer
   DIR *pDir;
   // pointer to the directory entry
   struct dirent *pEntry;
#endif

   // Language
   std::string sLanguage = argv[2];
   int iLanguage = initLanguage(sLanguage);

   // Verifying if the directory exist
   if (!isDir(sDir)) {
      exit(1);
   }

#ifdef __linux__
   // Open the directory
   if ((pDir = opendir(sDir.c_str())) == NULL) {
      std::cerr << __FILE__ << ":" << __LINE__ << " "
           << "Error in opendir() [" << sDir << "] " << std::endl
           << "errno (" << errno << ")" << std::endl;
      exit(1);
   }
#endif

#ifdef _WIN32
   sDirPattern = sDir;
   sDirPattern += "\\*";
   // Get the first file
   if ((hList = FindFirstFile(sDirPattern.c_str(), &FileData)) == INVALID_HANDLE_VALUE)
#elif  __linux__
   if ((pEntry = readdir(pDir)) == NULL)
#endif
   {
     std::cerr << __FILE__ << ":" << __LINE__ << " "
          << "No files found" << std::endl
          << "errno (" << errno << ")" << std::endl;
     exit(1);
   }
   // Directory: read entries
   do 
   {
#ifdef _WIN32
      char *pFileName = FileData.cFileName;
#elif  __linux__
      char *pFileName = pEntry->d_name;
#endif

      std::string sFileType;
      off_t st_size = 0;     // total size, in bytes
      if ((st_size = processEntryDirectoryName(sDir, pFileName, sFileType)) == -1) {
         continue;
      }

      // Obtaining the short name of the book
      std::string sBook;
      getBookShortName(pFileName, sFileType.length(), sBook);
      std::cerr << "Book [" << sBook << "]" << std::endl;

      // Obtain the authors
      std::string sAuthors = "-";
      {
         const int N = strlen(pFileName);
         const int M = 1;
         char *token = "-";
         char *pszAuthors0= std::find_end(pFileName,
                                          pFileName + N,
                                          token, token + M);
         if (pszAuthors0 != (pFileName + N)) {
            while (*pszAuthors0== ' ' ||
                   *pszAuthors0== '-') {
               ++pszAuthors0;
            }
            const int L0 = strlen(pszAuthors0);
            const int L = L0 - sFileType.length() - 1;
            if (L > 3) {
               char *pszAuthors1 = new char[L0];
               memcpy(pszAuthors1, pszAuthors0, L);
               pszAuthors1[L] = 0;
               sAuthors = pszAuthors1;
            }
         }
      }
      std::cerr << "Authors [" << sAuthors << "]" << std::endl;

      // create an instance of the book structure, and save it in the vector
      {
      stBooks b;
      std::string sFile(pFileName);
      b.sFile = sFile;
      b.sFileType = sFileType;
      b.sBook = sBook;
      b.sAuthors = sAuthors;
      b.st_size = st_size;

      vBooks.push_back(b);
      }
   }
#ifdef _WIN32
   while (FindNextFile(hList, &FileData));
#elif  __linux__
   while ((pEntry = readdir(pDir)) != NULL);
#endif

   if (vBooks.size()) {
      // Sort the vector
      std::stable_sort(vBooks.begin(), vBooks.end(), std::ptr_fun(byBook));
      // Print all the books
      printhtml(sDir, iLanguage);
   }
   exit(0);
}
Example #15
0
void
#elif  __linux__
int 
#endif
main(int argc, char **argv)
{
   // Directory
   std::string sDir = argv[1];
#ifdef _WIN32
   HANDLE          hList;
   WIN32_FIND_DATA FileData;
   std::string sDirPattern;
#elif  __linux__
   // Directory pointer
   DIR *pDir;
   // pointer to the directory entry
   struct dirent *pEntry;
#endif

   // Language
   std::string sLanguage = argv[2];
   int iLanguage = initLanguage(sLanguage);

   // Verifying if the directory exist
   if (!isDir(sDir)) {
      exit(1);
   }

#ifdef __linux__
   // Open the directory
   if ((pDir = opendir(sDir.c_str())) == NULL) {
      std::cerr << __FILE__ << ":" << __LINE__ << " "
           << "Error in opendir() [" << sDir << "] " << std::endl
           << "errno (" << errno << ")" << std::endl;
      exit(1);
   }
#endif

#ifdef _WIN32
   sDirPattern = sDir;
   sDirPattern += "\\*";
   // Get the first file
   if ((hList = FindFirstFile(sDirPattern.c_str(), &FileData)) == INVALID_HANDLE_VALUE)
#elif  __linux__
   if ((pEntry = readdir(pDir)) == NULL)
#endif
   {
     std::cerr << __FILE__ << ":" << __LINE__ << " "
          << "No files found" << std::endl
          << "errno (" << errno << ")" << std::endl;
     exit(1);
   }
   // Directory: read entries
   do 
   {
#ifdef _WIN32
      char *pFileName = FileData.cFileName;
#elif  __linux__
      char *pFileName = pEntry->d_name;
#endif

      std::string sFileType;
      off_t st_size = 0;     // total size, in bytes
      // process the file entry
      if ((st_size = processEntryDirectoryName(sDir, pFileName, sFileType)) == -1) {
         continue;
      }

      // Obtaining the Long name of the book
      std::string sBook;
      getBookLongName(pFileName, sFileType.length(), sBook);
      std::cerr << "Book [" << sBook << "]" << std::endl;

      // create an instance of the book structure, and save it in the vector
      {
      stBooks b;
      std::string sFile(pFileName);
      b.sFile = sFile;
      b.sFileType = sFileType;
      b.sBook = sBook;
      b.st_size = st_size;

      vBooks.push_back(b);
      }
   }
#ifdef _WIN32
   while (FindNextFile(hList, &FileData));
#elif  __linux__
   while ((pEntry = readdir(pDir)) != NULL);
#endif

   if (vBooks.size()) {
      // Sort the vector
      std::stable_sort(vBooks.begin(), vBooks.end(), std::ptr_fun(byBook));
      // Print all the books
      printhtml(sDir, iLanguage);
   }
   exit(0);
}
Example #16
0
int main(int argc, char *argv[])
{
    if(argc > 2)
    {
        GlobalData::instance()->strComName = QString(argv[1]);
        GlobalData::instance()->strUdiskPath = QString(argv[2]);
    }
    QApplication a(argc, argv);

#if 0
    QTranslator tsor;           //创建翻译器
    tsor.load("/home/yange/en.qm");    //加载语言包
    QApplication::installTranslator(&tsor); //安装翻译器
#endif

#ifdef FRIENDLYARM_TINY210
    a.setStyleSheet(""
                    "QPushButton#stop{"
                    "background-color:(255, 0, 0); color: rgb(255, 255, 255); font-weight:bold;"
                    "}"
                    "QPushButton#start{background-color:rgb(0, 255, 0); color: rgb(255, 255, 255); font-weight:bold;}"  );

    //                          "min-width:80; font: 28px; min-height:60;"
    //                          "}"
    //                          "QPushButton#buttonTitle{"
    //                          "font: 48px;"
    //                          "min-height:50px;"
    //                          "}"

    //                          "QLabel{"
    //                          "font: 10px;"
    //                          "min-height:15px;"
    //                          "}"
    //                          "QLabel#countDown{"
    //                          "font: 15px;"
    //                          "min-height:20px;"
    //                          "}"
    //                          "QLabel#title{"
    //                          "font: 15px;"
    //                          "min-height:20px;"
    //                          "}"

    //                          "QComboBox {"
    //                          "min-height: 40px;"
    //                          "font: 30px;"
    //                          "}"

    //                          "QLineEdit{"
    //                          "font: 24px;"
    //                          "}"

    //                          "QTableView{"
    //                          "font:15px;"
    //                          "}"
    //                          "QTableView::item{"
    //                          "min-height: 16px;"
    //                          "}"
    //                          "QHeaderView{font:7px}"

    //                          "QScrollBar{width:10px;}"

    //                          "QMessageBox{min-height: 50px; min-width: 80px;}"

#endif

#ifdef FORLIN_OK335XS
    a.setStyleSheet(QString("QPushButton{"
                            "min-width:80; font: 28px; min-height:60;"
                            "}"
                            "QPushButton#stop{"
                            "background-color:rgb(0, 255, 0); color: rgb(255, 255, 255); font-weight:bold;"
                            "}"
                            "QPushButton#start{"
                            "background-color:rgb(0, 255, 0); color: rgb(255, 255, 255); font-weight:bold;"
                            "}"
                            "QPushButton#buttonTitle{"
                            "font: 48px;"
                            "min-height:50px;"
                            "}"

                            "QLabel{"
                            "font: 24px;"
                            "min-height:%1;"
                            "}"
                            "QLabel#countDown{"
                            "font: 48px;"
                            "min-height:50px;"
                            "}"
                            "QLabel#title{"
                            "font: 48px;"
                            "min-height:50px;"
                            "}"

                            "QComboBox {"
                            "min-height: 50px;"
                            "font: 25px;"
                            "}"

                            "QLineEdit{"
                            "font: 24px;"
                            "}"

                            "QTableView{"
                            "font:20px;"
                            "}"
                            "QTableView::item{"
                            "min-height: 18px;"
                            "}"
                            "QHeaderView{font:20px}"

                            "QScrollBar:vertical {"
                            "border: 0px solid grey;"
                            "width: 20px;"
                            " }"
                            ).arg(FONT_SIZE * 1.5));
#endif

    //initSettings();
    initLanguage(a);
    initDatabase();
    //QApplication::setOverrideCursor(Qt::BlankCursor);
#ifdef __arm__

#ifdef FORLIN_OK335XS
    QWSServer::setCursorVisible(false);//这句就能让我们实现触摸屏能用而光标又不显示的功能了。
    qDebug() << "set no cursor";
#endif
#endif
    //  buzzer buz;
    //  buz.stop_music();

    printer pri;

#if 0
    printer::transmit(0x0A,1);
    printer::transmit((void *)"shanghaikairen",14);
    printer::transmit(0x0A,1);
#endif

    //SendSampleDataToPC __init;

    Widget w;
    logo l;
    l.showFullScreen();
    QTimer::singleShot(5000,&l,SLOT(close()));
    //w.setFont(QFont("wenquanyi",FONT_SIZE,QFont::Normal));
    QTimer::singleShot(4500,&w,SLOT(showFullScreen()));
    //w.showFullScreen();

    qDebug() << printer::revertDataToOtherProtectet(printer::getSampleData());
    return a.exec();
}