void PortAudioHelper::loadDevices() {
    DEVICE_COUNT = Pa_GetDeviceCount();
    DEFAULT_INPUT_DEVICE = Pa_GetDefaultInputDevice();
    DEFAULT_OUTPUT_DEVICE = Pa_GetDefaultOutputDevice();
    for (PaDeviceIndex i=0; i<DEVICE_COUNT; i++) {
        AudioDeviceInfo deviceInfo;
        deviceInfo.deviceInfo = *Pa_GetDeviceInfo(i);
        deviceInfo.supportedSampleRates = getSupportedSampleRate(i);
        DEVICES.append(deviceInfo);
    }

    CURRENT_INPUT_DEVICE = loadFromSettings(keyDefaultInputDevice, DEFAULT_INPUT_DEVICE).toInt();
    CURRENT_OUTPUT_DEVICE = loadFromSettings(keyDefaultOutputDevice, DEFAULT_OUTPUT_DEVICE).toInt();
}
Example #2
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
#if QT_VERSION >= 0x040500
    , m_cacheEnabled(false)
#endif
{
    setupUi(this);
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
    connect(languageButton, SIGNAL(clicked()), this, SLOT(chooseAcceptLanguage()));

#if QT_VERSION < 0x040500
    oneCloseButton->setVisible(false); // no other mode than one close button with qt <4.5
    networkCache->setVisible(false);
#else
    // As network cache has too many bugs in 4.5.1, do not allow to enable it.
    if (QLatin1String(qVersion()) == QLatin1String("4.5.1"))
        networkCache->setVisible(false);
#endif
    loadDefaults();
    loadFromSettings();
}
SettingsDialog_Skeleton_Extraction::SettingsDialog_Skeleton_Extraction(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);

    loadDefaults();
    loadFromSettings();
}
SettingsDialog_Hole_Filling_Fill::SettingsDialog_Hole_Filling_Fill(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);

    loadDefaults();
    loadFromSettings();
}
SettingsDialog_Hole_Filling_Position_Crossing_Point::SettingsDialog_Hole_Filling_Position_Crossing_Point(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);

    loadDefaults();
    loadFromSettings();
}
SettingsDialog_Various_Processing_Noise::SettingsDialog_Various_Processing_Noise(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);

    loadDefaults();
    loadFromSettings();
}
Example #7
0
bool loadFromSettings(QSettings& settingsObj, const QString &name, QMargins &margins)
{
    int value;
    if (loadFromSettings(settingsObj, name + "/left", value) == false)
        return false;
    margins.setLeft(value);
    if (loadFromSettings(settingsObj, name + "/top", value) == false)
        return false;
    margins.setTop(value);
    if (loadFromSettings(settingsObj, name + "/right", value) == false)
        return false;
    margins.setRight(value);
    if (loadFromSettings(settingsObj, name + "/bottom", value) == false)
        return false;
    margins.setBottom(value);

    return true;
}
Example #8
0
SettingsDialogJCW::SettingsDialogJCW(QWidget *parent, QString &saveLocation)
    : QDialog(parent), saveLocation_(saveLocation)
{
    setupUi(this);

	connect(pushButtonBrowse, SIGNAL(clicked()), this, SLOT(setFilename()));

    loadDefaults();
    loadFromSettings();
}
Example #9
0
OAuth::OAuth() :
        QObject()
{
    // TODO Auto-generated constructor stub
    loadFromSettings();
    qDebug() << "[OAuth] << access_token: " << accessToken();
    qDebug() << "[OAuth] << refresh_token: " << refreshToken();
    qDebug() << "[OAuth] << expire_datetime: " << expireDateTime();
    m_running = false;
}
Example #10
0
void OAuth::unlink()
{
    settingsSaveAccessToken("");
    settingsSaveRefreshToken("");
    settingsSaveUsername("");
    settingsSaveExpiresDateTime(0);
    loadFromSettings(); // to reload all

    setIsLinked(false);
    setAccountUsername("");
}
Example #11
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(restoreToDefaultButton, SIGNAL(clicked()), this, SLOT(restoreHomeToDefault()));
    connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
	connect(comboBoxStyle, SIGNAL(currentIndexChanged(int)), this,   SLOT(setAppStyle(int)));
    connect(showPasswordsButton, SIGNAL(clicked()), this, SLOT(showPasswords()));
    connect(chkUserAgent, SIGNAL(stateChanged ( int ) ), this, SLOT(useUserAgent(int)));
    connect(buttonSearchProviders, SIGNAL(clicked() ), this, SLOT( showSearchProviders() ) );
    connect(buttonEditShortcuts, SIGNAL(clicked() ), this, SLOT( editShortcuts() ) );
    connect(btnExtView, SIGNAL(clicked() ), this, SLOT( chooseExtViewer() ) );
    connect(btnStylePath, SIGNAL(clicked() ), this, SLOT( chooseStylePath() ) );

    connect(proxyAuto, SIGNAL(stateChanged ( int ) ), this, SLOT(setAutoProxy(int)));
    connect(proxySupport, SIGNAL(toggled( bool ) ), this, SLOT(setProxyEnabled(bool)));

	connect(btnAddAd, SIGNAL(clicked() ), this, SLOT( addBlockAd() ) );
	connect(btnEditAd, SIGNAL(clicked() ), this, SLOT( editBlockAd() ) );
	connect(btnDelAd, SIGNAL(clicked() ), this, SLOT( removeBlockAd() ) );
	connect(btnDelAds, SIGNAL(clicked() ), this, SLOT( removeBlockAds() ) );

	connect(btnBlockMostAds, SIGNAL(clicked() ), this, SLOT( blockMostAds() ) );
	connect(btnBlockMostCnts, SIGNAL(clicked() ), this, SLOT( blockMostCnts() ) );

	connect(btnAddAdEx, SIGNAL(clicked() ), this, SLOT( addBlockAdEx() ) );
	connect(btnEditAdEx, SIGNAL(clicked() ), this, SLOT( editBlockAdEx() ) );
	connect(btnDelAdEx, SIGNAL(clicked() ), this, SLOT( removeBlockAdEx() ) );

    loadDefaults();
    loadFromSettings();
	
	fontChanged = false;
	connect(tbGoBack, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbGoForward, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbAddBook, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbHome, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbRefresh, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbAppStyle, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbPrivMode, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbPrefs, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbImages, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbProxy, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbCompatibility, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbReset, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbInspect, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbBookmarks, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbTextSize, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbVirtKeyb, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
}
Example #12
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));

    loadDefaults();
    loadFromSettings();
}
void PortAudioHelper::updateDevice() {
    SAMPLE_RATE = loadFromSettings(keyDefaultSampleRate, DEFAULT_SAMPLERATE).toInt();
    CURRENT_INPUT_DEVICE = loadFromSettings(keyDefaultInputDevice, DEFAULT_INPUT_DEVICE).toInt();
    CURRENT_OUTPUT_DEVICE = loadFromSettings(keyDefaultOutputDevice, DEFAULT_OUTPUT_DEVICE).toInt();
    FRAMES_PER_BUFFER = DEFAULT_BUFFER_TIME * SAMPLE_RATE;

    inputParameters.device = CURRENT_INPUT_DEVICE;
    inputParameters.channelCount = DEFAULT_CHANNEL_COUNT;
    inputParameters.sampleFormat = paFloat32;
    inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency;
    inputParameters.hostApiSpecificStreamInfo = NULL;

    // Lets open audio input device
    err = Pa_OpenStream(&stream, &inputParameters, NULL, SAMPLE_RATE, FRAMES_PER_BUFFER, paClipOff, apiCallback, &data);
    if( err != paNoError ) {
        qDebug() << ("Error: No acces to input device.\n");
        _supported = false;
    } else {
        _supported = true;
    }
}
Example #14
0
SettingsDialog::SettingsDialog(Settings *settings, QWidget *parent) :
	QDialog(parent),
	Ui::SettingsDialog(),
	settings(settings),
	ftp_connect(0),
	ftp_login(0),
	ftp_close(0),
	ftp_upload(0),
	ftp_remove(0),
	ftp_remove_old_test(0),
	ftp(NULL) {
	Ui::SettingsDialog::setupUi(this);
	loadFromSettings();
    setupUi();
	connect(ftp_test_connection_button, SIGNAL(clicked()), SLOT(testFtpConnection()));
}
Example #15
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
    connect(languageButton, SIGNAL(clicked()), this, SLOT(chooseAcceptLanguage()));

#if QT_VERSION < 0x040500
    oneCloseButton->setVisible(false); // no other mode than one close button with qt <4.5
#endif
    loadDefaults();
    loadFromSettings();
}
Example #16
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
    , m_cacheEnabled(false)
{
    setupUi(this);
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
    connect(languageButton, SIGNAL(clicked()), this, SLOT(chooseAcceptLanguage()));
    connect(downloadDirectoryButton, SIGNAL(clicked()), this, SLOT(chooseDownloadDirectory()));

    // As network cache has too many bugs in 4.5.1, do not allow to enable it.
    if (QLatin1String(qVersion()) == QLatin1String("4.5.1"))
        networkCache->setVisible(false);

    loadDefaults();
    loadFromSettings();
}
Example #17
0
FeatureClassDlg::FeatureClassDlg(QWidget* pParent) :
    QDialog(pParent)
{
    // Classes
    QLabel* pClassLabel = new QLabel("Feature Classes:", this);

    QToolButton* pAddFeatureButton = new QToolButton(this);
    pAddFeatureButton->setAutoRaise(true);
    pAddFeatureButton->setIcon(QIcon(":/icons/New"));
    pAddFeatureButton->setToolTip("Add Feature");

    QToolButton* pRemoveFeatureButton = new QToolButton(this);
    pRemoveFeatureButton->setAutoRaise(true);
    pRemoveFeatureButton->setIcon(QIcon(":/icons/Delete"));
    pRemoveFeatureButton->setToolTip("Remove Feature");

    mpClassList = new QListWidget(this);
    mpClassList->setFixedWidth(150);
    mpClassList->setSelectionMode(QAbstractItemView::SingleSelection);
    mpClassList->setSortingEnabled(true);
    mpClassList->sortItems(Qt::AscendingOrder);

    // Fields
    QLabel* pFieldLabel = new QLabel("Fields:", this);

    QToolButton* pAddFieldButton = new QToolButton(this);
    pAddFieldButton->setAutoRaise(true);
    pAddFieldButton->setIcon(QIcon(":/icons/New"));
    pAddFieldButton->setToolTip("Add Field");

    QToolButton* pRemoveFieldButton = new QToolButton(this);
    pRemoveFieldButton->setAutoRaise(true);
    pRemoveFieldButton->setIcon(QIcon(":/icons/Delete"));
    pRemoveFieldButton->setToolTip("Remove Field");

    QStringList columnNames;
    columnNames.append("Name");
    columnNames.append("Type");
    columnNames.append("Default Value");

    mpFieldTree = new QTreeWidget(this);
    mpFieldTree->setColumnCount(3);
    mpFieldTree->setHeaderLabels(columnNames);
    mpFieldTree->setSelectionMode(QAbstractItemView::SingleSelection);
    mpFieldTree->setRootIsDecorated(false);
    mpFieldTree->setAllColumnsShowFocus(true);
    mpFieldTree->setSortingEnabled(true);
    mpFieldTree->sortByColumn(0, Qt::AscendingOrder);
    mpFieldTree->setItemDelegateForColumn(0, new FieldNameDelegate(mpFieldTree));
    mpFieldTree->setItemDelegateForColumn(1, new FieldTypeDelegate(mpFieldTree));
    mpFieldTree->setItemDelegateForColumn(2, new FieldValueDelegate(mpFieldTree));

    QHeaderView* pHeader = mpFieldTree->header();
    if (pHeader != NULL)
    {
        pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
        pHeader->setStretchLastSection(false);
        pHeader->setSortIndicatorShown(true);
    }

    // Horizontal line
    QFrame* pLine = new QFrame(this);
    pLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);

    // Dialog buttons
    QDialogButtonBox* pButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
            Qt::Horizontal, this);

    // Layout
    QHBoxLayout* pFeatureButtonLayout = new QHBoxLayout();
    pFeatureButtonLayout->setMargin(0);
    pFeatureButtonLayout->setSpacing(0);
    pFeatureButtonLayout->addWidget(pClassLabel);
    pFeatureButtonLayout->addSpacing(10);
    pFeatureButtonLayout->addStretch();
    pFeatureButtonLayout->addWidget(pAddFeatureButton);
    pFeatureButtonLayout->addWidget(pRemoveFeatureButton);

    QVBoxLayout* pFeatureClassLayout = new QVBoxLayout();
    pFeatureClassLayout->setMargin(0);
    pFeatureClassLayout->setSpacing(2);
    pFeatureClassLayout->addLayout(pFeatureButtonLayout);
    pFeatureClassLayout->addWidget(mpClassList, 10);

    QHBoxLayout* pFieldButtonLayout = new QHBoxLayout();
    pFieldButtonLayout->setMargin(0);
    pFieldButtonLayout->setSpacing(0);
    pFieldButtonLayout->addWidget(pFieldLabel);
    pFieldButtonLayout->addSpacing(10);
    pFieldButtonLayout->addStretch();
    pFieldButtonLayout->addWidget(pAddFieldButton);
    pFieldButtonLayout->addWidget(pRemoveFieldButton);

    QVBoxLayout* pFieldLayout = new QVBoxLayout();
    pFieldLayout->setMargin(0);
    pFieldLayout->setSpacing(2);
    pFieldLayout->addLayout(pFieldButtonLayout);
    pFieldLayout->addWidget(mpFieldTree, 10);

    QGridLayout* pLayout = new QGridLayout(this);
    pLayout->setMargin(10);
    pLayout->setSpacing(10);
    pLayout->addLayout(pFeatureClassLayout, 0, 0);
    pLayout->addLayout(pFieldLayout, 0, 1);
    pLayout->addWidget(pLine, 1, 0, 1, 2);
    pLayout->addWidget(pButtonBox, 2, 0, 1, 2);
    pLayout->setRowStretch(0, 10);
    pLayout->setColumnStretch(1, 10);

    // Initialization
    setWindowTitle("Feature Classes");
    resize(550, 300);
    loadFromSettings();
    updateFields();

    // Connections
    VERIFYNR(connect(pAddFeatureButton, SIGNAL(clicked()), this, SLOT(addFeatureClass())));
    VERIFYNR(connect(pRemoveFeatureButton, SIGNAL(clicked()), this, SLOT(removeFeatureClass())));
    VERIFYNR(connect(mpClassList, SIGNAL(itemChanged(QListWidgetItem*)), this,
                     SLOT(setFeatureClassData(QListWidgetItem*))));
    VERIFYNR(connect(mpClassList, SIGNAL(itemSelectionChanged()), this, SLOT(updateFields())));
    VERIFYNR(connect(pAddFieldButton, SIGNAL(clicked()), this, SLOT(addField())));
    VERIFYNR(connect(pRemoveFieldButton, SIGNAL(clicked()), this, SLOT(removeField())));
    VERIFYNR(connect(mpFieldTree, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this,
                     SLOT(setFieldData(QTreeWidgetItem*, int))));
    VERIFYNR(connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())));
    VERIFYNR(connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())));
}