Ejemplo n.º 1
0
Column::Private::Private(Column * owner, SciDAVis::ColumnDataType type, SciDAVis::ColumnMode mode,
                         void * data, IntervalAttribute<bool> validity)
    : d_owner(owner)
{
    d_data_type = type;
    d_column_mode = mode;
    d_data = data;
    d_validity = validity;

    switch(mode)
    {
    case SciDAVis::Numeric:
        d_input_filter = new String2DoubleFilter();
        d_output_filter = new Double2StringFilter();
#ifdef LEGACY_CODE_0_2_x  // TODO: in a later version this must use the new global setting method
        {
#ifdef Q_OS_MAC // Mac
            QSettings settings(QSettings::IniFormat,QSettings::UserScope, "SciDAVis", "SciDAVis");
#else
            QSettings settings(QSettings::NativeFormat,QSettings::UserScope, "SciDAVis", "SciDAVis");
#endif
            settings.beginGroup("/General");
            static_cast<Double2StringFilter *>(d_output_filter)->setNumDigits(settings.value("/DecimalDigits", 14).toInt());
            static_cast<Double2StringFilter *>(d_output_filter)->setNumericFormat(settings.value("/DefaultNumericFormat", 'f').toChar().toAscii());
        }
#endif
        connect(static_cast<Double2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    case SciDAVis::Text:
        d_input_filter = new SimpleCopyThroughFilter();
        d_output_filter = new SimpleCopyThroughFilter();
        break;
    case SciDAVis::DateTime:
        d_input_filter = new String2DateTimeFilter();
        d_output_filter = new DateTime2StringFilter();
        connect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    case SciDAVis::Month:
        d_input_filter = new String2MonthFilter();
        d_output_filter = new DateTime2StringFilter();
        static_cast<DateTime2StringFilter *>(d_output_filter)->setFormat("MMMM");
        connect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    case SciDAVis::Day:
        d_input_filter = new String2DayOfWeekFilter();
        d_output_filter = new DateTime2StringFilter();
        static_cast<DateTime2StringFilter *>(d_output_filter)->setFormat("dddd");
        connect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    } // switch(mode)

    d_plot_designation = SciDAVis::noDesignation;
    d_input_filter->setName("InputFilter");
    d_output_filter->setName("OutputFilter");
}
Ejemplo n.º 2
0
void Column::Private::replaceModeData(SciDAVis::ColumnMode mode, SciDAVis::ColumnDataType type, void * data,
                                      AbstractSimpleFilter * in_filter, AbstractSimpleFilter * out_filter, IntervalAttribute<bool> validity)
{
    emit d_owner->modeAboutToChange(d_owner);
    // disconnect formatChanged()
    switch(d_column_mode)
    {
    case SciDAVis::Numeric:
        disconnect(static_cast<Double2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                   d_owner, SLOT(notifyDisplayChange()));
        break;
    case SciDAVis::DateTime:
    case SciDAVis::Month:
    case SciDAVis::Day:
        disconnect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                   d_owner, SLOT(notifyDisplayChange()));
        break;
    }

    d_column_mode = mode;
    d_data_type = type;
    d_data = data;

    in_filter->setName("InputFilter");
    out_filter->setName("OutputFilter");
    d_input_filter = in_filter;
    d_output_filter = out_filter;
    d_input_filter->input(0, d_owner->d_string_io);
    d_output_filter->input(0, d_owner);

    // connect formatChanged()
    switch(d_column_mode)
    {
    case SciDAVis::Numeric:
        connect(static_cast<Double2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    case SciDAVis::DateTime:
    case SciDAVis::Month:
    case SciDAVis::Day:
        connect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    }

    d_validity = validity;
    emit d_owner->modeChanged(d_owner);
}
void ConfigBackendsPage::resetDefaults()
{
    // TODO reset rippers

    int i = 0;
    foreach( QCheckBox *checkBox, filterCheckBoxes )
    {
        const QString filterPluginName = config->data.backends.filters.at(i);

        checkBox->setChecked( i == 0 );

        i++;
    }

    const int answer = KMessageBox::questionYesNo( this, i18n("This will choose the best backends for all formats and save the new preferences immediately.\n\nDo you want to continue?") );

    if( answer == KMessageBox::Yes )
    {
        QList<CodecOptimizations::Optimization> optimizationList = config->getOptimizations( true );
        for( int i=0; i<optimizationList.count(); i++ )
        {
            optimizationList[i].solution = CodecOptimizations::Optimization::Fix;
        }
        config->doOptimizations( optimizationList );

        formatChanged( cSelectorFormat->currentText(), true );

        emit configChanged( false );
    }
}
Ejemplo n.º 4
0
void ViBuffer::setFormat(ViAudioFormat format)
{
	QMutexLocker locker(&mMutex);
	mFormat = format;
	locker.unlock();
	emit formatChanged(mFormat);
}
Ejemplo n.º 5
0
void OptionsDetailed::init()
{
    updateProfiles();

    cFormat->setCurrentIndex( 0 );
    formatChanged( cFormat->currentText() );
}
Ejemplo n.º 6
0
void Variable::setFormat(Variable::format_t format)
{
    if (m_format != format) {
        m_format = format;
        formatChanged();
    }
}
Ejemplo n.º 7
0
PrintDialog::PrintDialog(QWidget *parent, capture_file *cf) :
    QDialog(parent),
    pd_ui_(new Ui::PrintDialog),
    cur_printer_(NULL),
    cur_painter_(NULL),
    preview_(new QPrintPreviewWidget(&printer_)),
    print_bt_(new QPushButton(tr("&Print..."))),
    cap_file_(cf)
{
    if (!cf) done(QDialog::Rejected); // ...or assert?

    pd_ui_->setupUi(this);

    pd_ui_->previewLayout->insertWidget(0, preview_, Qt::AlignTop);

    preview_->setMinimumWidth(preview_->height() / 2);
    preview_->setToolTip(pd_ui_->zoomLabel->toolTip());

    // XXX Make these configurable
    header_font_.setFamily("Times");
    header_font_.setPointSizeF(header_font_.pointSizeF() * 0.8);
    packet_font_ = wsApp->monospaceFont();
    packet_font_.setPointSizeF(packet_font_.pointSizeF() * 0.8);

    memset(&print_args_, 0, sizeof(print_args_));
    memset(&stream_ops_, 0, sizeof(stream_ops_));

    /* Init the export range */
    packet_range_init(&print_args_.range, cap_file_);
    /* Default to displayed packets */
    print_args_.range.process_filtered = TRUE;

    stream_ops_.print_preamble = print_preamble_pd;
    stream_ops_.print_line     = print_line_pd;
    stream_ops_.new_page       = new_page_pd;

    stream_.data = this;
    stream_.ops = &stream_ops_;
    print_args_.stream = &stream_;

    gchar *display_basename = g_filename_display_basename(cap_file_->filename);
    printer_.setDocName(display_basename);
    g_free(display_basename);

    pd_ui_->rangeGroupBox->initRange(&print_args_.range);

    pd_ui_->buttonBox->addButton(print_bt_, QDialogButtonBox::ActionRole);
    pd_ui_->buttonBox->addButton(tr("Page &Setup..."), QDialogButtonBox::ResetRole);
    print_bt_->setDefault(true);

    connect(preview_, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paintPreview(QPrinter*)));
    connect(pd_ui_->rangeGroupBox, SIGNAL(rangeChanged()),
            this, SLOT(checkValidity()));
    connect(pd_ui_->formatGroupBox, SIGNAL(formatChanged()),
            this, SLOT(checkValidity()));
    connect(pd_ui_->formFeedCheckBox, SIGNAL(toggled(bool)),
            preview_, SLOT(updatePreview()));

    checkValidity();
}
Ejemplo n.º 8
0
void PacketFormatGroupBox::on_detailsCheckBox_toggled(bool checked)
{
    pf_ui_->allCollapsedButton->setEnabled(checked);
    pf_ui_->asDisplayedButton->setEnabled(checked);
    pf_ui_->allExpandedButton->setEnabled(checked);
    emit formatChanged();
}
toResultListFormat::toResultListFormat(QWidget *parent, DialogType type, const char *name)
        : QDialog(parent)
{

    setupUi(this);
    setModal(true);
    formatCombo->addItem(tr("Text"));
    formatCombo->addItem(tr("Tab delimited"));
    formatCombo->addItem(tr("CSV"));
    formatCombo->addItem(tr("HTML"));
    formatCombo->addItem(tr("SQL"));

    int num = toConfigurationSingle::Instance().defaultFormat();
    formatCombo->setCurrentIndex(num);
    formatChanged(num);

    delimiterEdit->setText(toConfigurationSingle::Instance().csvDelimiter());
    separatorEdit->setText(toConfigurationSingle::Instance().csvSeparator());

    selectedRowsRadio->setChecked(type == TypeCopy);
    selectedColumnsRadio->setChecked(type == TypeCopy);

    allRowsRadio->setChecked(type == TypeExport);
    allColumnsRadio->setChecked(type == TypeExport);
}
Ejemplo n.º 10
0
void QDateTimeAxis::setFormat(QString format)
{
    Q_D(QDateTimeAxis);
    if (d->m_format != format) {
        d->m_format = format;
        emit formatChanged(format);
    }
}
Ejemplo n.º 11
0
void QRealProperty::setFormat(const QString & format)
{
    if (_format != format)
    {
        _format = format;
        emit formatChanged();
    }
}
Ejemplo n.º 12
0
void OptionsDetailed::setCurrentFormat( const QString& format )
{
    if( !format.isEmpty() && format != cFormat->currentText() )
    {
        cFormat->setCurrentIndex( cFormat->findText(format) );
        formatChanged( cFormat->currentText() );
    }
}
Ejemplo n.º 13
0
void CLSValueEditor::setFormat(const QChar &newFormat)
{
	if (format_ != newFormat && validFormat(newFormat)) {
		format_ = newFormat;
		updateValueLabel();

		emit formatChanged(format_);
	}
}
Ejemplo n.º 14
0
void TimeSeriesMotion::setFormat(Format format)
{
    if (m_format != format) {
        m_format = format;
        emit formatChanged(format);

        setIsLoaded(false);
    }
}
Ejemplo n.º 15
0
ContextPaneTextWidget::ContextPaneTextWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ContextPaneTextWidget),
    m_fontSizeTimer(-1)
{
    ui->setupUi(this);
    ui->boldButton->setIcon(QIcon::fromTheme(QLatin1String("format-text-bold"),
            QIcon(QLatin1String(":/qmldesigner/images/bold-h-icon.png"))));
    ui->italicButton->setIcon(QIcon::fromTheme(QLatin1String("format-text-italic"),
            QIcon(QLatin1String(":/qmldesigner/images/italic-h-icon.png"))));
    ui->underlineButton->setIcon(QIcon::fromTheme(QLatin1String("format-text-underline"),
            QIcon(QLatin1String(":/qmldesigner/images/underline-h-icon.png"))));
    ui->strikeoutButton->setIcon(QIcon::fromTheme(QLatin1String("format-text-strikethrough"),
            QIcon(QLatin1String(":/qmldesigner/images/strikeout-h-icon.png"))));

    ui->leftAlignmentButton->setIcon(QIcon::fromTheme(QLatin1String("format-justify-left"),
            QIcon(QLatin1String(":/qmldesigner/images/alignmentleft-h-icon.png"))));
    ui->centerHAlignmentButton->setIcon(QIcon::fromTheme(QLatin1String("format-justify-center"),
            QIcon(QLatin1String(":/qmldesigner/images/alignmentcenterh-h-icon.png"))));
    ui->rightAlignmentButton->setIcon(QIcon::fromTheme(QLatin1String("format-justify-right"),
            QIcon(QLatin1String(":/qmldesigner/images/alignmentright-h-icon.png"))));

    ui->centerVAlignmentButton->setIcon(QIcon(QLatin1String(":/qmldesigner/images/alignmentmiddle-h-icon.png")));

    ui->bottomAlignmentButton->setIcon(QIcon(QLatin1String(":/qmldesigner/images/alignmentbottom-h-icon.png")));
    ui->topAlignmentButton->setIcon(QIcon(QLatin1String(":/qmldesigner/images/alignmenttop-h-icon.png")));

    ui->colorButton->setShowArrow(false);
    ui->textColorButton->setShowArrow(false);

    connect(ui->colorButton, SIGNAL(toggled(bool)), this, SLOT(onColorButtonToggled(bool)));
    connect(ui->textColorButton, SIGNAL(toggled(bool)), this, SLOT(onTextColorButtonToggled(bool)));

    ContextPaneWidget *parentContextWidget = qobject_cast<ContextPaneWidget*>(parentWidget());
    connect(parentContextWidget->colorDialog(), SIGNAL(accepted(QColor)), this, SLOT(onColorDialogApplied(QColor)));
    connect(parentContextWidget->colorDialog(), SIGNAL(rejected()), this, SLOT(onColorDialogCancled()));

    connect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onFontSizeChanged(int)));
    connect(ui->fontSizeSpinBox, SIGNAL(formatChanged()), this, SLOT(onFontFormatChanged()));

    connect(ui->boldButton, SIGNAL(toggled(bool)), this, SLOT(onBoldCheckedChanged(bool)));
    connect(ui->italicButton, SIGNAL(toggled(bool)), this, SLOT(onItalicCheckedChanged(bool)));
    connect(ui->underlineButton, SIGNAL(toggled(bool)), this, SLOT(onUnderlineCheckedChanged(bool)));
    connect(ui->strikeoutButton, SIGNAL(toggled(bool)), this, SLOT(onStrikeoutCheckedChanged(bool)));
    connect(ui->fontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(onCurrentFontChanged(QFont)));

    connect(ui->centerHAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged()));
    connect(ui->leftAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged()));
    connect(ui->rightAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged()));

    connect(ui->centerVAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged()));
    connect(ui->topAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged()));
    connect(ui->bottomAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged()));

    connect(ui->styleComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onStyleComboBoxChanged(QString)));
}
Ejemplo n.º 16
0
bool OptionsDetailed::setCurrentConversionOptions( const ConversionOptions *conversionOptions )
{
    if( !conversionOptions )
        return false;

    cFormat->setCurrentIndex( cFormat->findText(conversionOptions->codecName) );
    formatChanged( cFormat->currentText() );
    if( conversionOptions->codecName != "wav" )
    {
        cPlugin->setCurrentIndex( cPlugin->findText(conversionOptions->pluginName) );
        encoderChanged( cPlugin->currentText() );
    }
    outputDirectory->setMode( (OutputDirectory::Mode)conversionOptions->outputDirectoryMode );
    outputDirectory->setDirectory( conversionOptions->outputDirectory );
    cReplayGain->setChecked( conversionOptions->replaygain );

    bool succeeded = true;

    if( conversionOptions->codecName == "wav" )
        succeeded = true;
    else if( wPlugin )
        succeeded = wPlugin->setCurrentConversionOptions( conversionOptions );
    else
        succeeded = false;

    QStringList usedFilter;
    foreach( const FilterOptions *filterOptions, conversionOptions->filterOptions )
    {
        bool filterSucceeded = false;
        for( int i=0; i<wFilter.size(); i++ )
        {
            FilterWidget *widget = wFilter.keys().at(i);
            FilterPlugin *plugin = wFilter.values().at(i);
            if( widget && plugin && filterOptions->pluginName == plugin->name() )
            {
                filterSucceeded = widget->setCurrentFilterOptions( filterOptions );
                usedFilter.append( filterOptions->pluginName );
                break;
            }
        }
        if( !filterSucceeded )
            succeeded = false;
    }
    // if a filter is disabled, its FilterOptions is 0 thus it won't be added to ConversionOptions, but we need to update the widget so it won't show false data
    for( int i=0; i<wFilter.size(); i++ )
    {
        FilterWidget *widget = wFilter.keys().at(i);
        FilterPlugin *plugin = wFilter.values().at(i);
        if( widget && plugin && !usedFilter.contains(plugin->name()) )
        {
            widget->setCurrentFilterOptions( 0 );
        }
    }

    return succeeded;
}
Ejemplo n.º 17
0
void VideoDecoderVDA::setFormat(PixelFormat fmt)
{
    DPTR_D(VideoDecoderVDA);
    if (d.out_fmt == fmt)
        return;
    d.out_fmt = fmt;
    emit formatChanged();
    if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7)
        return;
    if (fmt != YUV420P && fmt != UYVY)
        qWarning("format is not supported on OSX < 10.7");
}
/*!
    Construct an QAudioDecoder instance
    parented to \a parent.
*/
QAudioDecoder::QAudioDecoder(QObject *parent)
    : QMediaObject(*new QAudioDecoderPrivate,
                   parent,
                   QMediaServiceProvider::defaultServiceProvider()->requestService(Q_MEDIASERVICE_AUDIODECODER))
{
    Q_D(QAudioDecoder);

    d->provider = QMediaServiceProvider::defaultServiceProvider();
    if (d->service) {
        d->control = qobject_cast<QAudioDecoderControl*>(d->service->requestControl(QAudioDecoderControl_iid));
        if (d->control != 0) {
            connect(d->control, SIGNAL(stateChanged(QAudioDecoder::State)), SLOT(_q_stateChanged(QAudioDecoder::State)));
            connect(d->control, SIGNAL(error(int,QString)), SLOT(_q_error(int,QString)));

            connect(d->control, SIGNAL(formatChanged(QAudioFormat)), SIGNAL(formatChanged(QAudioFormat)));
            connect(d->control, SIGNAL(sourceChanged()), SIGNAL(sourceChanged()));
            connect(d->control, SIGNAL(bufferReady()), this, SIGNAL(bufferReady()));
            connect(d->control ,SIGNAL(bufferAvailableChanged(bool)), this, SIGNAL(bufferAvailableChanged(bool)));
            connect(d->control ,SIGNAL(finished()), this, SIGNAL(finished()));
            connect(d->control ,SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged(qint64)));
            connect(d->control ,SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged(qint64)));
        }
void ConfigBackendsPage::showOptimizations()
{
    QList<CodecOptimizations::Optimization> optimizationList = config->getOptimizations( true );
    if( !optimizationList.isEmpty() )
    {
        CodecOptimizations *optimizationsDialog = new CodecOptimizations( optimizationList, this );
        connect( optimizationsDialog, SIGNAL(solutions(const QList<CodecOptimizations::Optimization>&)), config, SLOT(doOptimizations(const QList<CodecOptimizations::Optimization>&)) );
        optimizationsDialog->exec();
    }
    else
    {
        KMessageBox::information( this, i18n("All backend settings seem to be optimal, there is nothing to do.") );
    }

    formatChanged( cSelectorFormat->currentText(), true );
}
Ejemplo n.º 20
0
TimestampWidget::TimestampWidget(TimeStamp *ntransform, QWidget *parent) :
    QWidget(parent)
{
    ui = new(std::nothrow) Ui::TimestampWidget();
    if (ui == NULL) {
        qFatal("Cannot allocate memory for Ui::TimestampWidget X{");
    }
    transform = ntransform;
    ui->setupUi(this);

    ui->formatLineEdit->setText(transform->getDateFormat());
    ui->formatLineEdit->setReadOnly(true);
    if (transform->getTZ() == TimeStamp::TZ_UTC) {
        ui->tzUTCRadioButton->setChecked(true);
    } else {
        ui->tzLocalRadioButton->setChecked(true);
    }
    connect(ui->formatLineEdit, SIGNAL(textChanged(QString)), this, SLOT(formatChanged(QString)));
    connect(ui->tzLocalRadioButton, SIGNAL(toggled(bool)), this, SLOT(outBoundTZLocalChanged(bool)));

}
Ejemplo n.º 21
0
void PacketFormatGroupBox::on_asDisplayedButton_toggled(bool checked)
{
    if (checked) emit formatChanged();
}
Ejemplo n.º 22
0
        mpFormat->addItem(fmt);
    }
    int idx = mpFormat->findText(Config::instance().captureFormat());
    mpFormat->setCurrentIndex(idx);
    mpQuality = new Slider();
    formLayout->addRow(tr("Quality"), mpQuality);
    mpQuality->setRange(0, 100);
    mpQuality->setOrientation(Qt::Horizontal);
    mpQuality->setValue(Config::instance().captureQuality());
    mpQuality->setSingleStep(1);
    mpQuality->setTickInterval(10);
    mpQuality->setTickPosition(QSlider::TicksBelow);

    connect(&Config::instance(), SIGNAL(captureDirChanged(QString)), mpDir, SLOT(setText(QString)));
    connect(&Config::instance(), SIGNAL(captureQualityChanged(int)), mpQuality, SLOT(setValue(int)));
    connect(&Config::instance(), SIGNAL(captureFormatChanged(QString)), SLOT(formatChanged(QString)));
    connect(mpDir, SIGNAL(textChanged(QString)), SLOT(changeDirByUi(QString)));
    connect(mpFormat, SIGNAL(currentIndexChanged(QString)), SLOT(changeFormatByUi(QString)));
    connect(mpQuality, SIGNAL(valueChanged(int)), SLOT(changeQualityByUi(int)));
}

void CaptureConfigPage::apply()
{
    Config::instance().setCaptureDir(mpDir->text())
            .setCaptureFormat(mpFormat->currentText().toUtf8())
            .setCaptureQuality(mpQuality->value());
}

QString CaptureConfigPage::name() const
{
    return tr("Capture");
ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *cap_file, export_type_e export_type):
    QFileDialog(parent),
    export_type_(export_type),
    cap_file_(cap_file)
  #if !defined(Q_OS_WIN)
    , save_bt_(NULL)
 #endif /* Q_OS_WIN */
{
#if !defined(Q_OS_WIN)
    QDialogButtonBox *button_box = findChild<QDialogButtonBox *>();
    QGridLayout *fd_grid = qobject_cast<QGridLayout*>(layout());
    QHBoxLayout *h_box = new QHBoxLayout();
    QStringList name_filters;
    int last_row;

    setWindowTitle(tr("Wireshark: Export Packet Dissections"));
    setAcceptMode(QFileDialog::AcceptSave);
    setLabelText(FileType, tr("Export as:"));

    // export_type_map_keys() sorts alphabetically. We don't want that.
    name_filters
            << tr("Plain text (*.txt)")
            << tr("Comma Separated Values - summary (*.csv)")
            << tr("PSML - summary (*.psml, *.xml)")
            << tr("PDML - details (*.pdml, *.xml)")
            << tr("C Arrays - bytes (*.c, *.h)");
    export_type_map_[name_filters[0]] = export_type_text;
    export_type_map_[name_filters[1]] = export_type_csv;
    export_type_map_[name_filters[2]] = export_type_psml;
    export_type_map_[name_filters[3]] = export_type_pdml;
    export_type_map_[name_filters[4]] = export_type_carrays;
    setNameFilters(name_filters);
    selectNameFilter(export_type_map_.key(export_type));
    exportTypeChanged(export_type_map_.key(export_type));

    last_row = fd_grid->rowCount();
    fd_grid->addItem(new QSpacerItem(1, 1), last_row, 0);
    fd_grid->addLayout(h_box, last_row, 1);

    /* Init the export range */
    packet_range_init(&print_args_.range, cap_file_);
    /* Default to displayed packets */
    print_args_.range.process_filtered = TRUE;

    packet_range_group_box_.initRange(&print_args_.range);
    h_box->addWidget(&packet_range_group_box_);

    h_box->addWidget(&packet_format_group_box_, 0, Qt::AlignTop);

    if (button_box) {
        button_box->addButton(QDialogButtonBox::Help);
        connect(button_box, SIGNAL(helpRequested()), this, SLOT(on_buttonBox_helpRequested()));

        save_bt_ = button_box->button(QDialogButtonBox::Save);
    }

    if (save_bt_) {
        connect(&packet_range_group_box_, SIGNAL(validityChanged(bool)),
                this, SLOT(checkValidity()));
        connect(&packet_format_group_box_, SIGNAL(formatChanged()),
                this, SLOT(checkValidity()));
    }
    connect(this, SIGNAL(filterSelected(QString)), this, SLOT(exportTypeChanged(QString)));

    // Grow the dialog to account for the extra widgets.
    resize(width(), height() + (packet_range_group_box_.height() * 2 / 3));

#else // Q_OS_WIN
#endif // Q_OS_WIN
}
Ejemplo n.º 24
0
        mpFormat->addItem(fmt);
    }
    int idx = mpFormat->findText(Config::instance().captureFormat());
    mpFormat->setCurrentIndex(idx);
    mpQuality = new Slider();
    formLayout->addRow(tr("Quality"), mpQuality);
    mpQuality->setRange(0, 100);
    mpQuality->setOrientation(Qt::Horizontal);
    mpQuality->setValue(Config::instance().captureQuality());
    mpQuality->setSingleStep(1);
    mpQuality->setTickInterval(10);
    mpQuality->setTickPosition(QSlider::TicksBelow);

    connect(&Config::instance(), SIGNAL(captureDirChanged(QString)), mpDir, SLOT(setText(QString)));
    connect(&Config::instance(), SIGNAL(captureQualityChanged(int)), mpQuality, SLOT(setValue(int)));
    connect(&Config::instance(), SIGNAL(captureFormatChanged(QByteArray)), SLOT(formatChanged(QByteArray)));
    connect(mpDir, SIGNAL(textChanged(QString)), SLOT(changeDirByUi(QString)));
    connect(mpFormat, SIGNAL(currentIndexChanged(QString)), SLOT(changeFormatByUi(QString)));
    connect(mpQuality, SIGNAL(valueChanged(int)), SLOT(changeQualityByUi(int)));
}

void CaptureConfigPage::apply()
{
    Config::instance().captureDir(mpDir->text())
            .captureFormat(mpFormat->currentText().toUtf8())
            .captureQuality(mpQuality->value());
}

QString CaptureConfigPage::name() const
{
    return tr("Capture");
Ejemplo n.º 25
0
void
GuiAppInstance::load(const CLArgs& cl,
                     bool makeEmptyInstance)
{
    if (getAppID() == 0) {
        appPTR->setLoadingStatus( QObject::tr("Creating user interface...") );
    }

    try {
        declareCurrentAppVariable_Python();
    } catch (const std::exception& e) {
        std::cerr << e.what() << std::endl;
    }

    _imp->_gui = new Gui(this);
    _imp->_gui->createGui();

    printAutoDeclaredVariable(_imp->declareAppAndParamsString);

    ///if the app is interactive, build the plugins toolbuttons from the groups we extracted off the plugins.
    const std::list<boost::shared_ptr<PluginGroupNode> > & _toolButtons = appPTR->getTopLevelPluginsToolButtons();
    for (std::list<boost::shared_ptr<PluginGroupNode>  >::const_iterator it = _toolButtons.begin(); it != _toolButtons.end(); ++it) {
        _imp->findOrCreateToolButtonRecursive(*it);
    }
    _imp->_gui->sortAllPluginsToolButtons();

    Q_EMIT pluginsPopulated();

    ///show the gui
    _imp->_gui->show();


    boost::shared_ptr<Settings> nSettings = appPTR->getCurrentSettings();
    QObject::connect( getProject().get(), SIGNAL(formatChanged(Format)), this, SLOT(projectFormatChanged(Format)) );

    {
        QSettings settings( QString::fromUtf8(NATRON_ORGANIZATION_NAME), QString::fromUtf8(NATRON_APPLICATION_NAME) );
        if ( !settings.contains( QString::fromUtf8("checkForUpdates") ) ) {
            StandardButtonEnum reply = Dialogs::questionDialog(tr("Updates").toStdString(),
                                                               tr("Do you want " NATRON_APPLICATION_NAME " to check for updates "
                                                                  "on launch of the application ?").toStdString(), false);
            bool checkForUpdates = reply == eStandardButtonYes;
            nSettings->setCheckUpdatesEnabled(checkForUpdates);
        }

        if ( nSettings->isCheckForUpdatesEnabled() ) {
            appPTR->setLoadingStatus( tr("Checking if updates are available...") );
            checkForNewVersion();
        }
    }

    if ( nSettings->isDefaultAppearanceOutdated() ) {
        StandardButtonEnum reply = Dialogs::questionDialog(tr("Appearance").toStdString(),
                                                           tr(NATRON_APPLICATION_NAME " default appearance changed since last version.\n"
                                                              "Would you like to set the new default appearance?").toStdString(), false);
        if (reply == eStandardButtonYes) {
            nSettings->restoreDefaultAppearance();
        }
    }

    /// Create auto-save dir if it does not exists
    QDir dir = Project::autoSavesDir();
    dir.mkpath( QString::fromUtf8(".") );


    if (getAppID() == 0) {
        appPTR->getCurrentSettings()->doOCIOStartupCheckIfNeeded();

        if ( !appPTR->isShorcutVersionUpToDate() ) {
            StandardButtonEnum reply = questionDialog(tr("Shortcuts").toStdString(),
                                                      tr("Default shortcuts for " NATRON_APPLICATION_NAME " have changed, "
                                                         "would you like to set them to their defaults ? "
                                                         "Clicking no will keep the old shortcuts hence if a new shortcut has been "
                                                         "set to something else than an empty shortcut you won't benefit of it.").toStdString(),
                                                      false,
                                                      StandardButtons(eStandardButtonYes | eStandardButtonNo),
                                                      eStandardButtonNo);
            if (reply == eStandardButtonYes) {
                appPTR->restoreDefaultShortcuts();
            }
        }
    }

    if (makeEmptyInstance) {
        return;
    }

    /// If this is the first instance of the software, try to load an autosave
    if ( (getAppID() == 0) && cl.getScriptFilename().isEmpty() ) {
        if ( findAndTryLoadUntitledAutoSave() ) {
            ///if we successfully loaded an autosave ignore the specified project in the launch args.
            return;
        }
    }


    QFileInfo info( cl.getScriptFilename() );

    if ( cl.getScriptFilename().isEmpty() || !info.exists() ) {
        getProject()->createViewer();
        execOnProjectCreatedCallback();

        const QString& imageFile = cl.getImageFilename();
        if ( !imageFile.isEmpty() ) {
            handleFileOpenEvent( imageFile.toStdString() );
        }
    } else {
        if ( info.suffix() == QString::fromUtf8("py") ) {
            appPTR->setLoadingStatus( tr("Loading script: ") + cl.getScriptFilename() );

            ///If this is a Python script, execute it
            loadPythonScript(info);
            execOnProjectCreatedCallback();
        } else if ( info.suffix() == QString::fromUtf8(NATRON_PROJECT_FILE_EXT) ) {
            ///Otherwise just load the project specified.
            QString name = info.fileName();
            QString path = info.path();
            Global::ensureLastPathSeparator(path);
            appPTR->setLoadingStatus(tr("Loading project: ") + path + name);
            getProject()->loadProject(path, name);
            ///remove any file open event that might have occured
            appPTR->setFileToOpen( QString() );
        } else {
            Dialogs::errorDialog( tr("Invalid file").toStdString(),
                                  tr(NATRON_APPLICATION_NAME " only accepts python scripts or .ntp project files").toStdString() );
            execOnProjectCreatedCallback();
        }
    }

    const QString& extraOnProjectCreatedScript = cl.getDefaultOnProjectLoadedScript();
    if ( !extraOnProjectCreatedScript.isEmpty() ) {
        QFileInfo cbInfo(extraOnProjectCreatedScript);
        if ( cbInfo.exists() ) {
            loadPythonScript(cbInfo);
        }
    }
} // load
Ejemplo n.º 26
0
void ViCodingChain::run()
{
	//////////////////////////////////////////////////////////////////////////////////////////////
	//
	// Initialize
	//
	//////////////////////////////////////////////////////////////////////////////////////////////

	emit progressed(0);

	if(mMode == ViCodingChain::Unknown)
	{
		return;
	}

	if(mMode != ViCodingChain::EncodeFile && mMode != ViCodingChain::EncodeData)
	{
		(this->*detectCoder)();
		if(mInputCoder == NULL)
		{
			ViCoder::Error error = ViAudioManager::error();
			if(error == ViCoder::UnsupportedCodecError)
			{
				setError(ViCoder::UnsupportedInputCodecError);
			}
			else if(error == ViCoder::UnavailableCodecError)
			{
				setError(ViCoder::UnavailableInputCodecError);
			}
			else
			{
				setError(error);
			}
			return;
		}
		else
		{
			QObject::connect(mInputCoder, SIGNAL(failed(ViCoder::Error)), this, SLOT(setError(ViCoder::Error)), Qt::DirectConnection);
		}
	}
	if(mError != ViCoder::NoError) return;

	if(mMode != ViCodingChain::DecodeFile && mMode != ViCodingChain::DecodeData)
	{
		mOutputCoder = ViAudioManager::coder(mOutputFormat);
		if(mOutputCoder == NULL)
		{
			ViCoder::Error error = ViAudioManager::error();
			if(error == ViCoder::UnsupportedCodecError)
			{
				setError(ViCoder::UnsupportedOutputCodecError);
			}
			else if(error == ViCoder::UnavailableCodecError)
			{
				setError(ViCoder::UnavailableOutputCodecError);
			}
			else
			{
				setError(error);
			}
			return;
		}
		else
		{
			mOutputCoder->setMetadata(mMetadata);
			QObject::connect(mOutputCoder, SIGNAL(failed(ViCoder::Error)), this, SLOT(setError(ViCoder::Error)), Qt::DirectConnection);
		}
	}
	if(mError != ViCoder::NoError) return;

	//////////////////////////////////////////////////////////////////////////////////////////////
	//
	// Initialize mode
	//
	//////////////////////////////////////////////////////////////////////////////////////////////

	mInput->disconnect();
	mDecoder.disconnect();
	mEncoder.disconnect();
	mOutput->disconnect();
	QObject::connect(mInput, SIGNAL(failed(ViCoder::Error)), this, SLOT(setError(ViCoder::Error)), Qt::DirectConnection);
	QObject::connect(&mDecoder, SIGNAL(failed(ViCoder::Error)), this, SLOT(setError(ViCoder::Error)), Qt::DirectConnection);
	QObject::connect(&mEncoder, SIGNAL(failed(ViCoder::Error)), this, SLOT(setError(ViCoder::Error)), Qt::DirectConnection);
	QObject::connect(mOutput, SIGNAL(failed(ViCoder::Error)), this, SLOT(setError(ViCoder::Error)), Qt::DirectConnection);

	if(mMode == ViCodingChain::ConvertFileToFile || mMode == ViCodingChain::ConvertFileToData || mMode == ViCodingChain::ConvertDataToFile || mMode == ViCodingChain::ConvertDataToData)
	{
		mInput->setNext(&mDecoder);
		mDecoder.setNext(&mEncoder);
		mEncoder.setNext(mOutput);
		mOutputCoder->setFormat(ViAudio::AudioOutput, mOutputFormat);
		if(mMode == ViCodingChain::ConvertDataToFile || mMode == ViCodingChain::ConvertDataToData)
		{
			mInputCoder->setFormat(ViAudio::AudioInput, mInputFormat);
		}
	}
	else if(mMode == ViCodingChain::DecodeFile || mMode == ViCodingChain::DecodeData)
	{
		mInput->setNext(&mDecoder);
		mDecoder.setNext(mOutput);
		if(mMode == ViCodingChain::DecodeData)
		{
			mInputCoder->setFormat(ViAudio::AudioInput, mInputFormat);
		}
	}
	else if(mMode == ViCodingChain::EncodeFile || mMode == ViCodingChain::EncodeData)
	{
		mInput->setNext(&mEncoder);
		mEncoder.setNext(mOutput);
		mOutputCoder->setFormat(ViAudio::AudioOutput, mOutputFormat);
	}

	mInput->setOffsets(mFromOffset, mToOffset);
	mInput->initialize();
	if(mError != ViCoder::NoError) return;

	mOutput->initialize();
	if(mError != ViCoder::NoError) return;
	if(mMode != ViCodingChain::EncodeFile && mMode != ViCodingChain::EncodeData)
	{
		mDecoder.setCoder(mInputCoder);
		QObject::connect(mInputCoder, SIGNAL(formatChanged(ViAudioFormat)), this, SIGNAL(formatChanged(ViAudioFormat)), Qt::UniqueConnection);
		mInputCoder->load();
		if(mError != ViCoder::NoError) return;
		mDecoder.initialize();
		if(mError != ViCoder::NoError) return;
	}
	if(mMode != ViCodingChain::DecodeFile && mMode != ViCodingChain::DecodeData)
	{
		mEncoder.setCoder(mOutputCoder);
		mOutputCoder->load();
		if(mError != ViCoder::NoError) return;
		mEncoder.initialize();
		if(mError != ViCoder::NoError) return;
		if(mMode == ViCodingChain::EncodeFile || mMode == ViCodingChain::EncodeData)
		{
			mOutputCoder->setFormat(ViAudio::AudioInput, mInputFormat);
			mInput->setSampleSize(mInputFormat.sampleSize());
			mEncoder.changeFormat(mInputFormat);
		}
	}

	//////////////////////////////////////////////////////////////////////////////////////////////
	//
	// Execute
	//
	//////////////////////////////////////////////////////////////////////////////////////////////

	qreal progressedData = 0;
	qint64 totalSize = mInput->size();
	static qint32 chunkSize = mInput->chunkSize();
	qreal progress = 0;

	while(mInput->hasData() && mError == ViCoder::NoError)
	{
		mInput->execute();
		progressedData += chunkSize;
		progress = progressedData / totalSize * 99; // * 99 to first finalize everything before 100% is emitted
		emit progressed(progress);
	}

	//////////////////////////////////////////////////////////////////////////////////////////////
	//
	// Finalize
	//
	//////////////////////////////////////////////////////////////////////////////////////////////

	mInput->finalize();
	if(mError != ViCoder::NoError) return;
	if(mMode != ViCodingChain::EncodeFile && mMode != ViCodingChain::EncodeData)
	{
		if(mMode == ViCodingChain::DecodeFile || mMode == ViCodingChain::DecodeData)
		{
			mInputFormat = mInputCoder->format(ViAudio::AudioInput);
		}
		mDecoder.finalize();
		if(mError != ViCoder::NoError) return;
	}
	if(mMode != ViCodingChain::DecodeFile && mMode != ViCodingChain::DecodeData)
	{
		mEncoder.finalize();
		if(mError != ViCoder::NoError) return;
	}
	mOutput->finalize();

	if(mInputCoder != NULL)
	{
		mInputCoder->unload();
	}
	if(mOutputCoder != NULL)
	{
		mOutputCoder->unload();
	}

	progress = 100;
	emit progressed(progress);
}
Ejemplo n.º 27
0
Column::Private::Private(Column * owner, SciDAVis::ColumnMode mode)
    : d_owner(owner)
{
    Q_ASSERT(owner != 0); // a Column::Private without owner is not allowed
    // because the owner must become the parent aspect of the input and output filters
    d_column_mode = mode;
    switch(mode)
    {
    case SciDAVis::Numeric:
        d_input_filter = new String2DoubleFilter();
        d_output_filter = new Double2StringFilter();
#ifdef LEGACY_CODE_0_2_x  // TODO: in a later version this must use the new global setting method
        {
#ifdef Q_OS_MAC // Mac
            QSettings settings(QSettings::IniFormat,QSettings::UserScope, "SciDAVis", "SciDAVis");
#else
            QSettings settings(QSettings::NativeFormat,QSettings::UserScope, "SciDAVis", "SciDAVis");
#endif
            settings.beginGroup("/General");
            static_cast<Double2StringFilter *>(d_output_filter)->setNumDigits(settings.value("/DecimalDigits", 14).toInt());
            static_cast<Double2StringFilter *>(d_output_filter)->setNumericFormat(settings.value("/DefaultNumericFormat", 'f').toChar().toAscii());
        }
#endif
        connect(static_cast<Double2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        d_data_type = SciDAVis::TypeDouble;
        d_data = new QVector<double>();
        break;
    case SciDAVis::Text:
        d_input_filter = new SimpleCopyThroughFilter();
        d_output_filter = new SimpleCopyThroughFilter();
        d_data_type = SciDAVis::TypeQString;
        d_data = new QStringList();
        break;
    case SciDAVis::DateTime:
        d_input_filter = new String2DateTimeFilter();
        d_output_filter = new DateTime2StringFilter();
        connect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        d_data_type = SciDAVis::TypeQDateTime;
        d_data = new QList<QDateTime>();
        break;
    case SciDAVis::Month:
        d_input_filter = new String2MonthFilter();
        d_output_filter = new DateTime2StringFilter();
        static_cast<DateTime2StringFilter *>(d_output_filter)->setFormat("MMMM");
        connect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        d_data_type = SciDAVis::TypeQDateTime;
        d_data = new QList<QDateTime>();
        break;
    case SciDAVis::Day:
        d_input_filter = new String2DayOfWeekFilter();
        d_output_filter = new DateTime2StringFilter();
        static_cast<DateTime2StringFilter *>(d_output_filter)->setFormat("dddd");
        connect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        d_data_type = SciDAVis::TypeQDateTime;
        d_data = new QList<QDateTime>();
        break;
    } // switch(mode)

    d_plot_designation = SciDAVis::noDesignation;
    d_input_filter->setName("InputFilter");
    d_output_filter->setName("OutputFilter");
}
Ejemplo n.º 28
0
void PacketFormatGroupBox::on_bytesCheckBox_toggled(bool checked)
{
    Q_UNUSED(checked);
    emit formatChanged();
}
Ejemplo n.º 29
0
void Column::Private::setColumnMode(SciDAVis::ColumnMode mode, AbstractFilter *filter)
{
    if (mode == d_column_mode) return;

    void * old_data = d_data;
    // remark: the deletion of the old data will be done in the dtor of a command

    AbstractSimpleFilter *new_in_filter, *new_out_filter;
    bool filter_is_temporary; // it can also become outputFilter(), which we may not delete here
    Column* temp_col = 0;
    if (filter)
        filter_is_temporary = false;

    emit d_owner->modeAboutToChange(d_owner);

    // determine the conversion filter and allocate the new data vector
    switch(d_column_mode)
    {
    case SciDAVis::Numeric:
        disconnect(static_cast<Double2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                   d_owner, SLOT(notifyDisplayChange()));
        switch(mode)
        {
        case SciDAVis::Numeric:
            break;
        case SciDAVis::Text:
            if (!filter) {
                filter = outputFilter();
                filter_is_temporary = false;
            }
            temp_col = new Column("temp_col", *(static_cast< QVector<qreal>* >(old_data)), d_validity);
            d_data = new QStringList();
            d_data_type = SciDAVis::TypeQString;
            break;
        case SciDAVis::DateTime:
            if (!filter) {
                filter = new Double2DateTimeFilter();
                filter_is_temporary = true;
            }
            temp_col = new Column("temp_col", *(static_cast< QVector<qreal>* >(old_data)), d_validity);
            d_data = new QList<QDateTime>();
            d_data_type = SciDAVis::TypeQDateTime;
            break;
        case SciDAVis::Month:
            if (!filter) {
                filter = new Double2MonthFilter();
                filter_is_temporary = true;
            }
            temp_col = new Column("temp_col", *(static_cast< QVector<qreal>* >(old_data)), d_validity);
            d_data = new QList<QDateTime>();
            d_data_type = SciDAVis::TypeQDateTime;
            break;
        case SciDAVis::Day:
            if (!filter) {
                filter = new Double2DayOfWeekFilter();
                filter_is_temporary = true;
            }
            temp_col = new Column("temp_col", *(static_cast< QVector<qreal>* >(old_data)), d_validity);
            d_data = new QList<QDateTime>();
            d_data_type = SciDAVis::TypeQDateTime;
            break;
        } // switch(mode)
        break;

    case SciDAVis::Text:
        switch(mode)
        {
        case SciDAVis::Text:
            break;
        case SciDAVis::Numeric:
            if (!filter) {
                filter = new String2DoubleFilter();
                filter_is_temporary = true;
            }
            temp_col = new Column("temp_col", *(static_cast< QStringList* >(old_data)), d_validity);
            d_data = new QVector<double>();
            d_data_type = SciDAVis::TypeDouble;
            break;
        case SciDAVis::DateTime:
            if (!filter) {
                filter = new String2DateTimeFilter();
                filter_is_temporary = true;
            }
            temp_col = new Column("temp_col", *(static_cast< QStringList* >(old_data)), d_validity);
            d_data = new QList<QDateTime>();
            d_data_type = SciDAVis::TypeQDateTime;
            break;
        case SciDAVis::Month:
            if (!filter) {
                filter = new String2MonthFilter();
                filter_is_temporary = true;
            }
            temp_col = new Column("temp_col", *(static_cast< QStringList* >(old_data)), d_validity);
            d_data = new QList<QDateTime>();
            d_data_type = SciDAVis::TypeQDateTime;
            break;
        case SciDAVis::Day:
            if (!filter) {
                filter = new String2DayOfWeekFilter();
                filter_is_temporary = true;
            }
            temp_col = new Column("temp_col", *(static_cast< QStringList* >(old_data)), d_validity);
            d_data = new QList<QDateTime>();
            d_data_type = SciDAVis::TypeQDateTime;
            break;
        } // switch(mode)
        break;

    case SciDAVis::DateTime:
    case SciDAVis::Month:
    case SciDAVis::Day:
        disconnect(static_cast<DateTime2StringFilter *>(d_output_filter), SIGNAL(formatChanged()),
                   d_owner, SLOT(notifyDisplayChange()));
        switch(mode)
        {
        case SciDAVis::DateTime:
            break;
        case SciDAVis::Text:
            if (!filter) {
                filter = outputFilter();
                filter_is_temporary = false;
            }
            temp_col = new Column("temp_col", *(static_cast< QList<QDateTime>* >(old_data)), d_validity);
            d_data = new QStringList();
            d_data_type = SciDAVis::TypeQString;
            break;
        case SciDAVis::Numeric:
            if (!filter) {
                if (d_column_mode == SciDAVis::Month)
                    filter = new Month2DoubleFilter();
                else if (d_column_mode == SciDAVis::Day)
                    filter = new DayOfWeek2DoubleFilter();
                else
                    filter = new DateTime2DoubleFilter();
                filter_is_temporary = true;
            }
            temp_col = new Column("temp_col", *(static_cast< QList<QDateTime>* >(old_data)), d_validity);
            d_data = new QVector<double>();
            d_data_type = SciDAVis::TypeDouble;
            break;
        case SciDAVis::Month:
        case SciDAVis::Day:
            break;
        } // switch(mode)
        break;

    }

    // determine the new input and output filters
    switch(mode)
    {
    case SciDAVis::Numeric:
        new_in_filter = new String2DoubleFilter();
        new_out_filter = new Double2StringFilter();
#ifdef LEGACY_CODE_0_2_x  // TODO: in a later version this must use the new global setting method
        {
#ifdef Q_OS_MAC // Mac
            QSettings settings(QSettings::IniFormat,QSettings::UserScope, "SciDAVis", "SciDAVis");
#else
            QSettings settings(QSettings::NativeFormat,QSettings::UserScope, "SciDAVis", "SciDAVis");
#endif
            settings.beginGroup("/General");
            static_cast<Double2StringFilter *>(new_out_filter)->setNumDigits(settings.value("/DecimalDigits", 14).toInt());
            static_cast<Double2StringFilter *>(new_out_filter)->setNumericFormat(settings.value("/DefaultNumericFormat", 'f').toChar().toAscii());
        }
#endif
        connect(static_cast<Double2StringFilter *>(new_out_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    case SciDAVis::Text:
        new_in_filter = new SimpleCopyThroughFilter();
        new_out_filter = new SimpleCopyThroughFilter();
        break;
    case SciDAVis::DateTime:
        new_in_filter = new String2DateTimeFilter();
        new_out_filter = new DateTime2StringFilter();
        connect(static_cast<DateTime2StringFilter *>(new_out_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    case SciDAVis::Month:
        new_in_filter = new String2MonthFilter();
        new_out_filter = new DateTime2StringFilter();
        static_cast<DateTime2StringFilter *>(new_out_filter)->setFormat("MMMM");
        connect(static_cast<DateTime2StringFilter *>(new_out_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    case SciDAVis::Day:
        new_in_filter = new String2DayOfWeekFilter();
        new_out_filter = new DateTime2StringFilter();
        static_cast<DateTime2StringFilter *>(new_out_filter)->setFormat("dddd");
        connect(static_cast<DateTime2StringFilter *>(new_out_filter), SIGNAL(formatChanged()),
                d_owner, SLOT(notifyDisplayChange()));
        break;
    } // switch(mode)

    d_column_mode = mode;

    new_in_filter->setName("InputFilter");
    new_out_filter->setName("OutputFilter");
    d_input_filter = new_in_filter;
    d_output_filter = new_out_filter;
    d_input_filter->input(0, d_owner->d_string_io);
    d_output_filter->input(0, d_owner);

    if (temp_col) // if temp_col == 0, only the input/output filters need to be changed
    {
        // copy the filtered, i.e. converted, column
        filter->input(0, temp_col);
        copy(filter->output(0));
        delete temp_col;

        if (filter_is_temporary) delete filter;
    }

    emit d_owner->modeChanged(d_owner);
}
Ejemplo n.º 30
0
void PacketFormatGroupBox::on_allCollapsedButton_toggled(bool checked)
{
    if (checked) emit formatChanged();
}