MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //--------------------------------------------- setAcceptDrops(true); //--------------------------------------------- this->pTimer = new QTimer(this); this->statusBarTimer = new QTimer(this); this->shutdownTimer = new QTimer(this); this->settings = new AppSettings(this); //--------------------------------------------- connect(this->pTimer,SIGNAL(timeout()),this,SLOT(timer_toggle())); connect(this->shutdownTimer, SIGNAL(timeout()),this, SLOT(shutdown_timer_toggle())); connect(this->statusBarTimer, SIGNAL(timeout()),this, SLOT(statusBar_timer_toggle())); // init class variables this->shortCutsDialog = NULL; this->progress_value=0; this->timeoutForShowTrayMessage = 10; this->config_msg=false; this->check_access=false; //--------------------------------------------- ui->timeEdit->setFocusPolicy(Qt::WheelFocus); ui->spinBox->setFocusPolicy(Qt::WheelFocus); ui->spinBox_2->setFocusPolicy(Qt::WheelFocus); //--------------------------------------------- loadAndApplyAllSettings(); setWidgetFrom_CencelStop(true); int comboBoxCurrentIndex = ui->comboBox->currentIndex(); switch(comboBoxCurrentIndex) { case(0): { setWidgetFrom_AtTime(); } break; case(1): { setWidgetFrom_AfterADelay(); } break; case(2): { setWidgetFrom_Mplayer(); } break; default: { qDebug() << "on_comboBox_currentIndexChanged UNKNOWN index: " << comboBoxCurrentIndex; } break; } //-------------------------------------------- // set form geometry QRect geometry = this->geometry(); qDebug() << geometry; this->setFixedSize(geometry.width(),geometry.height()); //QRect(496,175 260x314) //-------------------------------------------- // start periodic timer pTimer->start(1000); checkSudoAccess(); pidofQzleepDublicateCheck(); //------------------------------------------------------------------ // tray icon init createTrayActions(); createTrayIcon(); trayIcon->show(); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); //------------------------------------------------------------------ // open with qzleep this->mplayerProcess = NULL; int argc_var = QCoreApplication::argc(); char ** argv_var = QCoreApplication::argv(); this->mplayerProcess = new MplayerProcess(this); connect(this->mplayerProcess,SIGNAL(signalMpleyerProgres(int)),this,SLOT(slotMplayerProgessUpdate(int))); connect(this->mplayerProcess,SIGNAL(finished(int)),this,SLOT(slotMplayerProcessFinished(int))); if(argc_var>1) { qDebug() << "1 [" << *(argv_var+1) << "]" << endl; optionMplayer(*(argv_var+1)); } //--------------------------------------------- }
int handle_input () { SDL_Event e; SDL_WaitEvent (&e); switch (e.type) { /* * thanks to Ted Mielczarek <*****@*****.**> for this, fixes the X * Async request errors */ case SDL_USEREVENT: if (e.user.code == SHOW_IMAGE) image_freshen (); break; case SDL_KEYDOWN: switch (tolower (e.key.keysym.sym)) { case 'x': case 'q': case SDLK_ESCAPE: return 0; break; case SDLK_SPACE: timer_toggle (); break; case SDLK_RETURN: image_freshen (); timer_stop (); break; case SDLK_RIGHT: timer_stop (); image_next (0); break; case SDLK_LEFT: timer_stop (); image_prev (0); break; case 'z': timer_stop (); toggle_state (ZOOM); image_freshen (); break; case 'f': timer_stop (); toggle_state (FULLSCREEN); if (get_state_int (FULLSCREEN)) screen = SDL_SetVideoMode (vid_width (), vid_height (), vid_depth (), SDL_FULLSCREEN | SDL_DOUBLEBUF); image_freshen (); break; #if 0 case '+': case '=': scale += .1; image_freshen (); break; case '-': scale -= .1; image_freshen (); break; #endif default: /* * do nothing */ break; } break; case SDL_QUIT: return 0; break; } return 1; }