Re: Is there a way to get a kde3 color scheme into kde4?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MW was good enough to send me a private mail which clearly indicated that he didn't understand what I was talking about and it does appear that the problem was that what I said didn't make sense.

I was apparently having a bad day yesterday. I apologize, I have CFS and some days I have what is called "brain fog" (if I wasn't ill, I would have a job and would not be available to work on KDE) I also find that trying to avoid math jargon does not work since having learned it, I don't seem to be able to explain things without using it. So, if you know that math, you will probably understand, if you don't, my apologies for talking over your head. You might know more math and can correct me if what I say is incorrect.

So, I will try this again.

James Richard Tyrer wrote:
Matthew Woehlke wrote:
Duncan wrote:
I have a kde3 color scheme I'm very happy with after having fine tuned it over the years. Is there a way to get it into kde4?

[...] I'd REALLY hate to have to hand retune it
Not likely to happen; KDE4 has quite a few more colors than KDE3. The chances you won't need to do tweaking are virtually nil (especially since, to import a KDE3 scheme, we would have to make wild guesses how to assign the colors that didn't exist in KDE3).


Question: is the KDE3 color scheme schema a proper subset of the KDE4 color scheme schema.

<SN(P

If the proper subset relationship exists, then it should be possible to either convert a KDE3 color scheme to a KDE4 color scheme or to modify the code so that it will use a KDE3 scheme. If not, IMHO, this would be a bug -- a design error.


Having looked at the issue further, I find that the subset - superset relationship is a sufficient condition for backward compatibility. However, it is not a necessary one.

MW advised me by private email that I had not understood when he said that this subset - superset relationship does not exist because several colors in KDE3 were completely dropped from KDE4. That may be an issue, but it should not effect backward compatibility.

Given that the subset - superset relationship does not exist, what is necessary for backward compatibility is for it to be possible to map the KDE4 colors *onto* the KDE3 colors. I should note that this would mean that more than one KDE4 color would be mapped *onto* some (or all) KDE3 colors. We can then reduce the mapping so that each KDE4 color is the same as a KDE3 color and we should have backward compatibility.

A simpler way (without the Finite Math) of looking at this is that the same things exist in KDE4 as exist in KDE3. However, in KDE4 we use a lot more different named colors to color them then in KDE3. It should still be possible to color the same things with the more limited palate of KDE3. So if one type of thing was colored with one named color in KDE3 but now this type is divided into several subtypes in KDE4 and each of those subtypes is colored with a different named color, is should still be possible to color these subtypes with the same color that was use for the base type in KDE3.

Having tried to say that.  MW has made a commit to

TRUNK:kdebase/workspace/kcontrol/colors

which I have reduced to a patch [attached] which is supposed to convert KDE3 color schemes to KDE4.

I have some issues with the patch which I will work on.

I have to also say that I do not fully understand how the color scheme works for KDE4 and the SystemSetting (KControl) KCM for setting them is somewhat confusing.

Perhaps there is full documentation for this, but I have not been able to find it with Google. If someone knows where it is, it would be greatly appreciated in you could point me to it so that I could avoid another bad headache. :-)

--
James Tyrer

Linux (mostly) From Scratch

Index: colorscm.cpp
===================================================================
--- colorscm.cpp	(revision 997516)
+++ colorscm.cpp	(working copy)
@@ -36,6 +36,7 @@
 #include <KGenericFactory>
 #include <KGlobal>
 #include <KGlobalSettings>
+#include <KColorUtils>
 #include <KInputDialog>
 #include <KMessageBox>
 #include <KStandardDirs>
@@ -296,11 +297,65 @@ void KColorCm::on_schemeImportButton_cli
 
         // load the scheme
         KSharedConfigPtr config = KSharedConfig::openConfig(url.path());
+
+        if (config->groupList().contains("Color Scheme"))
+        {
+            if (KMessageBox::Continue != KMessageBox::warningContinueCancel(this,
+                i18n("The scheme you have selected appears to be a KDE3 scheme.\n\n"
+                     "KDE will attempt to import this scheme, however many color roles have been added since KDE3. "
+                     "Some manual work will likely be required.\n\n"
+                     "This scheme will not be saved automatically."),
+                i18n("Notice")))
+            {
+                return;
+            }
+
+            // convert KDE3 scheme to KDE4 scheme
+            KConfigGroup g(config, "Color Scheme");
+
+            colorSet->setCurrentIndex(0);
+            contrastSlider->setValue(g.readEntry("contrast", KGlobalSettings::contrast()));
+            shadeSortedColumn->setCheckState(g.readEntry("shadeSortColumn", KGlobalSettings::shadeSortColumn()) ? Qt::Checked : Qt::Unchecked);
+
+            m_commonColorButtons[0]->setColor(g.readEntry("windowBackground", m_colorSchemes[KColorScheme::View].background().color()));
+            m_commonColorButtons[1]->setColor(g.readEntry("windowForeground", m_colorSchemes[KColorScheme::View].foreground().color()));
+            m_commonColorButtons[2]->setColor(g.readEntry("background", m_colorSchemes[KColorScheme::Window].background().color()));
+            m_commonColorButtons[3]->setColor(g.readEntry("foreground", m_colorSchemes[KColorScheme::Window].foreground().color()));
+            m_commonColorButtons[4]->setColor(g.readEntry("buttonBackground", m_colorSchemes[KColorScheme::Button].background().color()));
+            m_commonColorButtons[5]->setColor(g.readEntry("buttonForeground", m_colorSchemes[KColorScheme::Button].foreground().color()));
+            m_commonColorButtons[6]->setColor(g.readEntry("selectBackground", m_colorSchemes[KColorScheme::Selection].background().color()));
+            m_commonColorButtons[7]->setColor(g.readEntry("selectForeground", m_colorSchemes[KColorScheme::Selection].foreground().color()));
+            m_commonColorButtons[8]->setColor(KColorUtils::mix(m_colorSchemes[KColorScheme::Selection].foreground().color(),
+                                                               m_colorSchemes[KColorScheme::Selection].background().color()));
+            m_commonColorButtons[9]->setColor(KColorUtils::mix(m_colorSchemes[KColorScheme::View].foreground().color(),
+                                                               m_colorSchemes[KColorScheme::View].background().color()));
+            // doesn't exist in KDE3: 10 ActiveText
+            m_commonColorButtons[11]->setColor(g.readEntry("linkColor", m_colorSchemes[KColorScheme::View].foreground(KColorScheme::LinkText).color()));
+            m_commonColorButtons[12]->setColor(g.readEntry("visitedLinkColor", m_colorSchemes[KColorScheme::View].foreground(KColorScheme::VisitedText).color()));
+            // doesn't exist in KDE3: 13-15 PositiveText, NeutralText, NegativeText
+            m_commonColorButtons[16]->setColor(g.readEntry("selectBackground", m_colorSchemes[KColorScheme::View].decoration(KColorScheme::FocusColor).color()));
+            m_commonColorButtons[17]->setColor(g.readEntry("selectBackground", m_colorSchemes[KColorScheme::View].decoration(KColorScheme::HoverColor).color()));
+            m_commonColorButtons[18]->setColor(g.readEntry("windowBackground", m_colorSchemes[KColorScheme::Tooltip].background().color()));
+            m_commonColorButtons[19]->setColor(g.readEntry("windowForeground", m_colorSchemes[KColorScheme::Tooltip].foreground().color()));
+            m_commonColorButtons[20]->setColor(g.readEntry("activeBackground", m_wmColors.color(WindecoColors::ActiveBackground)));
+            m_commonColorButtons[21]->setColor(g.readEntry("activeForeground", m_wmColors.color(WindecoColors::ActiveForeground)));
+            m_commonColorButtons[22]->setColor(g.readEntry("inactiveBackground", m_wmColors.color(WindecoColors::InactiveBackground)));
+            m_commonColorButtons[23]->setColor(g.readEntry("inactiveForeground", m_wmColors.color(WindecoColors::InactiveForeground)));
+
+            colorSet->setCurrentIndex(1);
+            m_backgroundButtons[KColorScheme::AlternateBackground]->setColor(g.readEntry("alternateBackground",
+                                                                                         m_colorSchemes[KColorScheme::View].background(KColorScheme::AlternateBackground).color()));
+            colorSet->setCurrentIndex(0);
+        }
+        else
+        {
+            // load KDE4 scheme
         loadScheme(config);
 
         // save it
         saveScheme(url.fileName());
     }
+    }
 }
 
 void KColorCm::on_schemeKnsButton_clicked()
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux