|
From: Herton R. K. <he...@us...> - 2005-07-07 03:20:03
|
Update of /cvsroot/kimageprocess/kimageprocess/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22048/src Modified Files: kimageprocess.cpp kttextureoptions.cpp Log Message: - Added support to select different classifiers. - Cosmetics. - Remove some debug. - Fix warning (variable j not used). Index: kttextureoptions.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kttextureoptions.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- kttextureoptions.cpp 27 Jun 2005 19:51:04 -0000 1.7 +++ kttextureoptions.cpp 7 Jul 2005 03:19:54 -0000 1.8 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -39,19 +39,18 @@ #include <ktpluginmanager.h> #include <ktclassifbackend.h> - KTTextureOptions::KTTextureOptions( QWidget * parent, const char *name) : QFrame(parent, name) { QHBoxLayout *layout = new QHBoxLayout(this); layout->setAutoAdd(true); - + m_ui = new TextureOptionsUI(this); - + m_project = KTProject::self(); - + readConfig(); - + connect(m_ui->rbnRandom, SIGNAL(toggled(bool)), this, SLOT(enableIterations(bool))); connect(m_ui->rbnSame, SIGNAL(toggled(bool)), this, SLOT(enableWindowSliding(bool))); connect(m_ui->rbnSlideAll, SIGNAL(toggled(bool)), this, SLOT(enableSlideAll(bool))); @@ -64,7 +63,7 @@ void KTTextureOptions::readConfig() { window_size temp; - + switch (KTCalculation::self()->windowType()) { case WIN_SEQ: @@ -92,7 +91,7 @@ } m_ui->spbX->setValue(temp.width); m_ui->spbY->setValue(temp.height); - if (KTCalculation::self()->numberIterations() == 0) + if (KTCalculation::self()->numberIterations() == 0) { m_ui->rbnSlideAll->setChecked(true); m_ui->spbIterations->setDisabled(true); @@ -100,18 +99,30 @@ else m_ui->rbnSlideIterations->setChecked(true); m_ui->spbIterations->setValue(KTCalculation::self()->numberIterations()); - + //List methods and set the active one as selected MethodList methods = KTMethodManager::self()->methods(); - KTMethod *active = KTMethodManager::self()->activeMethod(); - QDictIterator<KTMethod> it(methods); - for (; it.current(); ++it) + KTMethod *activeMethod = KTMethodManager::self()->activeMethod(); + QDictIterator<KTMethod> itMethod(methods); + for (; itMethod.current(); ++itMethod) { - QString name = it.current()->methodName() + " - " + it.current()->longName(); + QString name = itMethod.current()->methodName() + " - " + itMethod.current()->longName(); m_ui->cmbMethod->insertItem(name); - if (it.current() == active) + if (itMethod.current() == activeMethod) m_ui->cmbMethod->setCurrentItem(m_ui->cmbMethod->count()-1); } + + //List classifiers and set the active one as selected + ClassifierList classifiers = KTPluginManager::self()->availableClassifiers(); + KTClassifBackend *activeClassifier = KTPluginManager::self()->classifier(); + QDictIterator<KTClassifBackend> itClassifier(classifiers); + for (; itClassifier.current(); ++itClassifier) + { + QString name = itClassifier.current()->classifierName(); + m_ui->cmbClassifier->insertItem(name); + if (itClassifier.current() == activeClassifier) + m_ui->cmbClassifier->setCurrentItem(m_ui->cmbClassifier->count()-1); + } } void KTTextureOptions::save() @@ -122,7 +133,7 @@ KTCalculation::self()->setWindowType(WIN_CASC); if (m_ui->rbnRandom->isChecked()) KTCalculation::self()->setWindowType(WIN_RAND); - + KTCalculation::self()->setWindowSize(m_ui->rbnCustom->isChecked(), m_ui->spbY->value(), m_ui->spbX->value()); if (m_ui->rbnSlideAll->isChecked()) KTCalculation::self()->setNumberIterations(0); @@ -131,24 +142,25 @@ QString method = m_ui->cmbMethod->currentText(); KTMethodManager::self()->setActiveMethod(method.remove(QRegExp(" - .*"))); + + QString classifier = m_ui->cmbClassifier->currentText(); + KTPluginManager::self()->setClassifier(classifier); } void KTTextureOptions::enableIterations(bool on) { - - if (on) + if (on) { m_ui->rbnSlideAll->setDisabled(true); m_ui->rbnSlideIterations->setChecked(true); } else m_ui->rbnSlideAll->setEnabled(true); - } void KTTextureOptions::enableWindowSliding(bool on) { - if (on) + if (on) { m_ui->qbgWindowType->setDisabled(true); m_ui->qbgNumberSliding->setDisabled(true); @@ -162,7 +174,6 @@ m_ui->spbX->setEnabled(true); m_ui->spbY->setEnabled(true); } - } void KTTextureOptions::enableSlideAll(bool on) Index: kimageprocess.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kimageprocess.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- kimageprocess.cpp 6 Jul 2005 01:34:43 -0000 1.27 +++ kimageprocess.cpp 7 Jul 2005 03:19:54 -0000 1.28 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -19,7 +19,6 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ - #include "kimageprocess.h" #include "ktfeaturechooser.h" #include "kttextureoptions.h" @@ -75,21 +74,21 @@ QVBoxLayout *layout = new QVBoxLayout(this); layout->setAutoAdd( true ); - + /*********************** Interface Stuff *************************************/ QSplitter *splitter = new QSplitter(QSplitter::Horizontal,this); - + splitter->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding, true); // create our sidebar m_sideBar = new KTSideBar(splitter); m_sideBar->sizePolicy().setHorStretch( 1 ); - + m_view = new KImageProcessView(splitter); m_view->sizePolicy().setHorStretch( 4 ); m_view->sizePolicy().setHorData(QSizePolicy::Expanding); - + m_progressBar = new KTProgressBar(); - + // accept dnd setAcceptDrops(true); @@ -100,42 +99,42 @@ setupActions(); KConfig cfg("kimageprocessrc"); - + m_recentFiles->loadEntries(&cfg); - + // apply the saved mainwindow settings, if any, and ask the mainwindow // to automatically save settings if changed: window size, toolbar // position, icon size, etc. setAutoSaveSettings(); - + KTImageManager *imgmng = KTImageManager::self(); connect(imgmng, SIGNAL(trPatternAdded(KTImage* )), m_sideBar, SLOT(slotSampleAdded(KTImage* ))); - + connect(imgmng, SIGNAL(aboutToRemoveTrPattern(KTImage* )), m_sideBar, SLOT(slotAboutToRemoveSample(KTImage* ))); - + connect(imgmng, SIGNAL(testingImageAdded(KTImage* )), m_sideBar, SLOT(slotTestImageAdded(KTImage* ))); - + connect(imgmng, SIGNAL(aboutToRemoveTestingImage(KTImage* )), m_sideBar, SLOT(slotAboutToRemoveTestImage(KTImage* ))); - + connect(m_sideBar, SIGNAL(showImage(KTImage* )), m_view, SLOT(showImage(KTImage* ))); - + KTFeatureManager *featmng = KTFeatureManager::self(); KTProject *prj = KTProject::self(); - + connect(prj, SIGNAL(aboutToLoad(QDomElement*)), featmng, SLOT(slotLoad(QDomElement*))); connect(prj, SIGNAL(aboutToSave(QDomDocument*, QDomElement*)), featmng, SLOT(slotSave(QDomDocument*, QDomElement*))); - + //load all plugins KTPluginManager::self()->loadPlugins(); - + KTMethodManager::self()->loadMethods(); KTFeatureManager::self()->loadFeatures(); |