TimeTaggerDialog::TimeTaggerDialog(QString filename, QString ext):QMainWindow() { this->filename=filename; this->ext=ext; text=new QTextBrowser(this); tag=new QPushButton("&Tag",this); unTag=new QPushButton("&Un-Tag",this); save=new QPushButton("&Save",this); scrollArea=new QScrollArea(this); grid=new QGridLayout(scrollArea); grid->addWidget(tag,0,0); grid->addWidget(unTag,0,1); grid->addWidget(save,0,2); grid->addWidget(text,1,0,1,3); setCentralWidget(scrollArea); #ifdef ERRORS_TIME errors=new QTextBrowser(this); errors->resize(errors->width(),50); errors_text=new QString(); grid->addWidget(errors,2,0,1,3); displayed_error.setString(errors_text); errors->setText(*errors_text); #endif connect(tag,SIGNAL(clicked()),this,SLOT(tag_clicked())); connect(unTag,SIGNAL(clicked()),this,SLOT(unTag_clicked())); connect(save,SIGNAL(clicked()),this,SLOT(save_clicked())); open_action(); setWindowTitle(filename); this->resize(700,700); }
/******************************************************************************* initScene *******************************************************************************/ void SettingsScene::initScene() { // create pages m_pages[SETTINGS::GENERAL] = new PageGeneral(parentView()); m_pages[SETTINGS::PLAYER] = new PagePlayer(parentView()); m_pages[SETTINGS::LIBRARY] = new PageLibrary(parentView()); m_pages[SETTINGS::SHORTCUT] = new PageShortcut(parentView()); m_pages[SETTINGS::SCROBBLER] = new PageScrobbler(parentView()); m_pages[SETTINGS::SONGINFO] = new PageSongInfo(parentView()); connect(m_pages[SETTINGS::GENERAL], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::PLAYER], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::LIBRARY], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SHORTCUT], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SCROBBLER], SIGNAL(layout_changed()), this, SLOT(populateScene())); connect(m_pages[SETTINGS::SONGINFO], SIGNAL(layout_changed()), this, SLOT(populateScene())); m_header = new HeaderItem(qobject_cast<QGraphicsView*> (parentView())->viewport()); m_header->setText( tr("Settings") ); /* bottom widget */ m_bottomWidget = new BottomWidget(); connect(m_bottomWidget, SIGNAL(save_clicked()), this, SLOT(slot_apply_settings())); connect(m_bottomWidget, SIGNAL(cancel_clicked()), this, SLOT(slot_cancel_settings())); this->addItem(m_header); this->addItem(m_pages.value(SETTINGS::GENERAL)); this->addItem(m_pages.value(SETTINGS::PLAYER)); this->addItem(m_pages.value(SETTINGS::LIBRARY)); this->addItem(m_pages.value(SETTINGS::SHORTCUT)); this->addItem(m_pages.value(SETTINGS::SCROBBLER)); this->addItem(m_pages.value(SETTINGS::SONGINFO)); /* first init => always restore settings */ restore_settings(); /* il faut interdire la modification des parametres de collection si un database builder est en cours */ connect(ThreadManager::instance(), SIGNAL(dbBuildStart()), this, SLOT(slot_dbBuilder_stateChange())); connect(ThreadManager::instance(), SIGNAL(dbBuildFinished()), this, SLOT(slot_dbBuilder_stateChange())); setInit(true); }
static void level_changed(GtkComboBox *combo, gpointer data) { _config_missing *u = (_config_missing*)data; GtkListStore *ls; GtkTreeIter iter; gchar *filename; GList *list=NULL, *l; int level, result; level = gtk_combo_box_get_active(u->combo_level)+1; if(level==0) return; if(u->changed) { GtkWidget *dialog; dialog = gtk_dialog_new_with_buttons("Save changes ?", NULL, GTK_DIALOG_MODAL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); result = gtk_dialog_run(GTK_DIALOG(dialog)); switch(result) { case GTK_RESPONSE_ACCEPT: save_clicked(NULL, data); break; default: u->changed=FALSE; break; } gtk_widget_destroy (dialog); } ls = GTK_LIST_STORE(gtk_tree_view_get_model(u->view)); filename = gc_file_find_absolute("%s/board%d.xml", gcomprisBoard_missing->boarddir, level); missing_read_xml_file(filename,&list); g_free(filename); gtk_list_store_clear(ls); for(l=list; l; l=l->next) { Board *b = l->data; gchar *pixfile = gc_file_find_absolute(b->pixmapfile); GdkPixbuf *pixbuf; gchar tmp[MAX_PROPOSAL+1]; int i = 0; pixbuf = gdk_pixbuf_new_from_file_at_size(pixfile, ICON_SIZE, ICON_SIZE, NULL); tmp[0] = '\0'; while(b->choices[i]) { g_strlcat(tmp, b->choices[i], MAX_PROPOSAL); i++; } gtk_list_store_append(ls, &iter); gtk_list_store_set(ls, &iter, QUESTION_COLUMN, b->question, ANSWER_COLUMN, b->answer, CHOICE_COLUMN, tmp, PIXMAP_COLUMN, b->pixmapfile, PIXBUF_COLUMN, pixbuf, -1); g_free(pixfile); g_object_unref(pixbuf); } missing_destroy_board_list(list); }
RecWindow::RecWindow(QWidget *parent) : QDialog(parent) { CreateLayout(parent); CreateMenu(); connect(slider1,SIGNAL(valueChanged(int)), this, SLOT(slider1_change(int))); connect(slider2,SIGNAL(valueChanged(int)), this, SLOT(slider2_change(int))); connect(rec_btn, SIGNAL(released()), this, SLOT(rec_clicked())); connect(save_btn, SIGNAL(released()), this, SLOT(save_clicked())); connect(analysis_btn, SIGNAL(released()), this, SLOT(analysis_clicked())); connect(a_open, SIGNAL(triggered(bool)),this,SLOT(open_clicked())); connect(a_focus, SIGNAL(triggered(bool)),this,SLOT(afocus_changed(bool))); connect(a_preview, SIGNAL(triggered(bool)),this,SLOT(preview_changed(bool))); filename = filter_param.filename; setGeometry((qApp->desktop()->geometry().center() - rect().center()).x(),(qApp->desktop()->geometry().center() - rect().center()).y(),rect().width(),rect().height()); //load camera QString DeviceName; if (filter_param.deviceID == -1) { QStringList cam_list = getDeviceName(); if (cam_list.size() > 1) { DeviceName = QInputDialog::getItem(this,"Select Camera","Camera",cam_list); DeviceName = DeviceName[DeviceName.size()-1]; filter_param.deviceID = DeviceName.toInt(); } else if (cam_list.size() == 1) { DeviceName = cam_list[0]; DeviceName = DeviceName[DeviceName.size()-1]; filter_param.deviceID = DeviceName.toInt(); } //else device id is unchanged } capture = cvCreateCameraCapture(filter_param.deviceID); if (!capture) { if (filter_param.deviceID != -1) { QStringList cam_list = getDeviceName(); if (cam_list.size() > 1) { DeviceName = QInputDialog::getItem(this,"Select Camera","Camera",cam_list); DeviceName = DeviceName[DeviceName.size()-1]; filter_param.deviceID = DeviceName.toInt(); } else if (cam_list.size() == 1) { DeviceName = cam_list[0]; DeviceName = DeviceName[DeviceName.size()-1]; filter_param.deviceID = DeviceName.toInt(); } else { imageView = QImage((const unsigned char*)(NA_image->imageData), NA_image->width,NA_image->height,QImage::Format_RGB888).rgbSwapped(); surface->setPixmap(QPixmap::fromImage(imageView.scaled(surface_width, floor((surface_width/NA_image->width)*NA_image->height),Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); printf("no camera detected\n"); return; } capture = cvCreateCameraCapture(filter_param.deviceID); } else { imageView = QImage((const unsigned char*)(NA_image->imageData), NA_image->width,NA_image->height,QImage::Format_RGB888).rgbSwapped(); surface->setPixmap(QPixmap::fromImage(imageView.scaled(surface_width, floor((surface_width/NA_image->width)*NA_image->height),Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); printf("no camera detected\n"); return; } } camID = filter_param.deviceID; cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH,1280); cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT,720); char command[50]; sprintf(command,"v4l2-ctl -d %d -c exposure_auto=1",camID); system(command); sprintf(command,"v4l2-ctl -d %d -c exposure_absolute=1",camID); system(command); sprintf(command,"v4l2-ctl -d %d -c focus_auto=0",camID); system(command); if (thread_cam_active) pthread_cancel(thread_cam); printf("tread started\n"); pthread_create( &thread_cam, NULL, capture_main, (void*) this); }