r22661 by jghali - #15413: Missing units in the Picture Browser

scribus-commit scribus-commit at lists.scribus.net
Thu Aug 30 19:46:28 UTC 2018


Author: jghali
Date: Thu Aug 30 19:46:28 2018
New Revision: 22661

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22661
Log:
#15413: Missing units in the Picture Browser

Modified:
    trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
    trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h
    trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.ui

Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22661&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp	Thu Aug 30 19:46:28 2018
@@ -6,6 +6,8 @@
 */
 #include <QtGui>
 #include <QMessageBox>
+#include <QSignalBlocker>
+
 #include <iostream>
 #include "picturebrowser.h"
 #include "collection.h"
@@ -39,6 +41,11 @@
 	pbSettings.load();
 
 	documentChanged = false;
+
+	insertPositionXSpinbox->setNewUnit(doc->unitIndex());
+	insertPositionYSpinbox->setNewUnit(doc->unitIndex());
+	insertWidthSpinbox->setNewUnit(doc->unitIndex());
+	insertHeightSpinbox->setNewUnit(doc->unitIndex());
 
 	connect(navigationBox, SIGNAL(currentIndexChanged(int)), this, SLOT(navigate(int)));
 	connect(sortCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(sortChanged(int)));
@@ -956,10 +963,10 @@
 	iafData.pageList = pageList;
 	iafData.positionType = insertPositionCombobox->currentIndex();
 	iafData.sizeType = insertSizeCombobox->currentIndex();
-	iafData.x = insertPositionXSpinbox->value();
-	iafData.y = insertPositionYSpinbox->value();
-	iafData.width = insertWidthSpinbox->value();
-	iafData.height = insertHeightSpinbox->value();
+	iafData.x = insertPositionXSpinbox->value() / insertPositionXSpinbox->unitRatio();
+	iafData.y = insertPositionYSpinbox->value() / insertPositionYSpinbox->unitRatio();
+	iafData.width = insertWidthSpinbox->value() / insertWidthSpinbox->unitRatio();
+	iafData.height = insertHeightSpinbox->value() / insertHeightSpinbox->unitRatio();
 
 	/*dont need all this crap */
 //iafData.impsetup=m_ImportSetup;
@@ -996,7 +1003,7 @@
 
 void PictureBrowser::insertSizeComboboxChanged(int index)
 {
-	if ((index == 3)&& !insertCustomSize)
+	if ((index == 4) && !insertCustomSize)
 	{
 		insertWidthSpinbox->setEnabled(true);
 		insertHeightSpinbox->setEnabled(true);
@@ -2067,6 +2074,21 @@
 	}
 }
 
+void PictureBrowser::unitChange()
+{
+	if (m_Doc == nullptr)
+		return;
+
+	QSignalBlocker insertPositionXSpinboxBlocker(insertPositionXSpinbox);
+	QSignalBlocker insertPositionYSpinboxBlocker(insertPositionYSpinbox);
+	QSignalBlocker insertWidthSpinboxBlocker(insertWidthSpinbox);
+	QSignalBlocker insertHeightSpinboxBlocker(insertHeightSpinbox);
+
+	insertPositionXSpinbox->setNewUnit(m_Doc->unitIndex());
+	insertPositionYSpinbox->setNewUnit(m_Doc->unitIndex());
+	insertWidthSpinbox->setNewUnit(m_Doc->unitIndex());
+	insertHeightSpinbox->setNewUnit(m_Doc->unitIndex());
+}
 
 imageFilters::imageFilters()
 {

Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22661&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h	Thu Aug 30 19:46:28 2018
@@ -127,6 +127,9 @@
 		//signals for selecting a page in the current document
 		void selectPage ( int );
 		void selectMasterPage ( QString );
+
+	public slots:
+		void unitChange();
 
 	private slots:
 		//slot for the navigation combobox, sets current browsingmode (folderbrowser, collectionsbrowser, documentbrowser)

Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22661&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.ui
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.ui	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.ui	Thu Aug 30 19:46:28 2018
@@ -1630,7 +1630,7 @@
            <string>Position of New Frame(s)</string>
           </property>
           <layout class="QGridLayout">
-           <item row="0" column="0" colspan="4">
+           <item row="0" column="0" colspan="2">
             <widget class="QComboBox" name="insertPositionCombobox">
              <property name="toolTip">
               <string>Set the position of the image frame(s) to insert</string>
@@ -1655,6 +1655,16 @@
                <string>Custom Position</string>
               </property>
              </item>
+            </widget>
+           </item>
+           <item row="2" column="0">
+            <widget class="QLabel" name="insertPositionYLabel">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="text">
+              <string>Y:</string>
+             </property>
             </widget>
            </item>
            <item row="1" column="0">
@@ -1668,7 +1678,7 @@
             </widget>
            </item>
            <item row="1" column="1">
-            <widget class="QSpinBox" name="insertPositionXSpinbox">
+            <widget class="ScrSpinBox" name="insertPositionXSpinbox">
              <property name="enabled">
               <bool>false</bool>
              </property>
@@ -1676,30 +1686,20 @@
               <string>Horizontal position</string>
              </property>
              <property name="maximum">
-              <number>9999</number>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="2">
-            <widget class="QLabel" name="insertPositionYLabel">
+              <double>9999.000000000000000</double>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1">
+            <widget class="ScrSpinBox" name="insertPositionYSpinbox">
              <property name="enabled">
               <bool>false</bool>
              </property>
-             <property name="text">
-              <string>Y:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="3">
-            <widget class="QSpinBox" name="insertPositionYSpinbox">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
              <property name="toolTip">
               <string>Vertical position</string>
              </property>
              <property name="maximum">
-              <number>9999</number>
+              <double>9999.000000000000000</double>
              </property>
             </widget>
            </item>
@@ -1718,7 +1718,53 @@
            <string>Size</string>
           </property>
           <layout class="QGridLayout">
-           <item row="0" column="0" colspan="5">
+           <item row="1" column="0">
+            <widget class="QLabel" name="insertWidthLabel">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="text">
+              <string>Width:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="0">
+            <widget class="QLabel" name="insertHeightLabel">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="text">
+              <string>Height:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1">
+            <widget class="ScrSpinBox" name="insertHeightSpinbox">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="toolTip">
+              <string>Height</string>
+             </property>
+             <property name="maximum">
+              <double>60000.000000000000000</double>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1">
+            <widget class="ScrSpinBox" name="insertWidthSpinbox">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="toolTip">
+              <string>Width</string>
+             </property>
+             <property name="maximum">
+              <double>60000.000000000000000</double>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="0" colspan="2">
             <widget class="QComboBox" name="insertSizeCombobox">
              <property name="toolTip">
               <string>Set the size of the image frame(s) to insert</string>
@@ -1740,55 +1786,14 @@
              </item>
              <item>
               <property name="text">
+               <string>Same as Image</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
                <string>Custom Size</string>
               </property>
              </item>
-            </widget>
-           </item>
-           <item row="2" column="0">
-            <widget class="QLabel" name="insertWidthLabel">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="text">
-              <string>Width:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="1">
-            <widget class="QSpinBox" name="insertWidthSpinbox">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="toolTip">
-              <string>Width</string>
-             </property>
-             <property name="maximum">
-              <number>60000</number>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="2" colspan="2">
-            <widget class="QLabel" name="insertHeightLabel">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="text">
-              <string>Height:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="4">
-            <widget class="QSpinBox" name="insertHeightSpinbox">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="toolTip">
-              <string>Height</string>
-             </property>
-             <property name="maximum">
-              <number>60000</number>
-             </property>
             </widget>
            </item>
           </layout>
@@ -1940,6 +1945,11 @@
    <extends>QListView</extends>
    <header>pictview.h</header>
   </customwidget>
+  <customwidget>
+   <class>ScrSpinBox</class>
+   <extends>QDoubleSpinBox</extends>
+   <header>ui/scrspinbox.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>




More information about the scribus-commit mailing list