Exemple #1
0
QWidget* medDatabaseDataSource::mainViewWidget()
{
    if(d->mainWidget.isNull())
    {
        d->mainWidget = new QWidget;
        d->largeView = new medDatabaseView(d->mainWidget);
        d->largeView->setModel(d->proxy);

        QVBoxLayout *database_layout = new QVBoxLayout(d->mainWidget);
        database_layout->setContentsMargins(0, 0, 0, 0);
        database_layout->setSpacing(0);
        database_layout->addWidget(d->largeView);

        connect(d->largeView, SIGNAL(open(const medDataIndex&)), this, SIGNAL(open(const medDataIndex&)));
        connect(d->largeView, SIGNAL(exportData(const medDataIndex&)), this, SIGNAL(exportData(const medDataIndex&)));
        connect(d->largeView, SIGNAL(dataRemoved(const medDataIndex&)), this, SIGNAL(dataRemoved(const medDataIndex&)));

        if(!d->toolBoxes.isEmpty())
        {
            connect(d->actionsToolBox, SIGNAL(removeClicked()), d->largeView, SLOT(onRemoveSelectedItemRequested()));
            connect(d->actionsToolBox, SIGNAL(exportClicked()), d->largeView, SLOT(onExportSelectedItemRequested()));
            connect(d->actionsToolBox, SIGNAL(viewClicked()), d->largeView, SLOT(onViewSelectedItemRequested()));
            connect(d->actionsToolBox, SIGNAL(saveClicked()), d->largeView, SLOT(onSaveSelectedItemRequested()));
            connect(d->actionsToolBox, SIGNAL(newPatientClicked()), d->largeView, SLOT(onCreatePatientRequested()));
            connect(d->actionsToolBox, SIGNAL(newStudyClicked()), d->largeView, SLOT(onCreateStudyRequested()));
            connect(d->actionsToolBox, SIGNAL(editClicked()), d->largeView, SLOT(onEditRequested()));

            connect(d->largeView, SIGNAL(patientClicked(const medDataIndex&)), d->actionsToolBox, SLOT(patientSelected(const medDataIndex&)));
            connect(d->largeView, SIGNAL(seriesClicked(const medDataIndex&)), d->actionsToolBox, SLOT(seriesSelected(const medDataIndex&)));
            connect(d->largeView, SIGNAL(noPatientOrSeriesSelected()), d->actionsToolBox, SLOT(noPatientOrSeriesSelected()));
            connect(d->largeView, SIGNAL(multipleEntriesSelected(const QVector<medDataIndex>&)), d->actionsToolBox, SLOT(multipleEntriesSelected(const QVector<medDataIndex>&)));
        }
Exemple #2
0
NewVisit::NewVisit(QDialog *parent) : Guide(parent), 
	patient_id(-1), therapy_id(-1), visit_id(-1), success(false) {
	resize(QSize(700, 500));

	// Step 0
	patientList = new PatientList;
	newPatient = new QPushButton("Nowy pacjent");
	wid0 = new QWidget;
	lay0 = new QVBoxLayout(wid0);
	lay0->addWidget(patientList, 1);
	lay0->addWidget(newPatient, 0, Qt::AlignCenter);

	connect(patientList, SIGNAL(changed(int)),
			this, SLOT(patientChanged(int)));
	connect(newPatient, SIGNAL(clicked()),
			this, SLOT(newPatientClicked()));
	
	Step step0 = {"Wybierz pacjenta", wid0, false};
	append(step0);

	// Step 1
	therapyList = new TherapyList;
	newTherapy = new QPushButton("Nowa terapia");
	wid1 = new QWidget;
	lay1 = new QVBoxLayout(wid1);
	lay1->addWidget(therapyList, 1);
	lay1->addWidget(newTherapy, 0, Qt::AlignCenter);

	connect(therapyList, SIGNAL(changed(int)),
			this, SLOT(therapyChanged(int)));
	connect(newTherapy, SIGNAL(clicked()),
			this, SLOT(newTherapyClicked()));
	
	Step step1 = {QString::fromUtf8("Wybierz terapię"), wid1, false};
	append(step1);

	// Step 2
	wid2 = new QWidget;
	info = new QFormLayout(wid2);
	
	date = new QDateEdit;
	city = new QLineEdit(QString::fromUtf8(DEFAULT_CITY));
	info->addRow("Data wizyty:", date);
	info->addRow(QString::fromUtf8("Miejscowość:"), city);

	Step step2 = {QString::fromUtf8("Ogólne informacje"), wid2, true};
	append(step2);

	// Step 3
	wid3 = new QWidget;
	lay3 = new QGridLayout(wid3);

	interview_label = new QLabel("Wywiad");
	interview = new QTextEdit;
	test_res_label = new QLabel("Badania");
	test_res = new QTextEdit;
	control_label = new QLabel("Testy kontrolne");
	control = new QStringListModel;
	control_view = new QListView;
	control_add = new QPushButton("Dodaj");
	control_del = new QPushButton(QString::fromUtf8("Usuń"));
	control_edit = new QPushButton(QString::fromUtf8("Edytuj"));
	control_buttons = new QHBoxLayout;

	interview->setTabChangesFocus(true);
	test_res->setTabChangesFocus(true);
	control_view->setModel(control);
	control_buttons->addWidget(control_add);
	connect(control_add, SIGNAL(clicked()), this,
			SLOT(controlAddClicked()));
	control_buttons->addWidget(control_del);
	connect(control_del, SIGNAL(clicked()), this,
			SLOT(controlDelClicked()));
	control_buttons->addWidget(control_edit);
	connect(control_edit, SIGNAL(clicked()), this,
			SLOT(controlEditClicked()));

	connect(control, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
		this, SLOT(controlDcr(const QModelIndex &, int, int)));
	connect(control, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
		this, SLOT(controlInc(const QModelIndex &, int, int)));
	connect(control, 
		SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
		this,
		SLOT(controlCh(const QModelIndex &, const QModelIndex &)));


	lay3->addWidget(interview_label, 0, 0);
	lay3->addWidget(interview, 1, 0);
	lay3->addWidget(test_res_label, 0, 1);
	lay3->addWidget(test_res, 1, 1);
	lay3->addWidget(control_label, 2, 0, 1, 2);
	lay3->addWidget(control_view, 3, 0, 1, 2);
	lay3->addLayout(control_buttons, 4, 0, 1, 2, Qt::AlignCenter);

	Step step3 = {QString::fromUtf8("Wywiad i testy kontrolne"),
		wid3, true};
	append(step3);

	// Step	4
	wid4 = new QWidget;
	treat_buttons_wrap = new QWidget;
	lay4 = new QVBoxLayout(wid4);
	treat_buttons = new QHBoxLayout;//(treat_buttons_wrap);
	treat = new QStandardItemModel;
	treat_view = new QTableView;
	treat_del = new QPushButton(QString::fromUtf8("Usuń"));
	treat_add = new QPushButton("Dodaj");
	treat_edit = new QPushButton("Edytuj");

	treat_delegate = new TreatDelegate;
	res_delegate = new ResDelegate;

	treat_view->setModel(treat);
	QList<QStandardItem *> list;
	treat->appendColumn(list);
	treat->setHeaderData(0, Qt::Horizontal, "Rodzaj zabiegu"); 

	treat_buttons->addWidget(treat_add);
	treat_buttons->addWidget(treat_del);
	treat_buttons->addWidget(treat_edit);

	connect(treat_add, SIGNAL(clicked()), this, 
			SLOT(treatAddClicked()));
	connect(treat_del, SIGNAL(clicked()), this,
			SLOT(treatDelClicked()));
	connect(treat_edit, SIGNAL(clicked()), this,
			SLOT(treatEditClicked()));

	treat_view->verticalHeader()->hide();
	treat_view->setSelectionBehavior(QAbstractItemView::SelectRows);
	treat_view->setSelectionMode(QAbstractItemView::SingleSelection);
	treat_view->setItemDelegate(res_delegate);
	treat_view->setItemDelegateForColumn(0, treat_delegate);
	
	lay4->addWidget(treat_view, 1);
	lay4->addLayout(treat_buttons);
	lay4->setAlignment(treat_buttons, Qt::AlignCenter);

	Step step4 = {QString::fromUtf8("Zabiegi"), wid4, true};
	append(step4);

	// Step 5
	wid5 = new QWidget;
	lay5 = new QVBoxLayout(wid5);
	auto_label = new QLabel("Autoterapia");
	autotherapy = new QTextEdit;

	autotherapy->setTabChangesFocus(true);
	lay5->addWidget(auto_label);
	lay5->addWidget(autotherapy);
	
	Step step5 = {"Autoterapia", wid5, true};	
	append(step5);

	// Step 6 - confirm
	confirm_label = new QLabel(QString::fromUtf8(
		"<b>Tworzenie wizyty zakończone!</b><br/><br/>Kliknij "
		"<i>Dalej</i> aby zatwierdzić wizytę i zapisać ją w bazie. "
		"Możesz też wrócić się, aby poprawić "
		"wprowadzone dane klikając <i>Wstecz</i> "
		"lub wybrać <i>Przerwij</i>, aby "
		"zrezygnować z tworzonej wizyty."));
	confirm_label->setWordWrap(true);

	Step step6 = {QString::fromUtf8("Potwierdzenie wizyty"), 
		confirm_label, true};
	append(step6);

	// Last step
	wid_last = new QWidget;
	lay_last = new QVBoxLayout(wid_last);
	label_last = new QLabel(QString::fromUtf8("<b>Gratulacje! Wizyta "
		"została zapisana!</b><br/><br/> "
		"Możesz już bezpiecznie zamknąć to okno. "
		"Możesz też wybrać jedną z poniższych opcji:"));
	print_visit = new QPushButton("Drukuj raport");
	export_visit = new QPushButton("Raport w formie PDF");
	print_auto = new QPushButton("Drukuj autoterapię");
	export_auto = new QPushButton("Autoterapia w formie PDF");
	send_auto = new QPushButton("Wyślij autoterapię");

	lay_last->addWidget(label_last);
	lay_last->addWidget(print_visit);
	lay_last->addWidget(export_visit);
	lay_last->addWidget(print_auto);
	lay_last->addWidget(export_auto);
	lay_last->addWidget(send_auto);

	Step step_last = {QString::fromUtf8("Wizyta zapisana"), label_last,
		false};
	append(step_last);
}