void NotifyConfigurationUiHandler::notifierRegistered(Notifier *notifier)
{
    if (notificationsGroupBox)
    {
        addConfigurationWidget(notifier);
        notifyTreeWidget->refresh();
    }
}
Пример #2
0
QConfigurationDialog::QConfigurationDialog(QWidget *parent, Qt::WindowFlags f)
 : QDialog(parent, f)
{
    setupUi(this);
    setWindowTitle(tr("%1 Configuration").arg(ApplicationNameString));
    setWindowFlags((this->windowFlags() | Qt::WindowMaximizeButtonHint) ^ Qt::WindowContextHelpButtonHint);

    // Configuració del visor 2D
    Q2DViewerConfigurationScreen *q2dviewerScreen = new Q2DViewerConfigurationScreen(this);
    addConfigurationWidget(q2dviewerScreen, tr("2D Viewer"), BasicConfiguration);

    // Configuració del layout del visor 2D
    Q2DViewerLayoutConfigurationScreen *q2dviewerLayoutScreen = new Q2DViewerLayoutConfigurationScreen(this);
    addConfigurationWidget(q2dviewerLayoutScreen, tr("2D Viewer Layout"), BasicConfiguration);

#ifndef STARVIEWER_LITE
    // No mostrem configuració del PACS
    QConfigurationScreen *pacsConfigurationScreen = new QConfigurationScreen(this);
    this->addConfigurationWidget(pacsConfigurationScreen, tr("PACS"), AdvancedConfiguration);
#endif

    // Configuracions de la base de dades local
    QLocalDatabaseConfigurationScreen *localDatabaseScreen = new QLocalDatabaseConfigurationScreen(this);
    this->addConfigurationWidget(localDatabaseScreen, tr("Local Database"), AdvancedConfiguration);

#ifndef STARVIEWER_LITE
    // No mostrem configuració del servei que escolta les peticions del RIS
    QListenRisRequestsConfigurationScreen *qListenRisRequestsConfigurationScreen = new QListenRisRequestsConfigurationScreen(this);
    this->addConfigurationWidget(qListenRisRequestsConfigurationScreen, tr("RIS Listener"), AdvancedConfiguration);
#endif

    // Configuració del programa de gravació
    QDICOMDIRConfigurationScreen *dicomdirScreen = new QDICOMDIRConfigurationScreen(this);
    this->addConfigurationWidget(dicomdirScreen, tr("DICOMDIR"), AdvancedConfiguration);

    connect(m_viewAdvancedOptions, SIGNAL(stateChanged(int)), SLOT(setViewAdvancedConfiguration()));

    m_optionsList->setCurrentRow(0);
    m_viewAdvancedOptions->setCheckState(Qt::Checked);
}
void NotifyConfigurationUiHandler::mainConfigurationWindowCreated(MainConfigurationWindow *mainConfigurationWindow)
{
    for (auto notifier : m_notifierRepository)
    {
        for (auto &&notifyEvent : m_notificationEventRepository->notificationEvents())
        {
            if (!NotifierGui[notifier].Events.contains(notifyEvent.name()))
                NotifierGui[notifier].Events[notifyEvent.name()] = m_configuration->deprecatedApi()->readBoolEntry(
                    "Notify", notifyEvent.name() + '_' + notifier->name());
        }
    }

    QString eventName;
    for (auto &&notifyEvent : m_notificationEventRepository->notificationEvents())
    {
        eventName = notifyEvent.name();
        if (NotificationEvents.contains(eventName))
            continue;

        NotificationEventConfigurationItem item;
        item.event = notifyEvent;
        item.useCustomSettings =
            m_configuration->deprecatedApi()->readBoolEntry("Notify", eventName + "_UseCustomSettings", false);

        NotificationEvents[eventName] = item;
    }

    notificationsGroupBox =
        mainConfigurationWindow->widget()->configGroupBox("Notifications", "Events", "Notifications");

    notifierMainWidget = new QWidget{notificationsGroupBox->widget()};
    notifierMainWidgetLayout = new QVBoxLayout(notifierMainWidget);
    notifierMainWidgetLayout->setMargin(0);

    notificationsGroupBox->addWidget(notifierMainWidget, true);

    notifyTreeWidget = m_injectedFactory->makeInjected<NotifyTreeWidget>(this, notificationsGroupBox->widget());
    notifyTreeWidget->setMinimumHeight(300);
    notifierMainWidgetLayout->addWidget(notifyTreeWidget, 100);
    notifyTreeWidget->setCurrentItem(notifyTreeWidget->topLevelItem(0));
    connect(notifyTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(eventSwitched()));

    useCustomSettingsCheckBox = new QCheckBox(tr("Use custom settings"));
    connect(useCustomSettingsCheckBox, SIGNAL(toggled(bool)), this, SLOT(customSettingsCheckBoxToggled(bool)));
    notifierMainWidgetLayout->addWidget(useCustomSettingsCheckBox);

    for (auto notifier : m_notifierRepository)
        addConfigurationWidget(notifier);

    eventSwitched();
}