[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/krita/plugins/viewplugins/histogram_docker
From:       Bart Coppens <kde () bartcoppens ! be>
Date:       2008-11-02 15:44:35
Message-ID: 1225640675.468852.31699.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 879179 by coppens:

Show the right channels in the histogram docker when Krita starts


 M  +19 -13    histogramdocker.cc  
 M  +1 -0      histogramdocker.h  


--- trunk/koffice/krita/plugins/viewplugins/histogram_docker/histogramdocker.cc \
#879178:879179 @@ -117,11 +117,13 @@
         m_hview = new KisHistogramView(m_view);
         m_hview->setHistogram(m_histogram);
         m_hview->setColor(true);
-        m_hview->setCurrentChannels(KoHistogramProducerSP(m_producer), \
m_producer->channels()); +
+        // At the time we called colorSpaceChanged m_hview was not yet constructed, \
so producerChanged didn't call this +        setChannels();
+
         m_hview->setFixedSize(256, 100); // XXX if not it keeps expanding
         m_hview->setWindowTitle(i18n("Histogram"));
 
-
         connect(m_hview, SIGNAL(rightClicked(const QPoint&)),
                 this, SLOT(popupMenu(const QPoint&)));
         connect(m_cache, SIGNAL(cacheUpdated()),
@@ -149,6 +151,20 @@
         m_cache->deleteLater();
 }
 
+void KritaHistogramDocker::setChannels() {
+    m_hview->setHistogram(m_histogram);
+    m_hview->setColor(true);
+    QList<KoChannelInfo *> channels;
+        // Only display color channels
+    for (int i = 0; i < m_producer->channels().count(); i++) {
+        kDebug() << m_producer->channels().at(i)->name();
+        if (m_producer->channels().at(i)->channelType() == KoChannelInfo::COLOR) {
+            channels.append(m_producer->channels().at(i));
+        }
+    }
+    m_hview->setCurrentChannels(KoHistogramProducerSP(m_producer), channels);
+}
+
 void KritaHistogramDocker::producerChanged(QAction *action)
 {
     int pos = m_popup.actions().indexOf(action);
@@ -187,17 +203,7 @@
                                    KoHistogramProducerSP(m_producer), LOGARITHMIC);
 
     if (m_hview) {
-        m_hview->setHistogram(m_histogram);
-        m_hview->setColor(true);
-        QList<KoChannelInfo *> channels;
-        // Only display color channels
-        for (int i = 0; i < m_producer->channels().count(); i++) {
-            if (m_producer->channels().at(i)->channelType() == KoChannelInfo::COLOR) \
                {
-                channels.append(m_producer->channels().at(i));
-            }
-        }
-        m_hview->setCurrentChannels(KoHistogramProducerSP(m_producer), channels);
-
+        setChannels();
         connect(m_cache, SIGNAL(cacheUpdated()),
                 new HistogramDockerUpdater(this, m_histogram, m_hview, m_producer), \
SLOT(updated()));  }
--- trunk/koffice/krita/plugins/viewplugins/histogram_docker/histogramdocker.h \
#879178:879179 @@ -46,6 +46,7 @@
     void popupMenu(const QPoint & pos);
     void colorSpaceChanged(const KoColorSpace* cs);
 private:
+    void setChannels();
     KoHistogramProducerFactory* m_factory;
     KisCachedHistogramObserver::Producers m_producers;
     KisAccumulatingHistogramProducer* m_producer;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic