FoldersWindow::FoldersWindow(QWidget *parent) { //Initialize objects layout = new QGridLayout(); profilesCombo = new NoSearchComboBox(this); editProfileBtn = new QPushButton(QObject::trUtf8("Edit Profiles")); for(int i=0;i<9;i++) folderBtns.push_back(new FolderButton(i)); xmlManager = new XMLSettingsManager(); settingDlg = new FolderSettingDialog(this,xmlManager); profileDlg = new ProfileListDialog(this,xmlManager); fileManager = new FileManager(); btnLayoutLabel = new QLabel(); //Set objects up profilesCombo->setEditable(false); this->refreshProfiles(); for(int i=0;i<9;i++) { folderBtns[i]->setText(QString::number(i+1)); folderBtns[i]->setIconSize(QSize(80,80)); folderBtns[i]->setFixedSize(100,100); folderBtns[i]->setStyleSheet(folderBtnDefault); } getProfileDataByIndex(0); btnLayoutLabel->setAlignment(Qt::AlignRight); isNumpad = false; //Arrange layout layout->setAlignment(Qt::AlignCenter); layout->addWidget(profilesCombo,0,0,1,2); changeLayout(); layout->addWidget(editProfileBtn,0,2,1,1); layout->setRowStretch(0,1); layout->setSpacing(1); //Connect slots and signals QObject::connect(profilesCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(getProfileDataByIndex(int))); QObject::connect(editProfileBtn,SIGNAL(clicked()),profileDlg,SLOT(show())); QObject::connect(profileDlg,SIGNAL(accepted()),this,SLOT(refreshProfiles())); for(int i=0;i<9;i++) { QObject::connect(folderBtns[i],SIGNAL(clicked()),folderBtns[i],SLOT(btnClick())); QObject::connect(folderBtns[i],SIGNAL(clicked(int)),settingDlg,SLOT(show(int))); } this->parent = parent; this->setLayout(layout); this->setWindowFlags(Qt::X11BypassWindowManagerHint); this->setWindowFlags(Qt::WindowStaysOnTopHint); this->setFixedSize(315,370); this->setWindowTitle(QObject::trUtf8("Folders Window")); }
/**************************************************************************** * ManageAllProgress * * Opens a window, which displays progress to the user. ***************************************************************************/ void ManageAllProgress() { if(!showManageAllProgress) return; GuiSound btnSoundOver(button_over_wav, button_over_wav_size, cfg.SFXVolume); GuiSound btnClick(button_click_wav, button_click_wav_size, cfg.SFXVolume); GuiWindow promptWindow(400,230); promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); promptWindow.SetPosition(0, -10); SimpleGuiTrigger trigA(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); ManageThrobber Throbber(0); Throbber.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); Throbber.SetPosition(45, 0); GuiText nameTxt(NULL, 30, (GXColor){255, 255, 255, 255}); nameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); nameTxt.SetMaxWidth(430, 1); GuiText subnameTxt(NULL, 24, (GXColor){255, 255, 255, 255}); subnameTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); subnameTxt.SetPosition(0, 35); subnameTxt.SetMaxWidth(430, 1); GuiText errorTxt(NULL, 24, (GXColor){255, 255, 255, 255}); errorTxt.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); errorTxt.SetPosition(0, -50); errorTxt.SetMaxWidth(430); snprintf(progressTxt, sizeof(progressTxt), "%i/%i", progressDone, progressTotal); GuiText stateTxt(progressTxt, 22, (GXColor){255, 255, 255, 255}); stateTxt.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); stateTxt.SetPosition(-10, -8); // Get The banner // ManageAllProgressBanner bannerList(bannerToDisplay); bannerList.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); bannerList.SetPosition(-80, -40); GuiImageData btnOutline(save_manage_button_png, save_manage_button_png_size); GuiImageData btnOutlineOver(save_manage_button_over_png, save_manage_button_over_png_size); GuiImage buttonImg(&btnOutline); GuiImage buttonOverImg(&btnOutlineOver); GuiText AbortTxt(tr("Cancel"), 22, (GXColor){0, 0, 0, 255}); GuiButton AbortBtn(buttonImg.GetWidth(), buttonImg.GetHeight()); AbortBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); AbortBtn.SetLabel(&AbortTxt); AbortBtn.SetImage(&buttonImg); AbortBtn.SetImageOver(&buttonOverImg); AbortBtn.SetSoundOver(&btnSoundOver); AbortBtn.SetSoundClick(&btnClick); AbortBtn.SetTrigger(&trigA); AbortBtn.SetEffectGrow(); promptWindow.Append(&stateTxt); promptWindow.Append(&nameTxt); promptWindow.Append(&subnameTxt); promptWindow.Append(&errorTxt); promptWindow.Append(&bannerList); promptWindow.Append(&AbortBtn); promptWindow.Append(&Throbber); MainWindow::Instance()->HaltGui(); promptWindow.SetEffect(EFFECT_FADE, 20); MainWindow::Instance()->Append(&promptWindow); MainWindow::Instance()->ChangeFocus(&promptWindow); MainWindow::Instance()->ResumeGui(); while(promptWindow.GetEffect() > 0) usleep(100); while(showManageAllProgress != 0) { usleep(80000); throbberCount++; if(throbberCount > 8) throbberCount = 1; Throbber.SetThrobberCount(throbberCount); if(changed) { nameTxt.SetText(progressName); subnameTxt.SetText(progressSubname); snprintf(progressTxt, sizeof(progressTxt), "%i/%i", progressDone, progressTotal); stateTxt.SetText(progressTxt); bannerList.SetBannerToDisplay(bannerToDisplay); changed = false; } else if(AbortBtn.GetState() == STATE_CLICKED) { progresscanceled = true; AbortBtn.ResetState(); } if(showError == true) { AbortBtn.SetVisible(false); AbortBtn.SetState(STATE_DISABLED); errorTxt.SetText(progressError); errorTxt.SetVisible(true); usleep(5000000); errorTxt.SetVisible(false); AbortBtn.SetVisible(true); AbortBtn.SetState(STATE_DEFAULT); showError = false; } } promptWindow.SetEffect(EFFECT_FADE, -20); while(promptWindow.GetEffect() > 0) usleep(100); MainWindow::Instance()->HaltGui(); MainWindow::Instance()->Remove(&promptWindow); MainWindow::Instance()->ResumeGui(); progresscanceled = false; }
void* touchPad(void* fd) { char eventFullPathName[100]; int eventnum = 2; int x,y,prex = 0,prey = 0; int fb_fd,fp; struct fb_var_screeninfo fbvar; struct fb_fix_screeninfo fbfix; unsigned char *fb_mapped; int mem_size; /* if (argc != 2) { printf("Usage : touchapp <event Number>\n"); printf("To see the event number, do \"cat /proc/bus/input/devices\" \n"); return 1; } */ sprintf(eventFullPathName,"%s%d",EVENT_STR,eventnum); printf("touch input event name:%s\n", eventFullPathName); fp = open( eventFullPathName, O_RDONLY); if (-1 == fp) { printf("%s open fail\n",eventFullPathName); return; } if( access(FBDEV_FILE, F_OK) ) { printf("%s: access error\n", FBDEV_FILE); close(fp); return; } if( (fb_fd = open(FBDEV_FILE, O_RDWR)) < 0) { printf("%s: open error\n", FBDEV_FILE); close(fp); return; } if( ioctl(fb_fd, FBIOGET_VSCREENINFO, &fbvar) ) { printf("%s: ioctl error - FBIOGET_VSCREENINFO \n", FBDEV_FILE); goto fb_err; } if( ioctl(fb_fd, FBIOGET_FSCREENINFO, &fbfix) ) { printf("%s: ioctl error - FBIOGET_FSCREENINFO \n", FBDEV_FILE); goto fb_err; } screen_width = fbvar.xres; screen_height = fbvar.yres; bits_per_pixel = fbvar.bits_per_pixel; line_length = fbfix.line_length; printf("screen_width : %d\n", screen_width); printf("screen_height : %d\n", screen_height); printf("bits_per_pixel : %d\n", bits_per_pixel); printf("line_length : %d\n", line_length); mem_size = screen_width * screen_height * 4; fb_mapped = (unsigned char *)mmap(0, mem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fb_fd, 0); if (fb_mapped < 0) { printf("mmap error!\n"); goto fb_err; } //initScreen(fb_mapped); bitmap("main.bmp"); pthread_t thread_cam; char cmd; char sFlag; while(1) { pthread_t thread_key; if(pFlag == MAIN){ do{ readFirstCoordinate(fp,&x, &y); //printf("entering!!!!!\n"); }while(!btnClick(sen1Btn, x, y) && !btnClick(sen2Btn, x, y)); pFlag = SET; //x=0; y=0; bitmap("setting.bmp"); pthread_create(&thread_cam, NULL, &cameraview, (void*)&pFlag); pthread_create(&thread_key, NULL, &keymatrix, fd); if(btnClick(sen1Btn, x, y)){ sFlag = '1'; } else if(btnClick(sen2Btn, x, y)) { sFlag ='2'; } /* cmd = 's'; write((*(int*)fd), &cmd, 1); usleep(100); write((*(int*)fd), &sFlag, 1); */ char sendCmd[] = {'s', ' ', '\n', '\0'}; sendCmd[1] = sFlag; //printf("!!!!!!!!!!!!!!!!!!@@@@@@@@@@@@@2*************** %c^^^^ %c^^^^", sendCmd[0], sendCmd[1]); write((*(int*)fd), sendCmd, sizeof(sendCmd)-1); } else if(pFlag == SET){ int btn1, btn2; do{ readFirstCoordinate(fp,&x, &y); }while(!(btn1 = btnClick(backBtn, x, y)) && !(btn2 = btnClick(applyBtn, x, y))); x=0; y=0; if(btn1 > 0){ // 돌아가기 버튼 눌렀을 시 pFlag = MAIN; char sendCmd[2] = {' ', '\n'}; sendCmd[0] = 'b'; write((*(int*)fd), sendCmd, sizeof(sendCmd)); bitmap("main.bmp"); } else if(btn2 > 0){ // 적용 버튼 눌렀을 시 pFlag = MAIN; char sendCmd[2] = {' ', '\n'}; sendCmd[0] = 'e'; write((*(int*)fd), sendCmd, sizeof(sendCmd)); bitmap("main.bmp"); } pthread_cancel(&thread_key); } } fb_err: close(fb_fd); close(fp); return; }