void getTemplates()//需要进一步丰富操作 { Target target1; vector<vector<Point> >T; VideoCapture templa; Mat frame; templa>>frame; for(;;) { target1.setRawFame(frame); target1.showRawFrame(); target1.getHSVmask(); target1.getContours(); target1.showContours(); int c = waitKey(0); if(c =='y') { T.push_back(target1.contours[0]); cout<<"get template "<<T.size()<<endl; } if(c =='q') break; target1.contours.clear(); } saveTemplate(T); cout<<"templates have been saved"<<T[0]<<endl<<T[1]<<endl; target1.contours.clear(); }
void VehicleTemplateExportDialog::exportTemplate() { QString path = QString("%1%2%3%4").arg(Utils::PathUtils().InsertStoragePath("%%STOREPATH%%cloudconfig")) .arg(QDir::separator()).arg(getTypeDirectory()).arg(QDir::separator()); QDir dir; dir.mkpath(path); saveTemplate(path); }
void TemplateManagementDialog::slotOk() { // failure is not an option *cough* if ( !m_newTemplate.isEmpty() ) { emit saveTemplate( m_newTemplate ); } if ( m_changed ) { emit templatesChanged( m_templates ); } }
int checkForCycles(struct Node* _t) { reset(_t); if (hasCycles(_t)) { LOGD("deadlock found !"); struct Template tmpl; init_Template(&tmpl); getTemplate(&tmpl); saveTemplate(&tmpl); return true; } return false; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { //TODELETE ui->setupUi(this); this->setMinimumSize(800,650); /******************************************************************************************************/ // Instanciation of differents windows /******************************************************************************************************/ createListWindow_ = new CreateListWindow(); createProjectWindow_ = new CreateProjectWindow(); modifyListWindow_ = new ModifyListWindow(); modifyTaskWindow_ = new ModifyTaskWindow(); aboutWindow_ = new AboutWindow(); createTaskWindow_ = new CreateTaskWindow(); /* QListView definition for the history */ myListView = new QListView(); historyModel = new QStandardItemModel; myListView->setModel(historyModel); myListView->setAlternatingRowColors(true); /******************************************************************************************************/ /* Creats layouts */ /******************************************************************************************************/ QLayout * projectLayout = new QVBoxLayout(); QLayout * taskLayout = new QVBoxLayout(); QLayout * listLayout = new QVBoxLayout(); QLayout * actionsLayout = new QVBoxLayout(); QLayout * historyLayout = new QVBoxLayout(); /******************************************************************************************************/ /* Creats groupBox */ /******************************************************************************************************/ QGroupBox * projectGroup = new QGroupBox("Projet"); QGroupBox * taskGroup = new QGroupBox("Tâches"); QGroupBox * listGroup = new QGroupBox("Listes"); QGroupBox * actionsGroup = new QGroupBox("Actions"); QGroupBox * historyGroup = new QGroupBox("Historique"); /******************************************************************************************************/ /* Creats buttons */ /******************************************************************************************************/ createProject = new QPushButton("Créer un nouveau projet"); this->setButtonIcon(createProject,(std::string)":Images/project_icon"); createTask = new QPushButton("Créer une tâche"); this->setButtonIcon(createTask,(std::string)":Images/tache_icon"); modifyTask = new QPushButton("Modifier une tâche"); this->setButtonIcon(modifyTask,(std::string)":Images/engrenage_icon"); createList = new QPushButton("Créer une liste"); this->setButtonIcon(createList,(std::string)":Images/liste_icon"); modifyList = new QPushButton("Modifier une liste"); this->setButtonIcon(modifyList,(std::string)":Images/engrenage_icon"); deleteItem = new QPushButton("Supprimer un élément"); this->setButtonIcon(deleteItem,(std::string)":Images/minus_icon"); up = new QPushButton("Monter"); this->setButtonIcon(up,(std::string)":Images/up_icon"); down = new QPushButton("Descendre"); this->setButtonIcon(down,(std::string)":Images/down_icon"); history = new QPushButton("Historique"); this->setButtonIcon(history,(std::string)":Images/history_icon"); /******************************************************************************************************/ /* Adding buttons to layouts */ /******************************************************************************************************/ projectLayout->addWidget(createProject); listLayout->addWidget(createList); listLayout->addWidget(modifyList); taskLayout->addWidget(createTask); taskLayout->addWidget(modifyTask); actionsLayout->addWidget(deleteItem); actionsLayout->addWidget(up); actionsLayout->addWidget(down); historyLayout->addWidget(history); historyLayout->addWidget(myListView); /******************************************************************************************************/ /* Adding layouts to GroupBox */ /******************************************************************************************************/ projectGroup->setLayout(projectLayout); taskGroup->setLayout(taskLayout); listGroup->setLayout(listLayout); actionsGroup->setLayout(actionsLayout); historyGroup->setLayout(historyLayout); /******************************************************************************************************/ /* Adding QGroupBox to QToolBar */ /******************************************************************************************************/ ui->mainToolBar->addWidget(projectGroup); ui->mainToolBar->addWidget(taskGroup); ui->mainToolBar->addWidget(listGroup); ui->mainToolBar->addWidget(actionsGroup); /* Adding buttons to ToolBar */ ui->toolBar->addWidget(historyGroup); /******************************************************************************************************/ // Slots and signals definition /******************************************************************************************************/ //Create a project QObject::connect(ui->actionNewProject, SIGNAL(triggered()), this, SLOT(slotCreateProjectWindow())); QObject::connect(createProject, SIGNAL(clicked()), this, SLOT(slotCreateProjectWindow())); QObject::connect(createProjectWindow_, SIGNAL(createProject(Liste *)), this, SLOT(addProject(Liste *))); //Loading Project QObject::connect(ui->actionOpenProject, SIGNAL(triggered()), this, SLOT(slotOpenProjectWindow())); //Loading Template QObject::connect(ui->actionOpenTemplate, SIGNAL(triggered()), this, SLOT(slotOpenTemplateWindow())); //Create a task QObject::connect(ui->actionCreateTask, SIGNAL(triggered()), this, SLOT(slotCreateTaskWindow())); QObject::connect(createTask, SIGNAL(clicked()), this, SLOT(slotCreateTaskWindow())); QObject::connect(createTaskWindow_, SIGNAL(transferTask(Tache *)), this, SLOT(addTask(Tache *))); //Delete an element QObject::connect(deleteItem, SIGNAL(clicked()), this, SLOT(deleteElement())); //Modify a task QObject::connect(ui->actionModifyTask, SIGNAL(triggered()), this, SLOT(slotModifyTaskWindow())); QObject::connect(modifyTask, SIGNAL(clicked()), this, SLOT(slotModifyTaskWindow())); QObject::connect(modifyTaskWindow_, SIGNAL(modifyTask(Tache*,Tache*)), this, SLOT(modifyTaskAt(Tache*,Tache*))); //Create a list of tasks QObject::connect(ui->actionCreateList, SIGNAL(triggered()), this, SLOT(slotCreateListWindow())); QObject::connect(createList, SIGNAL(clicked()), this, SLOT(slotCreateListWindow())); QObject::connect(createListWindow_, SIGNAL(createList(Liste *)), this, SLOT(addList(Liste *))); //Modify a list of tasks QObject::connect(ui->actionModifyList, SIGNAL(triggered()), this, SLOT(slotModifyListWindow())); QObject::connect(modifyList, SIGNAL(clicked()), this, SLOT(slotModifyListWindow())); QObject::connect(modifyListWindow_, SIGNAL(modifyList(Liste*,Liste*)), this, SLOT(modifyListAt(Liste*,Liste*))); //Save project QObject::connect(ui->actionSaveUnList, SIGNAL(triggered()), this, SLOT(saveProject())); //Save template QObject::connect(ui->actionSaveTemplate, SIGNAL(triggered()), this, SLOT(saveTemplate())); //About Window QObject::connect(ui->actionAboutPeaceTache, SIGNAL(triggered()), this, SLOT(slotAboutWindow())); //UP element QObject::connect(ui->actionUp, SIGNAL(triggered()), this, SLOT(upElement())); QObject::connect(up, SIGNAL(clicked()), this, SLOT(upElement())); //DOWN element QObject::connect(ui->actionDown, SIGNAL(triggered()), this, SLOT(downElement())); QObject::connect(down, SIGNAL(clicked()), this, SLOT(downElement())); //history button QObject::connect(history, SIGNAL(clicked()), this, SLOT(showOrHideHistory())); //close window QObject::connect((ui->actionQuit), SIGNAL(triggered()), this, SLOT(closeApp())); QObject::connect((ui->treeView), SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); ui->treeView->setAnimated(true); ui->treeView->setHeaderHidden(true); /******************************************************************************************************/ //Disable buttons and menus /******************************************************************************************************/ createList->setEnabled(false); createTask->setEnabled(false); modifyTask->setEnabled(false); modifyList->setEnabled(false); deleteItem->setEnabled(false); up->setEnabled(false); down->setEnabled(false); this->loadCache(); }
/** This is a generic class for importing line-oriented data from text files. It provides a dialog for file selection, preview, separator selection and column assignment as well as generic conversion routines. For conversion to special data objects, this class has to be inherited by a special class, which reimplements the convertRow() function. */ KImportDialog::KImportDialog(QWidget *parent) : KDialogBase(parent, "importdialog", true, i18n("Import Text File"), Ok | Cancel), mSeparator(","), mCurrentRow(0) { mData.setAutoDelete(true); QVBox *topBox = new QVBox(this); setMainWidget(topBox); topBox->setSpacing(spacingHint()); QHBox *fileBox = new QHBox(topBox); fileBox->setSpacing(spacingHint()); new QLabel(i18n("File to import:"), fileBox); KURLRequester *urlRequester = new KURLRequester(fileBox); urlRequester->setFilter("*.csv"); connect(urlRequester, SIGNAL(returnPressed(const QString &)), SLOT(setFile(const QString &))); connect(urlRequester, SIGNAL(urlSelected(const QString &)), SLOT(setFile(const QString &))); connect(urlRequester->lineEdit(), SIGNAL(textChanged(const QString &)), SLOT(slotUrlChanged(const QString &))); mTable = new QTable(5, 5, topBox); mTable->setMinimumHeight(150); connect(mTable, SIGNAL(selectionChanged()), SLOT(tableSelected())); QHBox *separatorBox = new QHBox(topBox); separatorBox->setSpacing(spacingHint()); new QLabel(i18n("Separator:"), separatorBox); mSeparatorCombo = new KComboBox(separatorBox); mSeparatorCombo->insertItem(","); mSeparatorCombo->insertItem(i18n("Tab")); mSeparatorCombo->insertItem(i18n("Space")); mSeparatorCombo->insertItem("="); mSeparatorCombo->insertItem(";"); connect(mSeparatorCombo, SIGNAL(activated(int)), this, SLOT(separatorClicked(int))); mSeparatorCombo->setCurrentItem(0); QHBox *rowsBox = new QHBox(topBox); rowsBox->setSpacing(spacingHint()); new QLabel(i18n("Import starts at row:"), rowsBox); mStartRow = new QSpinBox(rowsBox); mStartRow->setMinValue(1); /* new QLabel( i18n( "And ends at row:" ), rowsBox ); mEndRow = new QSpinBox( rowsBox ); mEndRow->setMinValue( 1 ); */ QVBox *assignBox = new QVBox(topBox); assignBox->setSpacing(spacingHint()); QHBox *listsBox = new QHBox(assignBox); listsBox->setSpacing(spacingHint()); mHeaderList = new QListView(listsBox); mHeaderList->addColumn(i18n("Header")); connect(mHeaderList, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(headerSelected(QListViewItem *))); connect(mHeaderList, SIGNAL(doubleClicked(QListViewItem *)), SLOT(assignColumn(QListViewItem *))); mFormatCombo = new KComboBox(listsBox); mFormatCombo->setDuplicatesEnabled(false); QPushButton *assignButton = new QPushButton(i18n("Assign to Selected Column"), assignBox); connect(assignButton, SIGNAL(clicked()), SLOT(assignColumn())); QPushButton *removeButton = new QPushButton(i18n("Remove Assignment From Selected Column"), assignBox); connect(removeButton, SIGNAL(clicked()), SLOT(removeColumn())); QPushButton *assignTemplateButton = new QPushButton(i18n("Assign with Template..."), assignBox); connect(assignTemplateButton, SIGNAL(clicked()), SLOT(assignTemplate())); QPushButton *saveTemplateButton = new QPushButton(i18n("Save Current Template"), assignBox); connect(saveTemplateButton, SIGNAL(clicked()), SLOT(saveTemplate())); resize(500, 300); connect(this, SIGNAL(okClicked()), SLOT(applyConverter())); connect(this, SIGNAL(applyClicked()), SLOT(applyConverter())); enableButtonOK(!urlRequester->lineEdit()->text().isEmpty()); }
void VehicleTemplateExportDialog::saveAsTemplate() { saveTemplate(QString("")); }