[Kst] branches/work/kst/portto4/kst/src/libkstapp

Nicolas Brisset nicolas.brisset at eurocopter.com
Thu Sep 6 22:36:35 UTC 2012


SVN commit 1315206 by brisset:

Improve naming of exported graphics by using the view's name (ampersands are escaped) as suffix.
Also change the "Save location" label which is confusing, because it looks like one file when you may get many.
Ideally, we'd change the label according to the number of tabs:
1 tab -> File name
>1 tab -> Base name
I tried it but it's not so easy and probably not worth the pain.



 M  +2 -2      exportgraphicsdialog.ui  
 M  +5 -5      mainwindow.cpp  
 M  +1 -0      tabwidget.h  


--- branches/work/kst/portto4/kst/src/libkstapp/exportgraphicsdialog.ui #1315205:1315206
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>402</width>
-    <height>304</height>
+    <height>310</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -29,7 +29,7 @@
       </sizepolicy>
      </property>
      <property name="text">
-      <string>&Save location:</string>
+      <string>&Base name:</string>
      </property>
      <property name="wordWrap">
       <bool>false</bool>
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1315205:1315206
@@ -460,18 +460,18 @@
   for (int i_view = 0; i_view<n_views; i_view++) {
     View *view = _tabWidget->views().at(i_view);
     QSize size;
-    if (display == 0) {
+    if (display == 0) { // Width set by user, maintain aspect ratio
       QSize sizeWindow(view->geometry().size());
       size.setWidth(width);
       size.setHeight((int)((double)width * (double)sizeWindow.height() / (double)sizeWindow.width()));
-    } else if (display == 1){
+    } else if (display == 1){ // Height set by user, maintain aspect ratio
       QSize sizeWindow(view->geometry().size());
       size.setHeight(height);
       size.setWidth((int)((double)height * (double)sizeWindow.width() / (double)sizeWindow.height()));
-    } else if (display == 2) {
+    } else if (display == 2) { // Width and height set by user
       size.setWidth(width);
       size.setHeight(height);
-    } else { //if (display == 3) {
+    } else { //if (display == 3) { // Square (width x width)
       size.setWidth(width);
       size.setHeight(width);
     }
@@ -482,7 +482,7 @@
       QFileInfo QFI(filename);
       file = QFI.dir().path() + '/' + QFI.completeBaseName() +
              '_' +
-             QString::number(viewCount+1) + '.' +
+          _tabWidget->tabBar()->tabText(viewCount).replace(QString("&"),QString()) + '.' +
              QFI.suffix();
     }
     if (format == QString("svg")) {
--- branches/work/kst/portto4/kst/src/libkstapp/tabwidget.h #1315205:1315206
@@ -33,6 +33,7 @@
     void addView(View*);
     void deleteView(View* view);
     void clear();
+    QTabBar *tabBar() const { return QTabWidget::tabBar(); }
 
   Q_SIGNALS:
         void currentViewModeChanged();


More information about the Kst mailing list