ReportView::ReportView(QWidget *parent) : QWidget(parent), model(0), transactionProxyModel(0), reportView(0) { // Build filter row setContentsMargins(0,0,0,0); QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->setContentsMargins(0,0,0,0); #ifdef MAC_OSX hlayout->setSpacing(5); hlayout->addSpacing(26); #else hlayout->setSpacing(0); hlayout->addSpacing(23); #endif dateWidget = new QComboBox(this); #ifdef MAC_OSX dateWidget->setFixedWidth(121); #else dateWidget->setFixedWidth(120); #endif dateWidget->addItem(tr("All"), All); dateWidget->addItem(tr("Today"), Today); dateWidget->addItem(tr("Yesterday"), Yesterday); dateWidget->addItem(tr("This week"), ThisWeek); dateWidget->addItem(tr("Last week"), LastWeek); dateWidget->addItem(tr("This month"), ThisMonth); dateWidget->addItem(tr("Last month"), LastMonth); dateWidget->addItem(tr("This year"), ThisYear); dateWidget->addItem(tr("Range..."), Range); hlayout->addWidget(dateWidget); typeWidget = new QComboBox(this); #ifdef MAC_OSX typeWidget->setFixedWidth(121); #else typeWidget->setFixedWidth(120); #endif typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES); typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) | TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther)); typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) | TransactionFilterProxy::TYPE(TransactionRecord::SendToOther)); typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf)); typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated)); typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other)); hlayout->addWidget(typeWidget); addressWidget = new QLineEdit(this); #if QT_VERSION >= 0x040700 /* Do not move this to the XML file, Qt before 4.7 will choke on it */ addressWidget->setPlaceholderText(tr("Enter address or label to search")); #endif hlayout->addWidget(addressWidget); amountWidget = new QLineEdit(this); #if QT_VERSION >= 0x040700 /* Do not move this to the XML file, Qt before 4.7 will choke on it */ amountWidget->setPlaceholderText(tr("Min amount")); #endif #ifdef MAC_OSX amountWidget->setFixedWidth(97); #else amountWidget->setFixedWidth(100); #endif amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this)); hlayout->addWidget(amountWidget); QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setContentsMargins(0,0,0,0); vlayout->setSpacing(0); QTableView *view = new QTableView(this); vlayout->addLayout(hlayout); vlayout->addWidget(createDateRangeWidget()); //view->setFixedHeight(360); vlayout->addWidget(view); QTableView *viewT = new QTableView(this); viewT->setFixedHeight(26); vlayout->addWidget(viewT); vlayout->setSpacing(0); int width = view->verticalScrollBar()->sizeHint().width(); //Cover scroll bar width with spacing #ifdef MAC_OSX hlayout->addSpacing(width+2); #else hlayout->addSpacing(width); #endif // Always show scroll bar view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view->setTabKeyNavigation(false); view->setContextMenuPolicy(Qt::CustomContextMenu); reportView = view; reportViewT=viewT; // Actions QAction *showTotalAction = new QAction(tr("Show transaction total"), this); contextMenu = new QMenu(); contextMenu->addAction(showTotalAction); // Connect actions connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString))); connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString))); connect(showTotalAction, SIGNAL(triggered()), this, SLOT(showTotal())); }
FenetreGraphique::FenetreGraphique(QWidget* parent): QWidget(parent){ //Fentre principale this->setWindowTitle(QString("Project Calendar")); //setFixedSize(1200,800); setFixedSize(900,600); //qApp->setStyleSheet("QTableView{border:1px solid red;}"); //Onglets saisie et affichage onglets = new QTabWidget(this); //onglets->setGeometry(10,10,1180,780); onglets->setGeometry(10,10,980,540); pageSaisie = new QWidget; pageAffichage = new QWidget; pageExport = new QWidget; //Page Saisie////////////////////////////////////////////////////////////////////////////////////////////// layoutPageSaisiePrincipal = new QHBoxLayout; //GroupBox selectionprojet + treeview layoutProjetTV = new QVBoxLayout; gBProjetTV = new QGroupBox(this); gBProjetTV->setTitle("Projets"); gBProjetTV->setFixedWidth(300); //onglets creation projet, tache, event supportOngletsCreation = new QWidget; ongletsNiveau2 = new QTabWidget(supportOngletsCreation); ongletsNiveau2->setGeometry(0,10,540,420); //ongletsNiveau2->setGeometry(0,10,840,720); pageCreationprojet = new QWidget; pageTacheUnitaire = new QWidget; pageTacheComposite = new QWidget; initialisationTabPTUTC(); //Liste des projets bNouveauProjet = new QPushButton("Nouveau projet"); menuDeroulantProjets = new QComboBox; initialisationMenuProjet(); //Treeview modelTreeView = new QStandardItemModel; vueTreeView = new QTreeView; vueTreeView->setModel(modelTreeView); vueTreeView->setHeaderHidden(true); vueTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); //creation projets layoutCreationProjet1 = new QHBoxLayout; layoutCreationProjet2 = new QHBoxLayout; layoutCreationProjet3 = new QHBoxLayout; layoutCreationProjet4 = new QHBoxLayout; layoutCreationProjet5 = new QHBoxLayout; layoutCreationProjet = new QVBoxLayout; labelNomProjet = new QLabel("Nom du projet :"); nomProjet = new QLabel(""); labelProjetDateDispo = new QLabel("Date de disponibilité : "); projetDateDispo = new QLabel(""); labelProjetEcheance = new QLabel("Echéance du projet :"); projetEcheance = new QLabel(""); bCreerTacheUProjet = new QPushButton("Creer tache unitaire"); bCreerTacheCProjet = new QPushButton("Creer tache composite"); bModifierProjet = new QPushButton("Modifier le projet"); bdetruireProjet = new QPushButton("Supprimer"); //creation tache layoutCreationTache1 = new QHBoxLayout; layoutCreationTache2 = new QHBoxLayout; layoutCreationTache3 = new QHBoxLayout; layoutCreationTache4 = new QHBoxLayout; layoutCreationTache5 = new QHBoxLayout; layoutCreationTache6 = new QHBoxLayout; layoutCreationTache7 = new QHBoxLayout; layoutCreationTache8 = new QHBoxLayout; layoutCreationTache = new QVBoxLayout; //Fenetre TacheUnitaire labelIdentificateurTache = new QLabel("Identificateur de la tache : "); identificateurTache = new QLabel(""); preemptiveTache = new QCheckBox("Preemptive"); preemptiveTache->setDisabled(true); titreTacheLabel = new QLabel("Titre de la tache :"); titreTache = new QLabel(""); labelTacheEtat = new QLabel("Etat :"); tacheEtat = new QLabel(""); labelDisponibiliteTache = new QLabel("Date de disponibilité :"); disponibiliteTache = new QLabel(""); labelTacheEcheance = new QLabel("Date d'écheance :"); tacheEcheance = new QLabel(""); labelTacheDuree = new QLabel("Durée :"); tacheDuree = new QLabel(""); labelPrecedenceTacheU = new QLabel("Tâches précédentes"); modelePrecedenceTacheU = new QStringListModel(QStringList("")); vuePrecedenceTacheU = new QListView; vuePrecedenceTacheU->setModel(modelePrecedenceTacheU); vuePrecedenceTacheU->setEditTriggers(QAbstractItemView::NoEditTriggers); bModifierTacheU = new QPushButton("Modifier"); bSupprimerTacheU = new QPushButton("Supprimer"); //creation Event layoutCreationEvent1 = new QHBoxLayout; layoutCreationEvent2 = new QHBoxLayout; layoutCreationEvent3 = new QHBoxLayout; layoutCreationEvent4 = new QHBoxLayout; layoutCreationEvent5 = new QHBoxLayout; layoutCreationEvent6 = new QHBoxLayout; layoutCreationEvent7 = new QHBoxLayout; layoutCreationEvent8 = new QHBoxLayout; layoutCreationEvent9 = new QHBoxLayout; layoutCreationEvent = new QVBoxLayout; //Fenetre Tache Composite labelIdentificateurTacheC = new QLabel("Identificateur de la tache : "); identificateurTacheC = new QLabel(""); titreTacheLabelC = new QLabel("Titre de la tache"); titreTacheC = new QLabel(""); labelTacheEtatC = new QLabel("Etat :"); tacheEtatC = new QLabel(""); labelDisponibiliteTacheC = new QLabel("Date de disponibilité :"); disponibiliteTacheC = new QLabel(""); labelTacheCEcheance = new QLabel("Date d'écheance :"); tacheCEcheance = new QLabel(""); labelTacheCDuree = new QLabel("Durée totale:"); tacheCDuree = new QLabel(""); labelPrecedenceTacheC = new QLabel("Tâches précédentes"); modelePrecedenceTacheC = new QStringListModel(QStringList("")); vuePrecedenceTacheC = new QListView; vuePrecedenceTacheC->setModel(modelePrecedenceTacheC); vuePrecedenceTacheC->setEditTriggers(QAbstractItemView::NoEditTriggers); bTacheCCreerTacheU = new QPushButton("Creer sous tâche unitaire"); bTacheCCreerTacheC = new QPushButton("Creer sous tâche composite"); bModifierTacheC = new QPushButton("Modifier"); bSupprimerTacheC = new QPushButton("Supprimer"); //Imbrication projets + treeview layoutProjetTV->addWidget(bNouveauProjet); layoutProjetTV->addWidget(menuDeroulantProjets); layoutProjetTV->addWidget(vueTreeView); gBProjetTV->setLayout(layoutProjetTV); //imbrication onglet creation projet layoutCreationProjet1->addWidget(labelNomProjet); layoutCreationProjet1->addWidget(nomProjet); layoutCreationProjet2->addWidget(labelProjetDateDispo); layoutCreationProjet2->addWidget(projetDateDispo); layoutCreationProjet3->addWidget(labelProjetEcheance); layoutCreationProjet3->addWidget(projetEcheance); layoutCreationProjet4->addWidget(bCreerTacheUProjet); layoutCreationProjet4->addWidget(bCreerTacheCProjet); layoutCreationProjet5->addWidget(bModifierProjet); layoutCreationProjet5->addWidget(bdetruireProjet); layoutCreationProjet->addLayout(layoutCreationProjet1); layoutCreationProjet->addLayout(layoutCreationProjet2); layoutCreationProjet->addLayout(layoutCreationProjet3); layoutCreationProjet->addLayout(layoutCreationProjet4); layoutCreationProjet->addLayout(layoutCreationProjet5); pageCreationprojet->setLayout(layoutCreationProjet); //imbrication creation tache layoutCreationTache1->addWidget(labelIdentificateurTache); layoutCreationTache1->addWidget(identificateurTache); layoutCreationTache1->addWidget(preemptiveTache); layoutCreationTache2->addWidget(titreTacheLabel); layoutCreationTache2->addWidget(titreTache); layoutCreationTache3->addWidget(labelTacheEtat); layoutCreationTache3->addWidget(tacheEtat); layoutCreationTache4->addWidget(labelDisponibiliteTache); layoutCreationTache4->addWidget(disponibiliteTache); layoutCreationTache5->addWidget(labelTacheEcheance); layoutCreationTache5->addWidget(tacheEcheance); layoutCreationTache6->addWidget(labelTacheDuree); layoutCreationTache6->addWidget(tacheDuree); layoutCreationTache7->addWidget(labelPrecedenceTacheU); layoutCreationTache7->addWidget(vuePrecedenceTacheU); layoutCreationTache8->addWidget(bModifierTacheU); layoutCreationTache8->addWidget(bSupprimerTacheU); layoutCreationTache->addLayout(layoutCreationTache1); layoutCreationTache->addLayout(layoutCreationTache2); layoutCreationTache->addLayout(layoutCreationTache3); layoutCreationTache->addLayout(layoutCreationTache4); layoutCreationTache->addLayout(layoutCreationTache5); layoutCreationTache->addLayout(layoutCreationTache6); layoutCreationTache->addLayout(layoutCreationTache7); layoutCreationTache->addLayout(layoutCreationTache8); pageTacheUnitaire->setLayout(layoutCreationTache); //imbrication creation Event layoutCreationEvent1->addWidget(labelIdentificateurTacheC); layoutCreationEvent1->addWidget(identificateurTacheC); layoutCreationEvent2->addWidget(titreTacheLabelC); layoutCreationEvent2->addWidget(titreTacheC); layoutCreationEvent3->addWidget(labelTacheEtatC); layoutCreationEvent3->addWidget(tacheEtatC); layoutCreationEvent4->addWidget(labelDisponibiliteTacheC); layoutCreationEvent4->addWidget(disponibiliteTacheC); layoutCreationEvent5->addWidget(labelTacheCEcheance); layoutCreationEvent5->addWidget(tacheCEcheance); layoutCreationEvent6->addWidget(labelTacheCDuree); layoutCreationEvent6->addWidget(tacheCDuree); layoutCreationEvent7->addWidget(labelPrecedenceTacheC); layoutCreationEvent7->addWidget(vuePrecedenceTacheC); layoutCreationEvent8->addWidget(bTacheCCreerTacheU); layoutCreationEvent8->addWidget(bTacheCCreerTacheC); layoutCreationEvent9->addWidget(bModifierTacheC); layoutCreationEvent9->addWidget(bSupprimerTacheC); layoutCreationEvent->addLayout(layoutCreationEvent1); layoutCreationEvent->addLayout(layoutCreationEvent2); layoutCreationEvent->addLayout(layoutCreationEvent3); layoutCreationEvent->addLayout(layoutCreationEvent4); layoutCreationEvent->addLayout(layoutCreationEvent5); layoutCreationEvent->addLayout(layoutCreationEvent6); layoutCreationEvent->addLayout(layoutCreationEvent7); layoutCreationEvent->addLayout(layoutCreationEvent8); layoutCreationEvent->addLayout(layoutCreationEvent9); pageTacheComposite->setLayout(layoutCreationEvent); //imbrication onglets niveau2 + layout principal pageSaisie ongletsNiveau2->addTab(pageCreationprojet, "Projet"); ongletsNiveau2->addTab(pageTacheUnitaire, "Tâche unitaire"); ongletsNiveau2->addTab(pageTacheComposite, "Tâche composite"); layoutPageSaisiePrincipal->addWidget(gBProjetTV); layoutPageSaisiePrincipal->addWidget(supportOngletsCreation); //page Affichage///////////////////////////////////////////////////////////////////////////////////////////////////// layoutPageAffichagePrincipal = new QVBoxLayout; //En tete (gestion semaine suivante/precedente layoutHautAgenda = new QHBoxLayout; dateReferenceAgenda = new QDate(QDate::currentDate()); jourActuel = new QPushButton(constructionMessageSemaineAgenda(dateReferenceAgenda)); jourActuel->setEnabled(false); bSemainePrecedente = new QPushButton("Semaine precedent"); bSemaineSuivante = new QPushButton("Semaine suivant"); layoutHautAgenda->addWidget(bSemainePrecedente); layoutHautAgenda->addWidget(jourActuel); layoutHautAgenda->addWidget(bSemaineSuivante); QStandardItemModel *modelAgenda = new QStandardItemModel(60, 7); QTableView *vueAgenda = new QTableView; vueAgenda->setEditTriggers(QAbstractItemView::NoEditTriggers); vueAgenda->setModel(modelAgenda); vueAgenda->setFixedWidth(1157); vueAgenda->setFixedHeight(625); vueAgenda->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); vueAgenda->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); vueAgenda->setSelectionMode(QAbstractItemView::SingleSelection); //=========== vueAgenda->setGridStyle(Qt::DashDotLine); miseAJourTableau(*modelAgenda); //, *vueAgenda); itemCol0 = new QStandardItem(chaineJoursHeader(1, dateReferenceAgenda->addDays(1-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month())); itemCol1 = new QStandardItem(chaineJoursHeader(2, dateReferenceAgenda->addDays(2-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month())); itemCol2 = new QStandardItem(chaineJoursHeader(3, dateReferenceAgenda->addDays(3-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month())); itemCol3 = new QStandardItem(chaineJoursHeader(4, dateReferenceAgenda->addDays(4-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month())); itemCol4 = new QStandardItem(chaineJoursHeader(5, dateReferenceAgenda->addDays(5-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month())); itemCol5 = new QStandardItem(chaineJoursHeader(6, dateReferenceAgenda->addDays(6-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month())); itemCol6 = new QStandardItem(chaineJoursHeader(7, dateReferenceAgenda->addDays(7-dateReferenceAgenda->dayOfWeek()).day(), dateReferenceAgenda->month())); modelAgenda->setHorizontalHeaderItem(0, itemCol0); modelAgenda->setHorizontalHeaderItem(1, itemCol1); modelAgenda->setHorizontalHeaderItem(2, itemCol2); modelAgenda->setHorizontalHeaderItem(3, itemCol3); modelAgenda->setHorizontalHeaderItem(4, itemCol4); modelAgenda->setHorizontalHeaderItem(5, itemCol5); modelAgenda->setHorizontalHeaderItem(6, itemCol6); QStringList headerVTableau; for(unsigned int i=7; i<22; i++) { headerVTableau << QString::number(i)+"h00"; for(unsigned int j=1; j<4; j++) { headerVTableau << ""; //headerVTableau << QString::number(j*15); } } modelAgenda->setVerticalHeaderLabels(headerVTableau); miseEnFormeLigneColonnes(vueAgenda); //bas de page (programmation) layoutProgrammation = new QHBoxLayout; bProgrammerTache = new QPushButton("Programmer tâche"); bProgrammerEvt = new QPushButton("Programmer Evenement"); bSupprimerProgrammation = new QPushButton("Supprimer programmation"); layoutProgrammation->addWidget(bProgrammerTache); layoutProgrammation->addWidget(bProgrammerEvt); layoutProgrammation->addWidget(bSupprimerProgrammation); //pose des layouts pageAffichage layoutPageAffichagePrincipal->addLayout(layoutHautAgenda); layoutPageAffichagePrincipal->addWidget(vueAgenda); layoutPageAffichagePrincipal->addLayout(layoutProgrammation); //pageExport///////////////////////////////////////////////////////////////////////////////////////////////////// layoutPageExportPrincipal = new QHBoxLayout; widgetSecondairePageExport = new QWidget; widgetSecondairePageExport->setFixedSize(400, 300); layoutPageExportSecondaire = new QVBoxLayout(widgetSecondairePageExport); labelExport = new QLabel("Chosir le type d'export:"); nomFichierExport = new QLineEdit("NomFichier"); bExportImport = new QPushButton("Importer"); bExportImport->setEnabled(false); bExportProgrammationBrut = new QPushButton("Programmation totale (brut)"); bExportProgrammationXml = new QPushButton("Programmation totale (Xml"); bExportSemaineBrut = new QPushButton("Programmation semaine (brut)"); bExportSemaineXml = new QPushButton("Programmation semaine (Xml)"); //pose des layout page export layoutPageExportSecondaire->addWidget(labelExport); layoutPageExportSecondaire->addWidget(nomFichierExport); layoutPageExportSecondaire->addWidget(bExportImport); layoutPageExportSecondaire->addWidget(bExportProgrammationBrut); layoutPageExportSecondaire->addWidget(bExportProgrammationXml); layoutPageExportSecondaire->addWidget(bExportSemaineBrut); layoutPageExportSecondaire->addWidget(bExportSemaineXml); layoutPageExportPrincipal->addWidget(widgetSecondairePageExport); //pose des layouts principaux pageAffichage->setLayout(layoutPageAffichagePrincipal); pageSaisie->setLayout(layoutPageSaisiePrincipal); pageExport->setLayout(layoutPageExportPrincipal); onglets->addTab(pageAffichage, "Agenda"); onglets->addTab(pageSaisie, "Gestionnaire de projet"); onglets->addTab(pageExport, "Exports"); //connections page saisie------------- QObject::connect(vueAgenda, SIGNAL(doubleClicked(const QModelIndex)), this, SLOT(affichageContenuCase(const QModelIndex))); QObject::connect(bSemainePrecedente, SIGNAL(clicked()), this, SLOT(semainePrecedente())); QObject::connect(bSemaineSuivante, SIGNAL(clicked()), this, SLOT(semaineSuivante())); QObject::connect(bProgrammerTache, SIGNAL(clicked()), this, SLOT(nouvelleProgrammationTache())); QObject::connect(bProgrammerEvt, SIGNAL(clicked()), this, SLOT(nouvelleProgrammationEvt())); QObject::connect(bSupprimerProgrammation, SIGNAL(clicked()), this, SLOT(supprimerProgrammation())); //connexions page affichage---------- //tree view QObject::connect(menuDeroulantProjets, SIGNAL(currentIndexChanged(int)), this, SLOT(changerProjetTreeView(int))); QObject::connect(vueTreeView, SIGNAL(clicked(const QModelIndex)), this, SLOT(selectionTreeView(const QModelIndex))); //Creation projet, tache, evenement QObject::connect(bNouveauProjet, SIGNAL(clicked()), this, SLOT(creerProjet())); QObject::connect(bCreerTacheUProjet, SIGNAL(clicked()), this, SLOT(creerTacheUProjet())); QObject::connect(bCreerTacheCProjet, SIGNAL(clicked()), this, SLOT(creerTacheCProjet())); QObject::connect(bModifierProjet, SIGNAL(clicked()), this, SLOT(modifierProjet())); QObject::connect(bdetruireProjet, SIGNAL(clicked()), this, SLOT(detruireProjet())); QObject::connect(bModifierTacheU, SIGNAL(clicked()), this, SLOT(modifierTacheU())); QObject::connect(bSupprimerTacheU, SIGNAL(clicked()), this, SLOT(supprimerTacheU())); QObject::connect(bTacheCCreerTacheU, SIGNAL(clicked()), this, SLOT(creerTacheUTacheC())); QObject::connect(bTacheCCreerTacheC, SIGNAL(clicked()), this, SLOT(creerTacheCTacheC())); QObject::connect(bModifierTacheC, SIGNAL(clicked()), this, SLOT(modifierTacheC())); QObject::connect(bSupprimerTacheC, SIGNAL(clicked()), this, SLOT(supprimerTacheC())); //connexions page export-------------- QObject::connect(nomFichierExport, SIGNAL(textEdited(QString)), this, SLOT(validationNomExport(QString))); QObject::connect(bExportProgrammationBrut, SIGNAL(clicked()), this, SLOT(exportProgrammationBrut())); QObject::connect(bExportProgrammationXml, SIGNAL(clicked()), this, SLOT(exportProgrammationXml())); QObject::connect(bExportSemaineBrut, SIGNAL(clicked()), this, SLOT(exportSemaineBrut())); QObject::connect(bExportSemaineXml, SIGNAL(clicked()), this, SLOT(exportSemaineXml())); }