int main(int argc, char** argv) { SDL_Surface *screen; screen = initSDLWindow(); editEvent(screen); SDL_Quit(); return (EXIT_SUCCESS); }
EventData Communicator::deleteEvent(int id) { return editEvent(id, "", "", Security(), QDateTime(), EventProperties(), ""); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), database(0), eventsFilterModel(new QSortFilterProxyModel(this)), conversationsTreeModel(new TableToTreeProxyModel(this)), hideEventsTableColumnsModel(new HideColumnsProxyModel(this)) { ui->setupUi(this); eventsFilterModel->setObjectName("eventsFilterModel"); hideEventsTableColumnsModel->setObjectName("hideEventsTableColumnsModel"); QList<int> hideColumns; hideColumns << 0 << 1 << 4 << 5; hideEventsTableColumnsModel->setHideColumns(hideColumns); conversationsTreeModel = new TableToTreeProxyModel(this); conversationsTreeModel->setObjectName("conversationsTreeModel"); QString fileName = settings.value("database").toString(); if (fileName.isEmpty() || !QFile(fileName).exists()) { newFile(); } else { openFile(fileName); } ui->statusBar->hide(); ui->splitter->setStretchFactor(1, 1); QVariant treeSize = settings.value("treeSize"); QVariant tableSize = settings.value("tableSize"); if (treeSize.isValid() && tableSize.isValid()) { QList<int> splitterSizes; splitterSizes << treeSize.toInt() << tableSize.toInt(); ui->splitter->setSizes(splitterSizes); } // TODO: Disable actions that need new e.g. characters until ready connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newFile())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openFile())); connect(ui->actionAdd_Event, SIGNAL(triggered()), this, SLOT(addEvent())); connect(ui->actionDelete_Event, SIGNAL(triggered()), this, SLOT(deleteEvent())); connect(ui->actionAdd_Conversation, SIGNAL(triggered()), this, SLOT(addConversation())); connect(ui->actionDelete_Conversation, SIGNAL(triggered()), this, SLOT(deleteConversation())); connect(ui->actionAdd_Character, SIGNAL(triggered()), this, SLOT(addCharacter())); connect(ui->actionDelete_Character, SIGNAL(triggered()), this, SLOT(deleteCharacter())); connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(openPreferences())); ui->conversationsView->installEventFilter(this); ui->eventsView->installEventFilter(this); connect(ui->conversationsView, SIGNAL(clicked(QModelIndex)), this, SLOT(filterOnConversation(QModelIndex))); ui->eventsView->setModel(eventsFilterModel); ui->eventsView->hideColumn(0); ui->eventsView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); ui->eventsView->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(ui->eventsView, SIGNAL(activated(QModelIndex)), this, SLOT(editEvent(QModelIndex))); conversationsTreeModel->index(0,0).parent().isValid(); ui->conversationsView->setModel(conversationsTreeModel); ui->conversationsView->sortByColumn(0, Qt::AscendingOrder); ui->conversationsView->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(ui->conversationsView, SIGNAL(activated(QModelIndex)), this, SLOT(editTreeItem(QModelIndex))); }
SpatialDomainWidget::SpatialDomainWidget(QWidget* Parent, openfluid::fluidx::AdvancedFluidXDescriptor& AFXDesc): WorkspaceWidget(Parent,AFXDesc), ui(new Ui::SpatialDomainWidget), m_Domain(AFXDesc.spatialDomain()), m_Datastore(AFXDesc.datastore()), m_ActiveClass("") { ui->setupUi(this); ui->StructureTabWidget->setCurrentIndex(0); ui->DataTabWidget->setCurrentIndex(0); mp_MapScene = new MapScene(m_Domain,this); ui->GlobalMapView->setScene(mp_MapScene); ui->AddUnitsClassButton->setIcon(QIcon(":/ui/common/icons/add.png")); ui->AddUnitsClassButton->setIconSize(QSize(20,20)); ui->AddUnitButton->setIcon(QIcon(":/ui/common/icons/add.png")); ui->AddUnitButton->setIconSize(QSize(20,20)); ui->RemoveUnitButton->setIcon(QIcon(":/ui/common/icons/remove.png")); ui->RemoveUnitButton->setIconSize(QSize(20,20)); ui->AddConnectionButton->setIcon(QIcon(":/ui/common/icons/add.png")); ui->AddConnectionButton->setIconSize(QSize(20,20)); ui->RemoveConnectionButton->setIcon(QIcon(":/ui/common/icons/remove.png")); ui->RemoveConnectionButton->setIconSize(QSize(20,20)); ui->AddAttributeButton->setIcon(QIcon(":/ui/common/icons/add.png")); ui->AddAttributeButton->setIconSize(QSize(20,20)); ui->EditAttributesButton->setIcon(QIcon(":/ui/common/icons/modify.png")); ui->EditAttributesButton->setIconSize(QSize(20,20)); ui->RenameAttributeButton->setIcon(QIcon(":/icons/rename-attribute.png")); ui->RenameAttributeButton->setIconSize(QSize(20,20)); ui->RemoveAttributeButton->setIcon(QIcon(":/ui/common/icons/remove.png")); ui->RemoveAttributeButton->setIconSize(QSize(20,20)); ui->AddEventButton->setIcon(QIcon(":/ui/common/icons/add.png")); ui->AddEventButton->setIconSize(QSize(20,20)); ui->EditEventButton->setIcon(QIcon(":/ui/common/icons/modify.png")); ui->EditEventButton->setIconSize(QSize(20,20)); ui->RemoveEventsButton->setIcon(QIcon(":/ui/common/icons/remove.png")); ui->RemoveEventsButton->setIconSize(QSize(20,20)); #if QT_VERSION < QT_VERSION_CHECK(5,0,0) ui->ConnectionsTableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); #else ui->ConnectionsTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); #endif connect(ui->AddUnitsClassButton,SIGNAL(clicked()),this,SLOT(addUnitsClass())); connect(ui->AddUnitButton,SIGNAL(clicked()),this,SLOT(addUnit())); connect(ui->RemoveUnitButton,SIGNAL(clicked()),this,SLOT(removeUnit())); connect(ui->AddConnectionButton,SIGNAL(clicked()),this,SLOT(addConnection())); connect(ui->RemoveConnectionButton,SIGNAL(clicked()),this,SLOT(removeConnection())); connect(ui->AddAttributeButton,SIGNAL(clicked()),this,SLOT(addAttribute())); connect(ui->EditAttributesButton,SIGNAL(clicked()),this,SLOT(editAttributesValues())); connect(ui->RenameAttributeButton,SIGNAL(clicked()),this,SLOT(renameAttribute())); connect(ui->RemoveAttributeButton,SIGNAL(clicked()),this,SLOT(removeAttribute())); connect(ui->AddEventButton,SIGNAL(clicked()),this,SLOT(addEvent())); connect(ui->EditEventButton,SIGNAL(clicked()),this,SLOT(editEvent())); connect(ui->EventsTableWidget,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(editEvent())); connect(ui->RemoveEventsButton,SIGNAL(clicked()),this,SLOT(removeEvents())); connect(ui->IDsListWidget,SIGNAL(currentRowChanged(int)),this,SLOT(updateUnitSelection(int))); // map view // TODO to reactivate when units IDs display on map will be fully functional ui->UnitsIDsCheckBox->setVisible(false); ui->GlobalMapView->enableAutomaticView(ui->AutomaticViewCheckBox->isChecked()); connect(ui->UnitsIDsCheckBox,SIGNAL(toggled(bool)),mp_MapScene,SLOT(enableUnitsIDs(bool))); connect(ui->FitViewButton,SIGNAL(clicked()),ui->GlobalMapView,SLOT(fitViewToItems())); connect(ui->AutomaticViewCheckBox,SIGNAL(toggled(bool)),this,SLOT(enableAutomaticView(bool))); connect(ui->GlobalMapView,SIGNAL(automaticViewEnabled(bool)), ui->AutomaticViewCheckBox,SLOT(setChecked(bool))); connect(mp_MapScene,SIGNAL(selectionChanged()),this,SLOT(updateSelectionFromMap())); connect(ui->AttributesTableWidget,SIGNAL(cellChanged(int,int)),this, SLOT(updateFluidXAttributeFromCellValue(int,int))); connect(ui->PcsOrderSpinBox,SIGNAL(valueChanged(int)),this, SLOT(updateFluidXProcessOrder(int))); refresh(); // all map layers are set visible at startup only setAllMapLayersVisible(); }
void EventPlugin::onInstalled() { qff::MainWindow *fwk = qff::MainWindow::frameWork(); m_actConnectDb = new qfw::Action(tr("&Connect to database")); //a->setShortcut("ctrl+L"); connect(m_actConnectDb, SIGNAL(triggered()), this, SLOT(connectToSqlServer())); m_actOpenEvent = new qfw::Action(tr("&Open event")); //m_actOpenEvent->setShortcut("Ctrl+O"); m_actOpenEvent->setEnabled(false); connect(m_actOpenEvent, SIGNAL(triggered()), this, SLOT(openEvent())); m_actCreateEvent = new qfw::Action(tr("Create eve&nt")); //m_actCreateEvent->setShortcut("Ctrl+N"); m_actCreateEvent->setEnabled(false); connect(m_actCreateEvent, SIGNAL(triggered()), this, SLOT(createEvent())); m_actEditEvent = new qfw::Action(tr("E&dit event")); m_actEditEvent->setEnabled(false); connect(m_actEditEvent, SIGNAL(triggered()), this, SLOT(editEvent())); connect(this, &EventPlugin::eventNameChanged, [this](const QString &event_name) { this->m_actEditEvent->setEnabled(!event_name.isEmpty()); }); m_actExportEvent = new qfw::Action(tr("E&xport event")); m_actExportEvent->setEnabled(false); connect(m_actExportEvent, &QAction::triggered, this, &EventPlugin::exportEvent); m_actImportEvent = new qfw::Action(tr("I&mport event")); m_actImportEvent->setEnabled(false); connect(m_actImportEvent, &QAction::triggered, this, &EventPlugin::importEvent_qbe); connect(this, SIGNAL(eventNameChanged(QString)), fwk->statusBar(), SLOT(setEventName(QString))); connect(this, SIGNAL(currentStageIdChanged(int)), fwk->statusBar(), SLOT(setStageNo(int))); connect(fwk, &qff::MainWindow::pluginsLoaded, this, &EventPlugin::connectToSqlServer); connect(this, &EventPlugin::eventOpened, this, &EventPlugin::onEventOpened); qfw::Action *a_quit = fwk->menuBar()->actionForPath("file/import", false); a_quit->addActionBefore(m_actConnectDb); a_quit->addSeparatorBefore(); m_actEvent = m_actConnectDb->addMenuAfter("file.event", tr("&Event")); m_actEvent->addActionInto(m_actCreateEvent); m_actEvent->addActionInto(m_actOpenEvent); m_actEvent->addActionInto(m_actEditEvent); m_actEvent->addActionInto(m_actExportEvent); m_actEvent->addActionInto(m_actImportEvent); qfw::ToolBar *tb = fwk->toolBar("Event", true); tb->setObjectName("EventToolbar"); { QToolButton *bt_stage = new QToolButton(); //bt_stage->setFlat(true); bt_stage->setAutoRaise(true); bt_stage->setCheckable(true); tb->addWidget(bt_stage); m_cbxStage = new QComboBox(); connect(m_cbxStage, SIGNAL(activated(int)), this, SLOT(onCbxStageActivated(int))); connect(this, &EventPlugin::currentStageIdChanged, [bt_stage](int stage_id) { bt_stage->setText(tr("Current stage E%1").arg(stage_id)); }); QAction *act_stage = tb->addWidget(m_cbxStage); act_stage->setVisible(false); auto *style = qf::qmlwidgets::Style::instance(); QIcon ico(style->icon("settings")); m_actEditStage = new qfw::Action(ico, "Stage settings"); m_actEditStage->setVisible(false); connect(m_actEditStage, SIGNAL(triggered()), this, SLOT(editStage())); tb->addAction(m_actEditStage); connect(bt_stage, &QPushButton::clicked, [this, act_stage](bool checked) { act_stage->setVisible(checked); m_actEditStage->setVisible(checked); }); } }
void Calendar::editEventIndex(QModelIndex) { editEvent(); }