예제 #1
0
KisDlgOptionsTIFF::KisDlgOptionsTIFF(QWidget *parent)
        : KDialog(parent), wdg(new QWidget)
{
    setWindowTitle(i18n("TIFF Export Options"));
    setButtons(KDialog::Ok | KDialog::Cancel);
    optionswdg = new Ui_KisWdgOptionsTIFF();
    optionswdg->setupUi(wdg);
    activated(0);
    connect(optionswdg->kComboBoxCompressionType, SIGNAL(activated(int)), this, SLOT(activated(int)));
    connect(optionswdg->flatten, SIGNAL(toggled(bool)), this, SLOT(flattenToggled(bool)));
    setMainWidget(wdg);
    qApp->restoreOverrideCursor();
    setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));

    QString filterConfig = KisConfig().exportConfiguration("TIFF");
    KisPropertiesConfiguration cfg;
    cfg.fromXML(filterConfig);

    optionswdg->kComboBoxCompressionType->setCurrentIndex(cfg.getInt("compressiontype", 0));
    activated(optionswdg->kComboBoxCompressionType->currentIndex());
    optionswdg->kComboBoxPredictor->setCurrentIndex(cfg.getInt("predictor", 0));
    optionswdg->alpha->setChecked(cfg.getBool("alpha", true));
    optionswdg->flatten->setChecked(cfg.getBool("flatten", true));
    flattenToggled(optionswdg->flatten->isChecked());
    optionswdg->qualityLevel->setValue(cfg.getInt("quality", 80));
    optionswdg->compressionLevelDeflate->setValue(cfg.getInt("deflate", 6));
    optionswdg->kComboBoxFaxMode->setCurrentIndex(cfg.getInt("faxmode", 0));
    optionswdg->compressionLevelPixarLog->setValue(cfg.getInt("pixarlog", 6));
}
void KisPropertiesConfigurationTest::testDefaultValues()
{
    KisPropertiesConfiguration* config = new KisPropertiesConfiguration();
    QVERIFY(config->getInt("bouh", v1) == v1);
    QVERIFY(config->getString("bouh", v2) == v2);
    QVERIFY(config->getDouble("bouh", v3) == v3);
    QVERIFY(config->getBool("bouh", v4) == v4);
    QVERIFY(config->getCubicCurve("bouh", v5) == v5);
    delete config;
}
void KisPropertiesConfigurationTest::testNotSavedValues()
{
    KisPropertiesConfiguration* config = createConfig();
    config->setPropertyNotSaved("v3");
    testConfig(config);
    QString s = config->toXML();
    delete config;
    config = new KisPropertiesConfiguration();
    config->fromXML(s);
    QVERIFY(config->getInt("v1", 0) == v1);
    QVERIFY(config->getString("v2", "") == v2);
    QVERIFY(config->hasProperty("v3") == false);
    QVERIFY(config->getBool("v4", !v4) == v4);
    QVERIFY(config->getCubicCurve("v5") == v5);
    delete config;   
}