[Kde-bindings] KDE/kdebindings/ruby/plasma

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Apr 28 17:10:26 UTC 2008


SVN commit 802142 by rdale:

* Update  the clock applets, plasmoidviewer and engineexplorer in line 
   with their C++ equivalents

CCMAIL: kde-bindings at kde.org


 M  +5 -0      ChangeLog  
 M  +6 -4      examples/applets/analog-clock/analog_clock.rb  
 M  +1 -1      examples/applets/digital-clock/digital_clock.rb  
 M  +5 -5      tools/engineexplorer/engineexplorer.rb  
 M  +15 -11    tools/plasmoidviewer/fullview.rb  


--- trunk/KDE/kdebindings/ruby/plasma/ChangeLog #802141:802142
@@ -1,3 +1,8 @@
+2008-04-28  Richard Dale  <richard.j.dale at gmail.com>
+
+	* Update  the clock applets, plasmoidviewer and engineexplorer in line 
+	  with their C++ equivalents
+
 2008-04-17  Richard Dale  <richard.j.dale at gmail.com>
 
 	* Added a Plasma Data Engine for querying SPARQL endpoints, and returning
--- trunk/KDE/kdebindings/ruby/plasma/examples/applets/analog-clock/analog_clock.rb #802141:802142
@@ -39,7 +39,8 @@
     resize(125, 125)
     setRemainSquare(true)
 
-    @theme = Plasma::Svg.new("widgets/clock", self)
+    @theme = Plasma::Svg.new(self)
+    @theme.imagePath = "widgets/clock"
     @theme.containsMultipleImages = false
     @theme.resize(size())
 
@@ -58,6 +59,7 @@
     @timezone = cg.readEntry("timezone", Qt::Variant.new("Local")).value
 
     connectToEngine()
+    constraintsEvent(Plasma::AllConstraints)
   end
 
   def connectToEngine
@@ -70,9 +72,9 @@
     end
   end
 
-  def constraintsUpdated(constraints)
+  def constraintsEvent(constraints)
     if constraints.to_i & Plasma::FormFactorConstraint.to_i
-      setDrawStandardBackground(false)
+      setBackgroundHints(NoBackground)
     end
   end
 
@@ -105,7 +107,7 @@
     parent.buttons = KDE::Dialog::Ok | KDE::Dialog::Cancel | KDE::Dialog::Apply
     connect(parent, SIGNAL(:applyClicked), self, SLOT(:configAccepted))
     connect(parent, SIGNAL(:okClicked), self, SLOT(:configAccepted));
-    parent.addPage(widget, parent.windowTitle, "chronometer")
+    parent.addPage(widget, parent.windowTitle, icon)
 
     @ui.timeZones.setSelected(@timezone, true)
     @ui.timeZones.enabled = @timezone != "Local"
--- trunk/KDE/kdebindings/ruby/plasma/examples/applets/digital-clock/digital_clock.rb #802141:802142
@@ -82,7 +82,7 @@
 
     # Use 'dataEngine("ruby-time")' for the ruby version of the engine
     dataEngine("time").connectSource(@timezone, self, updateInterval, intervalAlignment)
-    connect(Plasma::Theme.self, SIGNAL(:changed), self, SLOT(:updateColors))
+    connect(Plasma::Theme.defaultTheme, SIGNAL(:themeChanged), self, SLOT(:updateColors))
   end
 
   def updateToolTipContent
--- trunk/KDE/kdebindings/ruby/plasma/tools/engineexplorer/engineexplorer.rb #802141:802142
@@ -45,7 +45,7 @@
     @ui = Ui::EngineExplorer.new
     @ui.setupUi(mainWidget)
 
-    @engineManager = Plasma::DataEngineManager.new
+    @engineManager = Plasma::DataEngineManager.self
     @dataModel = Qt::StandardItemModel.new(self)
     pix = KDE::Icon.new("plasma")
     size = KDE::IconSize(KDE::IconLoader::Dialog)
@@ -93,7 +93,7 @@
   def listEngines
     @ui.m_engines.clear
     @ui.m_engines.addItem("")
-    engines = @engineManager.knownEngines
+    engines = @engineManager.listAllEngines
     engines.sort!
     @ui.m_engines.addItems(engines)
   end
@@ -110,7 +110,7 @@
     @sourceCount = 0
 
     if @engineName.empty?
-        @engineManager.unload(@engineName)
+        @engineManager.unloadEngine(@engineName)
     end
 
     @engineName = name
@@ -119,7 +119,7 @@
         return
     end
 
-    @engine = @engineManager.load(@engineName)
+    @engine = @engineManager.loadEngine(@engineName)
     if @engine.nil?
         @engineName.clear
         updateTitle
@@ -139,7 +139,7 @@
     @ui.m_updateInterval.enabled = true
     @ui.m_sourceRequester.enabled = true
     @ui.m_sourceRequester.setFocus
-    connect(@engine, SIGNAL('newSource(QString)'), self, SLOT('addSource(QString)'))
+    connect(@engine, SIGNAL('sourceAdded(QString)'), self, SLOT('addSource(QString)'))
     connect(@engine, SIGNAL('sourceRemoved(QString)'), self, SLOT('removeSource(QString)'))
     updateTitle
   end
--- trunk/KDE/kdebindings/ruby/plasma/tools/plasmoidviewer/fullview.rb #802141:802142
@@ -84,7 +84,7 @@
     @containment = @corona.addContainment("null")
     @containment.formFactor = @formfactor
     @containment.location = @location
-    @applet = @containment.addApplet(a, args, 0, Qt::RectF.new(0, 0, -1, -1))
+    @applet = @containment.addApplet(a, args, Qt::RectF.new(0, 0, -1, -1))
     @applet.setFlag(Qt::GraphicsItem::ItemIsMovable, false)
 
     setSceneRect(@corona.sceneRect)
@@ -99,22 +99,26 @@
     end
 
     # The applet always keeps its aspect ratio, so let's respect it.
-    ratio = event.oldSize.width / event.oldSize.height
-    newPossibleWidth = size.height * ratio
-    if newPossibleWidth > size.width
+    newWidth = 0
+    newHeight = 0
+
+    if @applet.aspectRatioMode == Qt::KeepAspectRatio
+      ratio = event.oldSize.width / event.oldSize.height
+      newPossibleWidth = size.height * ratio
+      if newPossibleWidth > size.width
         newHeight = size.width / ratio
         newWidth = newHeight * ratio
-    else
+      else
         newWidth = newPossibleWidth
         newHeight = newWidth / ratio
+      end
+    else
+      newWidth = size.width
+      newHeight = size.height
     end
-    @containment.resize(Qt::SizeF.new(newWidth, newHeight))
-    @applet.setGeometry(Qt::RectF.new(Qt::PointF.new(0.0, 0.0), Qt::SizeF.new(newWidth, newHeight)))
 
-    event.accept
-
-#     @containment.resize(size)
-#     @applet.setGeometry(Qt::RectF.new(Qt::Point.new(0, 0), size))
+    @containment.resize(Qt::SizeF.new(size()))
+    @applet.resize(Qt::SizeF.new(newWidth, newHeight))
   end
 
   def sceneRectChanged(rect)



More information about the Kde-bindings mailing list