Example #1
0
ReaderInfoDialog::ReaderInfoDialog(const QString &u, const QString &num, QWidget *parent) :
    QDialog(parent), str(num), user_name(u)
{
    IDLabel = new QLabel(tr("&ID:"));
    IDLineEdit = new QLineEdit;
    IDLabel->setBuddy(IDLineEdit);
    queryButton = new QPushButton(tr("Quer&y"));

    passwordLabel = new QLabel(tr("&Password:"******"&Affirm Password:"******"&Name:"));
    nameLineEdit = new QLineEdit;
    nameLabel->setBuddy(nameLineEdit);

    sexLabel = new QLabel(tr("&Sex:"));
    sexComboBox = new QComboBox;
    sexComboBox->addItems(QStringList() << tr("male") << tr("female"));
    sexLabel->setBuddy(sexComboBox);

    birthdayLabel = new QLabel(tr("&Birthday:"));
    birthdayDateEdit = new QDateEdit;
    birthdayLabel->setBuddy(birthdayDateEdit);

    cardDateLabel = new QLabel(tr("&Card Date:"));
    cardDateEdit = new QDateEdit;
    cardDateLabel->setBuddy(cardDateEdit);
    cardDateEdit->setDate(QDate::currentDate());

    validDateLabel = new QLabel(tr("&Valid Date:"));
    validDateEdit = new QDateEdit;
    validDateEdit->setDate(QDate::currentDate().addYears(1));
    validDateLabel->setBuddy(validDateEdit);

    IDCardLabel = new QLabel(tr("&ID Card:"));
    IDCardLineEdit = new QLineEdit;
    IDCardLabel->setBuddy(IDCardLineEdit);

    phoneLabel = new QLabel(tr("&Phone:"));
    phoneLineEdit = new QLineEdit;
    phoneLabel->setBuddy(phoneLineEdit);

    stateLabel = new QLabel(tr("&State:"));
    stateComboBox = new QComboBox;
    stateComboBox->addItems(QStringList() << tr("normal") << tr("logout"));
    stateLabel->setBuddy(stateComboBox);

    typeLabel = new QLabel(tr("&Type:"));
    typeComboBox = new QComboBox;
    typeComboBox->addItems(QStringList() << tr("normal") << tr("VIP"));
    typeLabel->setBuddy(typeComboBox);


    QGridLayout *gridLayout = new QGridLayout;
    gridLayout->addWidget(IDLabel, 0, 0);
    gridLayout->addWidget(IDLineEdit, 0, 1);
    gridLayout->addWidget(queryButton, 0, 2);
    gridLayout->addWidget(passwordLabel, 1, 0);
    gridLayout->addWidget(passwordLineEdit, 1, 1);
    gridLayout->addWidget(againPasswordLabel, 2, 0);
    gridLayout->addWidget(againPasswordLineEdit, 2, 1);
    gridLayout->addWidget(nameLabel, 3, 0);
    gridLayout->addWidget(nameLineEdit, 3, 1);
    gridLayout->addWidget(sexLabel, 4, 0);
    gridLayout->addWidget(sexComboBox, 4, 1);
    gridLayout->addWidget(birthdayLabel, 5, 0);
    gridLayout->addWidget(birthdayDateEdit, 5, 1);
    gridLayout->addWidget(cardDateLabel, 6, 0);
    gridLayout->addWidget(cardDateEdit, 6, 1);
    gridLayout->addWidget(validDateLabel, 7, 0);
    gridLayout->addWidget(validDateEdit, 7, 1);
    gridLayout->addWidget(IDCardLabel, 8, 0);
    gridLayout->addWidget(IDCardLineEdit, 8, 1);
    gridLayout->addWidget(phoneLabel, 9, 0);
    gridLayout->addWidget(phoneLineEdit, 9, 1);
    gridLayout->addWidget(stateLabel, 10, 0);
    gridLayout->addWidget(stateComboBox, 10, 1);
    gridLayout->addWidget(typeLabel, 11, 0);
    gridLayout->addWidget(typeComboBox, 11, 1);

    groupBox = new QGroupBox(tr("Reader Information"));
    groupBox->setLayout(gridLayout);

    okButton = new QPushButton(tr("&OK"));
    cancelButton = new QPushButton(tr("Cancel"));

    QHBoxLayout *bottomLayout = new QHBoxLayout;
    bottomLayout->addStretch();
    bottomLayout->addWidget(okButton);
    bottomLayout->addWidget(cancelButton);


    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(groupBox);
    mainLayout->addLayout(bottomLayout);

    setLayout(mainLayout);

    if (str.isEmpty())
    {
        connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
    }
    else
    {
        init();
        connect(okButton, SIGNAL(clicked()), this, SLOT(modifyClicked()));
    }
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    connect(queryButton, SIGNAL(clicked()), this, SLOT(queryClicked()));
}
Example #2
0
/**
 * Construct a new sound preferences pane. Initializes and populates all the
 * all the controls to the values obtained from SoundManager.
 */
DlgPrefSound::DlgPrefSound(QWidget* pParent, SoundManager* pSoundManager,
                           PlayerManager* pPlayerManager, UserSettingsPointer pConfig)
        : DlgPreferencePage(pParent),
          m_pSoundManager(pSoundManager),
          m_pPlayerManager(pPlayerManager),
          m_pConfig(pConfig),
          m_settingsModified(false),
          m_bLatencyChanged(false),
          m_bSkipConfigClear(true),
          m_loading(false) {
    setupUi(this);

    connect(m_pSoundManager, SIGNAL(devicesUpdated()),
            this, SLOT(refreshDevices()));

    apiComboBox->clear();
    apiComboBox->addItem(tr("None"), "None");
    updateAPIs();
    connect(apiComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(apiChanged(int)));

    sampleRateComboBox->clear();
    foreach (unsigned int srate, m_pSoundManager->getSampleRates()) {
        if (srate > 0) {
            // no ridiculous sample rate values. prohibiting zero means
            // avoiding a potential div-by-0 error in ::updateLatencies
            sampleRateComboBox->addItem(tr("%1 Hz").arg(srate), srate);
        }
    }
    connect(sampleRateComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(sampleRateChanged(int)));
    connect(sampleRateComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(updateAudioBufferSizes(int)));
    connect(audioBufferComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(audioBufferChanged(int)));

    deviceSyncComboBox->clear();
    deviceSyncComboBox->addItem(tr("Default (long delay)"));
    deviceSyncComboBox->addItem(tr("Experimental (no delay)"));
    deviceSyncComboBox->addItem(tr("Disabled (short delay)"));
    deviceSyncComboBox->setCurrentIndex(2);
    connect(deviceSyncComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(syncBuffersChanged(int)));

    engineClockComboBox->clear();
    engineClockComboBox->addItem(tr("Soundcard Clock"));
    engineClockComboBox->addItem(tr("Network Clock"));
    engineClockComboBox->setCurrentIndex(0);
    connect(engineClockComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(engineClockChanged(int)));

    keylockComboBox->clear();
    for (int i = 0; i < EngineBuffer::KEYLOCK_ENGINE_COUNT; ++i) {
        keylockComboBox->addItem(
                EngineBuffer::getKeylockEngineName(
                        static_cast<EngineBuffer::KeylockEngine>(i)));
    }

    m_pLatencyCompensation = new ControlProxy("[Master]", "microphoneLatencyCompensation", this);
    m_pMasterDelay = new ControlProxy("[Master]", "delay", this);
    m_pHeadDelay = new ControlProxy("[Master]", "headDelay", this);
    m_pBoothDelay = new ControlProxy("[Master]", "boothDelay", this);

    latencyCompensationSpinBox->setValue(m_pLatencyCompensation->get());
    latencyCompensationWarningLabel->setWordWrap(true);
    masterDelaySpinBox->setValue(m_pMasterDelay->get());
    headDelaySpinBox->setValue(m_pHeadDelay->get());
    boothDelaySpinBox->setValue(m_pBoothDelay->get());

    connect(latencyCompensationSpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(latencyCompensationSpinboxChanged(double)));
    connect(masterDelaySpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(masterDelaySpinboxChanged(double)));
    connect(headDelaySpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(headDelaySpinboxChanged(double)));
    connect(boothDelaySpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(boothDelaySpinboxChanged(double)));

    m_pMicMonitorMode = new ControlProxy("[Master]", "talkover_mix", this);
    micMonitorModeComboBox->addItem(tr("Master output only"),
        QVariant(static_cast<int>(EngineMaster::MicMonitorMode::MASTER)));
    micMonitorModeComboBox->addItem(tr("Master and booth outputs"),
        QVariant(static_cast<int>(EngineMaster::MicMonitorMode::MASTER_AND_BOOTH)));
    micMonitorModeComboBox->addItem(tr("Direct monitor (recording and broadcasting only)"),
        QVariant(static_cast<int>(EngineMaster::MicMonitorMode::DIRECT_MONITOR)));
    int modeIndex = micMonitorModeComboBox->findData(
        static_cast<int>(m_pMicMonitorMode->get()));
    micMonitorModeComboBox->setCurrentIndex(modeIndex);
    micMonitorModeComboBoxChanged(modeIndex);
    connect(micMonitorModeComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(micMonitorModeComboBoxChanged(int)));

    initializePaths();
    loadSettings();

    connect(apiComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(settingChanged()));
    connect(sampleRateComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(settingChanged()));
    connect(audioBufferComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(settingChanged()));
    connect(deviceSyncComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(settingChanged()));
    connect(engineClockComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(settingChanged()));
    connect(keylockComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(settingChanged()));

    connect(queryButton, SIGNAL(clicked()),
            this, SLOT(queryClicked()));

    connect(m_pSoundManager, SIGNAL(outputRegistered(AudioOutput, AudioSource*)),
            this, SLOT(addPath(AudioOutput)));
    connect(m_pSoundManager, SIGNAL(outputRegistered(AudioOutput, AudioSource*)),
            this, SLOT(loadSettings()));

    connect(m_pSoundManager, SIGNAL(inputRegistered(AudioInput, AudioDestination*)),
            this, SLOT(addPath(AudioInput)));
    connect(m_pSoundManager, SIGNAL(inputRegistered(AudioInput, AudioDestination*)),
            this, SLOT(loadSettings()));

    m_pMasterAudioLatencyOverloadCount =
            new ControlProxy("[Master]", "audio_latency_overload_count", this);
    m_pMasterAudioLatencyOverloadCount->connectValueChanged(this, &DlgPrefSound::bufferUnderflow);

    m_pMasterLatency = new ControlProxy("[Master]", "latency", this);
    m_pMasterLatency->connectValueChanged(this, &DlgPrefSound::masterLatencyChanged);

    // TODO: remove this option by automatically disabling/enabling the master mix
    // when recording, broadcasting, headphone, and master outputs are enabled/disabled
    m_pMasterEnabled = new ControlProxy("[Master]", "enabled", this);
    masterMixComboBox->addItem(tr("Disabled"));
    masterMixComboBox->addItem(tr("Enabled"));
    masterMixComboBox->setCurrentIndex(m_pMasterEnabled->get() ? 1 : 0);
    connect(masterMixComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(masterMixChanged(int)));
    m_pMasterEnabled->connectValueChanged(this, &DlgPrefSound::masterEnabledChanged);

    m_pMasterMonoMixdown = new ControlProxy("[Master]", "mono_mixdown", this);
    masterOutputModeComboBox->addItem(tr("Stereo"));
    masterOutputModeComboBox->addItem(tr("Mono"));
    masterOutputModeComboBox->setCurrentIndex(m_pMasterMonoMixdown->get() ? 1 : 0);
    connect(masterOutputModeComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(masterOutputModeComboBoxChanged(int)));
    m_pMasterMonoMixdown->connectValueChanged(this, &DlgPrefSound::masterMonoMixdownChanged);

    m_pKeylockEngine =
            new ControlProxy("[Master]", "keylock_engine", this);

#ifdef __LINUX__
    qDebug() << "RLimit Cur " << RLimit::getCurRtPrio();
    qDebug() << "RLimit Max " << RLimit::getMaxRtPrio();

    if (RLimit::isRtPrioAllowed()) {
        limitsHint->setText(tr("Realtime scheduling is enabled."));
    }
#else
    // the limits warning is a Linux only thing
    limitsHint->hide();
#endif // __LINUX__
}