[kde-doc-english] [kstars] kstars/tools: Observation Planner should work well despite resizing of all sorts

Akarsh Simha akarsh at kde.org
Wed Jan 6 08:57:37 UTC 2016


Git commit 191e7a3b33d0dbd865b21350fc6d16e73936c91d by Akarsh Simha.
Committed on 06/01/2016 at 03:32.
Pushed by asimha into branch 'master'.

Observation Planner should work well despite resizing of all sorts

This commit makes the observation planner remain usable despite
resizing. It makes se of space properly if you maximize. The "minify"
button on the top right (looks like a full-screen button) makes the
window small in a usable manner by removing some elements.

GUI: Changed UI elements

M  +40   -3    kstars/tools/observinglist.cpp
M  +73   -28   kstars/tools/observinglist.ui

http://commits.kde.org/kstars/191e7a3b33d0dbd865b21350fc6d16e73936c91d

diff --git a/kstars/tools/observinglist.cpp b/kstars/tools/observinglist.cpp
index 20865c6..ffa7086 100644
--- a/kstars/tools/observinglist.cpp
+++ b/kstars/tools/observinglist.cpp
@@ -96,9 +96,14 @@ ObservingList::ObservingList()
     mainLayout->addWidget(ui);
     setWindowTitle( i18n( "Observation Planner" ) );
 
+    // Close button seems redundant since one can close the window -- occupies space
+    /*
     QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
     mainLayout->addWidget(buttonBox);
     connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+    */
+
+    setLayout( mainLayout );
 
     dt = KStarsDateTime::currentDateTime();
     setFocusPolicy(Qt::StrongFocus);
@@ -219,7 +224,11 @@ ObservingList::ObservingList()
     m_CurrentObject = 0;
     setSaveImagesButton();
     //Hide the MiniButton until I can figure out how to resize the Dialog!
-//    ui->MiniButton->hide();
+    //    ui->MiniButton->hide();
+
+    // Set up for the large-size view
+    bIsLarge = false;
+    slotToggleSize();
 }
 
 ObservingList::~ObservingList()
@@ -945,7 +954,15 @@ void ObservingList::slotToggleSize() {
     if ( isLarge() ) {
         ui->MiniButton->setIcon( QIcon::fromTheme("view-fullscreen") );
         //Abbreviate text on each button
-        ui->FindButton->setText( i18nc( "First letter in 'Find'", "F" ) );
+        ui->FindButton->setText( "" );
+        ui->FindButton->setIcon( QIcon::fromTheme("edit-find") );
+        ui->WUTButton->setText( i18nc( "Abbreviation of What's Up Tonight", "WUT" ) );
+        ui->saveImages->setText( "" );
+        ui->DeleteAllImages->setText( "" );
+        ui->saveImages->setIcon( QIcon::fromTheme( "document-save" ) );
+        ui->DeleteAllImages->setIcon( QIcon::fromTheme( "edit-delete" ) );
+        ui->refLabel->setText( i18nc( "Abbreviation for Reference Images:", "RefImg:" ) );
+        ui->addLabel->setText( i18nc( "Add objects to a list", "Add:" ) );
         //Hide columns 1-5
         ui->TableView->hideColumn(1);
         ui->TableView->hideColumn(2);
@@ -958,9 +975,13 @@ void ObservingList::slotToggleSize() {
         //Hide Observing notes
         ui->NotesLabel->hide();
         ui->NotesEdit->hide();
+        ui->kseparator->hide();
         ui->avt->hide();
+        ui->dssMetadataLabel->hide();
+        ui->setMinimumSize(320, 600);
         //Set the width of the Table to be the width of 5 toolbar buttons,
         //or the width of column 1, whichever is larger
+        /*
         int w = 5*ui->MiniButton->width();
         if ( ui->TableView->columnWidth(0) > w ) {
             w = ui->TableView->columnWidth(0);
@@ -970,7 +991,12 @@ void ObservingList::slotToggleSize() {
         int left, right, top, bottom;
         ui->layout()->getContentsMargins( &left, &top, &right, &bottom );
         resize( w + left + right, height() );
+        */
         bIsLarge = false;
+        ui->resize( 400, ui->height() );
+        adjustSize();
+        this->resize( 400, this->height() );
+        update();
     } else {
         ui->MiniButton->setIcon( QIcon::fromTheme( "view-restore" ) );
         //Show columns 1-5
@@ -982,13 +1008,24 @@ void ObservingList::slotToggleSize() {
         //Show the horizontal header
         ui->TableView->horizontalHeader()->show();
         //Expand text on each button
-        ui->WUTButton->setText( i18n( "WUT") );
         ui->FindButton->setText( i18n( "Find &Object") );
+        ui->saveImages->setText( i18n( "Save all Images" ) );
+        ui->DeleteAllImages->setText( i18n( "Delete all Images" ) );
+        ui->FindButton->setIcon( QIcon() );
+        ui->saveImages->setIcon( QIcon() );
+        ui->DeleteAllImages->setIcon( QIcon() );
+        ui->WUTButton->setText( i18n( "What's up Tonight tool" ) );
+        ui->refLabel->setText( i18nc( "Abbreviation for Reference Images:", "Reference Images:" ) );
+        ui->addLabel->setText( i18nc( "Add objects to a list", "Adding Objects:" ) );
         //Show Observing notes
         ui->NotesLabel->show();
         ui->NotesEdit->show();
+        ui->kseparator->show();
+        ui->setMinimumSize(837, 650);
         ui->avt->show();
+        ui->dssMetadataLabel->show();
         adjustSize();
+        update();
         bIsLarge = true;
     }
 }
diff --git a/kstars/tools/observinglist.ui b/kstars/tools/observinglist.ui
index 4c4faff..1dfb1c1 100644
--- a/kstars/tools/observinglist.ui
+++ b/kstars/tools/observinglist.ui
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>861</width>
+    <width>837</width>
     <height>650</height>
    </rect>
   </property>
@@ -18,7 +18,7 @@
   </property>
   <property name="minimumSize">
    <size>
-    <width>820</width>
+    <width>300</width>
     <height>650</height>
    </size>
   </property>
@@ -26,15 +26,33 @@
    <property name="spacing">
     <number>6</number>
    </property>
-   <property name="margin">
+   <property name="leftMargin">
+    <number>9</number>
+   </property>
+   <property name="topMargin">
+    <number>9</number>
+   </property>
+   <property name="rightMargin">
+    <number>9</number>
+   </property>
+   <property name="bottomMargin">
     <number>9</number>
    </property>
    <item>
-    <layout class="QHBoxLayout">
+    <layout class="QHBoxLayout" name="horizontalLayout_1">
      <property name="spacing">
       <number>6</number>
      </property>
-     <property name="margin">
+     <property name="leftMargin">
+      <number>0</number>
+     </property>
+     <property name="topMargin">
+      <number>0</number>
+     </property>
+     <property name="rightMargin">
+      <number>0</number>
+     </property>
+     <property name="bottomMargin">
       <number>0</number>
      </property>
      <item>
@@ -277,7 +295,7 @@
       <number>0</number>
      </property>
      <item>
-      <widget class="QLabel" name="label">
+      <widget class="QLabel" name="addLabel">
        <property name="text">
         <string>Adding Objects:</string>
        </property>
@@ -335,7 +353,7 @@
       </spacer>
      </item>
      <item>
-      <widget class="QLabel" name="label_2">
+      <widget class="QLabel" name="refLabel">
        <property name="text">
         <string>Reference Images:</string>
        </property>
@@ -366,7 +384,7 @@
    <item>
     <widget class="QTabWidget" name="tabWidget">
      <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+      <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
@@ -534,9 +552,22 @@
       </widget>
      </item>
      <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>1</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
       <widget class="KSeparator" name="kseparator">
        <property name="sizePolicy">
-        <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -548,6 +579,12 @@
      </item>
      <item>
       <widget class="KImageFilePreview" name="ImagePreview">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
        <property name="minimumSize">
         <size>
          <width>200</width>
@@ -588,6 +625,12 @@
        </property>
        <item>
         <widget class="QPushButton" name="SaveImage">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
          <property name="text">
           <string>Save</string>
          </property>
@@ -641,25 +684,42 @@
    <item>
     <widget class="QTextEdit" name="NotesEdit">
      <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>10</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>120</height>
+      </size>
+     </property>
     </widget>
    </item>
   </layout>
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KPlotWidget</class>
+   <extends>QFrame</extends>
+   <header>kplotwidget.h</header>
+  </customwidget>
+  <customwidget>
    <class>KDateComboBox</class>
    <extends>QComboBox</extends>
    <header>kdatecombobox.h</header>
   </customwidget>
   <customwidget>
-   <class>QComboBox</class>
-   <extends>QComboBox</extends>
-   <header>QComboBox.h</header>
+   <class>KImageFilePreview</class>
+   <extends>QWidget</extends>
+   <header>kimagefilepreview.h</header>
   </customwidget>
   <customwidget>
    <class>KSeparator</class>
@@ -667,21 +727,6 @@
    <header>kseparator.h</header>
   </customwidget>
   <customwidget>
-   <class>QPushButton</class>
-   <extends>QPushButton</extends>
-   <header>kpushbutton.h</header>
-  </customwidget>
-  <customwidget>
-   <class>KPlotWidget</class>
-   <extends>QFrame</extends>
-   <header>kplotwidget.h</header>
-  </customwidget>
-  <customwidget>
-   <class>KImageFilePreview</class>
-   <extends>QWidget</extends>
-   <header>kimagefilepreview.h</header>
-  </customwidget>
-  <customwidget>
    <class>AVTPlotWidget</class>
    <extends>KPlotWidget</extends>
    <header>tools/avtplotwidget.h</header>



More information about the kde-doc-english mailing list