[Kstars-devel] KDE/kdeedu/kstars/kstars/indi

Jasem Mutlaq mutlaqja at ikarustech.com
Thu Oct 8 00:56:08 CEST 2009


SVN commit 1032489 by mutlaqja:

Improving INDI Control Panel usability by adding clear and close buttons. Furthermore, when a device is connected, the INDI control panel is displayed automatically.

CCMAIL:kstars-devel at kde.org



 M  +2 -8      indidriver.cpp  
 M  +0 -2      indidriver.h  
 M  +33 -16    indimenu.cpp  
 M  +12 -9     indimenu.h  


--- trunk/KDE/kdeedu/kstars/kstars/indi/indidriver.cpp #1032488:1032489
@@ -154,6 +154,8 @@
 			
 			updateLocalTab();
 			updateMenuActions();
+			    if (ksw->indiMenu()->managers.size() == 1)
+				ksw->indiMenu()->show();
 			return;
 		}
 	}
@@ -347,14 +349,6 @@
 	  }
 }
 
-void INDIDriver::newDeviceDiscovered()
-{
-
-    emit newDevice();
-
-    updateMenuActions();
-}
-
 void INDIDriver::newTelescopeDiscovered()
 {
 
--- trunk/KDE/kdeedu/kstars/kstars/indi/indidriver.h #1032488:1032489
@@ -137,12 +137,10 @@
     void addINDIHost();
     void modifyINDIHost();
     void removeINDIHost();
-    //TODO void shutdownHost(int managersID);
     void activateRunService();
     void activateStopService();
     void activateHostConnection();
     void activateHostDisconnection();
-    void newDeviceDiscovered();
     void newTelescopeDiscovered();
     void newCCDDiscovered();
 
--- trunk/KDE/kdeedu/kstars/kstars/indi/indimenu.cpp #1032488:1032489
@@ -37,16 +37,16 @@
 #include <QDateTime>
 #include <QTimer>
 
-#include <kled.h>
-#include <klineedit.h>
-#include <kpushbutton.h>
-#include <klocale.h>
-#include <kmessagebox.h>
-#include <kdebug.h>
-#include <kcombobox.h>
-#include <knuminput.h>
-#include <kdialog.h>
-#include <ktabwidget.h>
+#include <KLed>
+#include <KLineEdit>
+#include <KPushButton>
+#include <KLocale>
+#include <KMessageBox>
+#include <KDebug>
+#include <KComboBox>
+#include <KNumInput>
+#include <KDialog>
+#include <KTabWidget>
 
 #include "kstars.h"
 #include "indidriver.h"
@@ -56,13 +56,10 @@
 ** data.
 *******************************************************************/
 INDIMenu::INDIMenu(QWidget *parent) : QWidget(parent, Qt::Window)
-        /*KDialogBase(KDialogBase::Tabbed, i18n("INDI Control Panel"), 0, KDialogBase::Default, parent, name, false)*/
 {
 
     ksw = (KStars *) parent;
 
-    // managers.setAutoDelete(true);
-
     mainLayout    = new QVBoxLayout(this);
     mainLayout->setMargin(10);
     mainLayout->setSpacing(10);
@@ -71,12 +68,23 @@
 
     mainLayout->addWidget(mainTabWidget);
 
-    //currentLabel = QString();
-
     setWindowTitle(i18n("INDI Control Panel"));
     setAttribute(Qt::WA_ShowModal, false);
-    //setModal(false);
 
+    clearB= new QPushButton(i18n("Clear"));
+    closeB= new QPushButton(i18n("Close"));
+
+    QHBoxLayout *buttonLayout = new QHBoxLayout;
+    buttonLayout->insertStretch(0);
+    buttonLayout->addWidget(clearB, 0, Qt::AlignRight);
+    buttonLayout->addWidget(closeB, 0, Qt::AlignRight);
+
+    
+    mainLayout->addLayout(buttonLayout);
+
+    connect(closeB, SIGNAL(clicked()), this, SLOT(close()));
+    connect(clearB, SIGNAL(clicked()), this, SLOT(clearLog()));
+
     resize( 640, 480);
 }
 
@@ -188,4 +196,13 @@
 
 }
 
+void INDIMenu::clearLog()
+{
+  INDI_D *dev = findDeviceByLabel(mainTabWidget->tabText(mainTabWidget->currentIndex()).remove(QChar('&')));
+
+  if (dev)
+	dev->msgST_w->clear();
+
+}
+
 #include "indimenu.moc"
--- trunk/KDE/kdeedu/kstars/kstars/indi/indimenu.h #1032488:1032489
@@ -43,6 +43,10 @@
     INDIMenu(QWidget * parent = 0);
     ~INDIMenu();
 
+    KStars *ksw;
+
+    QList<DeviceManager*> managers;
+
     /*****************************************************************
     * GUI stuff
     ******************************************************************/
@@ -50,14 +54,6 @@
     QTabWidget	*mainTabWidget;
     QTextEdit 	*msgST_w;
 
-    QPushButton  *clear;
-    //QString	currentLabel;
-
-
-    KStars *ksw;
-
-    QList<DeviceManager*> managers;
-
     void updateStatus();
     QString getUniqueDeviceLabel(const QString &deviceName);
   
@@ -72,10 +68,17 @@
     void stopDeviceManager(QList<IDevice *> &processed_devices);
 
   private:
-      QString currentDevice;
+
+
+    QPushButton  *clearB;
+    QPushButton  *closeB;
+
+
+    QString currentDevice;
   
   public slots:
     void removeDeviceManager(DeviceManager *deviceManager);
+    void clearLog();
 
 
 };


More information about the Kstars-devel mailing list