|
From: Gustavo P. B. <gb...@us...> - 2005-06-23 03:19:26
|
Update of /cvsroot/kimageprocess/kimageprocess/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17877/src Modified Files: kimageprocess.cpp kimageprocess.h kttextureoptions.cpp kttextureoptions.h pref.cpp pref.h Log Message: All managers classes now use self() (global instance), which is much better than being passing pointers all around Index: kttextureoptions.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kttextureoptions.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- kttextureoptions.h 10 Dec 2004 23:30:51 -0000 1.1.1.1 +++ kttextureoptions.h 23 Jun 2005 03:18:47 -0000 1.2 @@ -35,7 +35,7 @@ { Q_OBJECT public: - KTTextureOptions(QWidget *parent, KTProject *project, const char *name = 0); + KTTextureOptions(QWidget *parent, const char *name = 0); ~KTTextureOptions(); Index: pref.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/pref.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pref.cpp 18 Mar 2005 20:33:46 -0000 1.6 +++ pref.cpp 23 Jun 2005 03:18:47 -0000 1.7 @@ -32,7 +32,7 @@ #include <qlayout.h> #include <qlabel.h> -KImageProcessPreferences::KImageProcessPreferences(KTProject *project) +KImageProcessPreferences::KImageProcessPreferences() : KDialogBase(IconList, i18n("Preferences"), Ok|Apply|Cancel, Ok) { @@ -52,7 +52,7 @@ frame = addPage(i18n("Texture Options"), i18n("Texture Options")); layout = new QHBoxLayout(frame); layout->setAutoAdd(true); - m_textureOptions = new KTTextureOptions(frame,project); + m_textureOptions = new KTTextureOptions(frame); } Index: kttextureoptions.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kttextureoptions.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- kttextureoptions.cpp 31 Mar 2005 23:56:42 -0000 1.3 +++ kttextureoptions.cpp 23 Jun 2005 03:18:47 -0000 1.4 @@ -38,7 +38,7 @@ #include <ktmethod.h> -KTTextureOptions::KTTextureOptions( QWidget * parent, KTProject * project, const char *name) +KTTextureOptions::KTTextureOptions( QWidget * parent, const char *name) : QFrame(parent, name) { QHBoxLayout *layout = new QHBoxLayout(this); @@ -46,7 +46,7 @@ m_ui = new TextureOptionsUI(this); - m_project = project; + m_project = KTProject::self(); readConfig(); @@ -63,7 +63,7 @@ { window_size temp; - switch (m_project->patternManager()->windowType()) + switch (KTImageManager::self()->windowType()) { case WIN_SEQ: m_ui->rbnSequential->setChecked(true); @@ -77,7 +77,7 @@ m_ui->rbnSlideIterations->setChecked(true); break; } - temp = m_project->patternManager()->windowSize(); + temp = KTImageManager::self()->windowSize(); if (temp.type) m_ui->rbnCustom->setChecked(true); else @@ -90,14 +90,14 @@ } m_ui->spbX->setValue(temp.width); m_ui->spbY->setValue(temp.height); - if (m_project->patternManager()->numberIterations() == 0) + if (KTImageManager::self()->numberIterations() == 0) { m_ui->rbnSlideAll->setChecked(true); m_ui->spbIterations->setDisabled(true); } else m_ui->rbnSlideIterations->setChecked(true); - m_ui->spbIterations->setValue(m_project->patternManager()->numberIterations()); + m_ui->spbIterations->setValue(KTImageManager::self()->numberIterations()); //List methods and set the active one as selected MethodList methods = KTMethodManager::self()->methods(); @@ -115,16 +115,17 @@ void KTTextureOptions::save() { if (m_ui->rbnSequential->isChecked()) - m_project->patternManager()->setWindowType(WIN_SEQ); + KTImageManager::self()->setWindowType(WIN_SEQ); if (m_ui->rbnCascaded->isChecked()) - m_project->patternManager()->setWindowType(WIN_CASC); + KTImageManager::self()->setWindowType(WIN_CASC); if (m_ui->rbnRandom->isChecked()) - m_project->patternManager()->setWindowType(WIN_RAND); - m_project->patternManager()->setWindowSize(m_ui->rbnCustom->isChecked(), m_ui->spbY->value(), m_ui->spbX->value()); + KTImageManager::self()->setWindowType(WIN_RAND); + + KTImageManager::self()->setWindowSize(m_ui->rbnCustom->isChecked(), m_ui->spbY->value(), m_ui->spbX->value()); if (m_ui->rbnSlideAll->isChecked()) - m_project->patternManager()->setNumberIterations(0); + KTImageManager::self()->setNumberIterations(0); else - m_project->patternManager()->setNumberIterations(m_ui->spbIterations->value()); + KTImageManager::self()->setNumberIterations(m_ui->spbIterations->value()); QString method = m_ui->cmbMethod->currentText(); KTMethodManager::self()->setActiveMethod(method.remove(QRegExp(" - .*"))); Index: pref.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/pref.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pref.h 18 Mar 2005 20:33:46 -0000 1.6 +++ pref.h 23 Jun 2005 03:18:47 -0000 1.7 @@ -26,7 +26,6 @@ #include <kdialogbase.h> #include <qframe.h> -class KTProject; class KTFeatureChooser; class KTTextureOptions; @@ -34,7 +33,7 @@ { Q_OBJECT public: - KImageProcessPreferences(KTProject *project); + KImageProcessPreferences(); private: KTFeatureChooser *m_featureChooser; Index: kimageprocess.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kimageprocess.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- kimageprocess.h 18 Mar 2005 20:33:46 -0000 1.8 +++ kimageprocess.h 23 Jun 2005 03:18:47 -0000 1.9 @@ -119,9 +119,6 @@ void setupAccel(); void setupActions(); - KTProject *m_project; - KTPluginManager *m_pluginManager; - KTSideBar *m_sideBar; KImageProcessView *m_view; Index: kimageprocess.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kimageprocess.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- kimageprocess.cpp 1 Apr 2005 03:14:04 -0000 1.20 +++ kimageprocess.cpp 23 Jun 2005 03:18:47 -0000 1.21 @@ -60,13 +60,13 @@ KImageProcess::KImageProcess() : KMainWindow( 0, "KImageProcess" ), - m_pluginManager(new KTPluginManager(this)), m_printer(0) { //Create the managers + KTPluginManager::self(); KTFeatureManager::self(); KTMethodManager::self(); - m_project = new KTProject(this); + KTProject::self(); QVBoxLayout *layout = new QVBoxLayout(this); layout->setAutoAdd( true ); @@ -105,39 +105,39 @@ optionsShowStatusbar(); optionsShowToolbar(); - /*connect(m_view->listView(), SIGNAL(aboutToPopupMenu(KTPopupMenu*, KTImage* )), - m_project->patternManager(), SLOT(slotAboutToPopupMenu(KTPopupMenu*, KTImage* )));*/ - - connect(m_project->patternManager(), SIGNAL(trPatternAdded(KTImage* )), + KTImageManager *imgmng = KTImageManager::self(); + connect(imgmng, SIGNAL(trPatternAdded(KTImage* )), m_sideBar, SLOT(slotSampleAdded(KTImage* ))); - connect(m_project->patternManager(), SIGNAL(aboutToRemoveTrPattern(KTImage* )), + connect(imgmng, SIGNAL(aboutToRemoveTrPattern(KTImage* )), m_sideBar, SLOT(slotAboutToRemoveSample(KTImage* ))); - connect(m_project->patternManager(), SIGNAL(testingImageAdded(KTImage* )), + connect(imgmng, SIGNAL(testingImageAdded(KTImage* )), m_sideBar, SLOT(slotTestImageAdded(KTImage* ))); - connect(m_project->patternManager(), SIGNAL(aboutToRemoveTestingImage(KTImage* )), + connect(imgmng, SIGNAL(aboutToRemoveTestingImage(KTImage* )), m_sideBar, SLOT(slotAboutToRemoveTestImage(KTImage* ))); connect(m_sideBar, SIGNAL(showImage(KTImage* )), m_view, SLOT(showImage(KTImage* ))); - connect(m_project, SIGNAL(aboutToSave(QDomDocument*, QDomElement*)), - KTFeatureManager::self(), SLOT(slotSave(QDomDocument*, QDomElement*))); + KTFeatureManager *featmng = KTFeatureManager::self(); + KTProject *prj = KTProject::self(); - connect(m_project, SIGNAL(aboutToLoad(QDomElement*)), - KTFeatureManager::self(), SLOT(slotLoad(QDomElement*))); + connect(prj, SIGNAL(aboutToSave(QDomDocument*, QDomElement*)), + featmng, SLOT(slotSave(QDomDocument*, QDomElement*))); + + connect(prj, SIGNAL(aboutToLoad(QDomElement*)), + featmng, SLOT(slotLoad(QDomElement*))); - connect(m_project, SIGNAL(aboutToSave(QDomDocument*, QDomElement*)), - KTMethodManager::self(), SLOT(slotSave(QDomDocument*, QDomElement*))); + connect(prj, SIGNAL(aboutToSave(QDomDocument*, QDomElement*)), + featmng, SLOT(slotSave(QDomDocument*, QDomElement*))); - connect(m_project, SIGNAL(aboutToLoad(QDomElement*)), - KTMethodManager::self(), SLOT(slotLoad(QDomElement*))); + connect(prj, SIGNAL(aboutToLoad(QDomElement*)), + featmng, SLOT(slotLoad(QDomElement*))); //load all plugins - m_pluginManager->setPatternManager(m_project->patternManager()); - m_pluginManager->loadPlugins(); + KTPluginManager::self()->loadPlugins(); KTMethodManager::self()->loadMethods(); KTFeatureManager::self()->loadFeatures(); @@ -155,7 +155,7 @@ void KImageProcess::load(const KURL& url) { setCaption(url.prettyURL()); - m_project->openProject(url); + KTProject::self()->openProject(url); } void KImageProcess::setupActions() @@ -163,7 +163,7 @@ KStdAction::openNew(this, SLOT(fileNew()), actionCollection(),"project_new"); KStdAction::open(this, SLOT(fileOpen()), actionCollection(), "project_open"); m_recentFiles = KStdAction::openRecent(this, SLOT(fileOpen(const KURL&)), actionCollection(), "project_open_recent"); - connect(m_project, SIGNAL(addToRecent(const KURL& )), m_recentFiles, SLOT(addURL(const KURL& ))); + connect(KTProject::self(), SIGNAL(addToRecent(const KURL& )), m_recentFiles, SLOT(addURL(const KURL& ))); KStdAction::save(this, SLOT(fileSave()), actionCollection(), "project_save"); KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection(),"project_save_as"); @@ -199,9 +199,9 @@ // the 'config' object points to the session managed // config file. anything you write here will be available // later when this app is restored - - if (!m_project->url().url().isEmpty()) - config->writeEntry("lastURL", m_project->url().url()); + QString url = KTProject::self()->url().url(); + if (!url.isEmpty()) + config->writeEntry("lastURL", url); } void KImageProcess::readProperties(KConfig *config) @@ -214,7 +214,7 @@ QString url = config->readEntry("lastURL"); if (!url.isEmpty()) - m_project->openProject(KURL(url)); + KTProject::self()->openProject(KURL(url)); } @@ -250,10 +250,10 @@ // for now it is doing nothing, but as we are going to make it project-based, // this slot will be used to create new projects - if (!m_project->changed()) + if (!KTProject::self()->changed()) { setCaption(i18n("Unnamed Project")); - m_project->newProject(); + KTProject::self()->newProject(); } } @@ -269,7 +269,7 @@ // standard filedialog KURL url = KFileDialog::getOpenURL(QString::null, "*.kimageprocess|KImageProcess Projects (*.kimageprocess)", this, i18n("Open Location")); if (!url.isEmpty()) - m_project->openProject(url); + KTProject::self()->openProject(url); } void KImageProcess::fileSave() @@ -279,10 +279,10 @@ // button is clicked // save the current project - if (!m_project->isSaved()) + if (!KTProject::self()->isSaved()) fileSaveAs(); else - m_project->saveProject(); + KTProject::self()->saveProject(); } void KImageProcess::fileSaveAs() @@ -293,7 +293,7 @@ if (!file_url.isEmpty() && file_url.isValid()) { // save the current project - m_project->saveProject(file_url); + KTProject::self()->saveProject(file_url); } } @@ -350,7 +350,7 @@ void KImageProcess::optionsPreferences() { - KImageProcessPreferences dlg(m_project); + KImageProcessPreferences dlg; if (dlg.exec()) { // redo your settings @@ -362,7 +362,7 @@ KURL url = KFileDialog::getImageOpenURL(QString::null, this, i18n("Open Sample Image")); if (!url.isEmpty()) - m_project->addSampleImage(url); + KTProject::self()->addSampleImage(url); } void KImageProcess::projectDelSample() @@ -378,7 +378,7 @@ return; if (itm->type() == KTListViewItem::LVISample) - m_project->removeSampleImage(itm->img()); + KTProject::self()->removeSampleImage(itm->img()); } void KImageProcess::projectAddImage() @@ -386,7 +386,7 @@ KURL url = KFileDialog::getImageOpenURL(QString::null, this, i18n("Open Testing Image")); if (!url.isEmpty()) - m_project->addTestingImage(url); + KTProject::self()->addTestingImage(url); } void KImageProcess::projectDelImage() @@ -402,7 +402,7 @@ return; if (itm->type() == KTListViewItem::LVIImg) - m_project->removeTestingImage(itm->img()); + KTProject::self()->removeTestingImage(itm->img()); } void KImageProcess::changeStatusbar(const QString& text) |