Merge lp:~treaves/stellarium/ocular-sqlite into lp:stellarium

Proposed by treaves
Status: Merged
Approved by: treaves
Approved revision: 4782
Merged at revision: 4770
Proposed branch: lp:~treaves/stellarium/ocular-sqlite
Merge into: lp:stellarium
Diff against target: 3023 lines (+1458/-801)
16 files modified
CMakeLists.txt (+1/-1)
plugins/Oculars/resources/default_ocular.ini (+61/-5)
plugins/Oculars/src/CCD.cpp (+166/-31)
plugins/Oculars/src/CCD.hpp (+58/-37)
plugins/Oculars/src/CMakeLists.txt (+3/-1)
plugins/Oculars/src/Ocular.cpp (+107/-37)
plugins/Oculars/src/Ocular.hpp (+29/-15)
plugins/Oculars/src/Oculars.cpp (+185/-200)
plugins/Oculars/src/Oculars.hpp (+6/-17)
plugins/Oculars/src/Telescope.cpp (+106/-36)
plugins/Oculars/src/Telescope.hpp (+28/-14)
plugins/Oculars/src/gui/OcularDialog.cpp (+163/-209)
plugins/Oculars/src/gui/OcularDialog.hpp (+33/-25)
plugins/Oculars/src/gui/PropertyBasedTableModel.cpp (+109/-0)
plugins/Oculars/src/gui/PropertyBasedTableModel.hpp (+32/-0)
plugins/Oculars/src/gui/ocularDialog.ui (+371/-173)
To merge this branch: bzr merge lp:~treaves/stellarium/ocular-sqlite
Reviewer Review Type Date Requested Status
treaves Approve
Review via email: mp+39202@code.launchpad.net

Description of the change

Removed dependency on SQLite, as I have no plans on finishing LogBook (the work in Oculars was done as a prelim to that). There is no migration; users will have to re-create any eyepieces,CCD's, & telescopes. This is unfortunate, but, much easier that a two-release approach of conversion, then removal.

Made all key bindings in the plugin configurable.

To post a comment you must log in.
lp:~treaves/stellarium/ocular-sqlite updated
4782. By treaves

Missed a change I made in CMakeLists.txt. It is now commented out again.

Revision history for this message
treaves (treaves) :
review: Approve
Revision history for this message
Fabien Chéreau (xalioth) wrote :

ok good.
Fab

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2010-09-03 09:54:30 +0000
3+++ CMakeLists.txt 2010-10-23 15:46:40 +0000
4@@ -61,7 +61,7 @@
5 # SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.5")
6 # SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk/")
7 # Universal binary
8-# SET(CMAKE_OSX_ARCHITECTURES "i386;ppc")
9+ #SET(CMAKE_OSX_ARCHITECTURES "x86_64")
10 ENDIF()
11
12 ########### Check functions ###########
13
14=== modified file 'plugins/Oculars/resources/default_ocular.ini'
15--- plugins/Oculars/resources/default_ocular.ini 2010-01-22 17:37:33 +0000
16+++ plugins/Oculars/resources/default_ocular.ini 2010-10-23 15:46:40 +0000
17@@ -1,5 +1,61 @@
18-[options]
19-oculars_version = 0.12
20-use_max_exit_circle = true
21-
22-
23+[General]
24+oculars_version=2
25+use_max_exit_circle=true
26+ocular_count=5
27+ccd_count=1
28+telescope_count=2
29+
30+[bindings]
31+toggle_oculars=Ctrl+O
32+toggle_config_dialog=Alt+O
33+toggle_telrad=Ctrl+B
34+next_ocular=Ctrl+]
35+prev_ocular=Ctrl+[
36+next_ccd=Shift+Ctrl+]
37+prev_ccd=Shift+Ctrl+[
38+next_telescope=Shift+]
39+prev_telescope=Shift+[
40+toggle_crosshair=Alt+C
41+
42+[ocular]
43+0\name=Ocular 0
44+0\afov=43
45+0\efl=40
46+0\fieldstop=0
47+1\name=Ocular 1
48+1\afov=52
49+1\efl=26
50+1\fieldstop=0
51+2\name=Ocular 2
52+2\afov=82
53+2\efl=31
54+2\fieldstop=0
55+3\name=Ocular 3
56+3\afov=100
57+3\efl=32
58+3\fieldstop=0
59+4\name=Ocular 4
60+4\afov=100
61+4\efl=17
62+4\fieldstop=0
63+
64+[telescope]
65+0\name=C1400
66+0\focalLength=3190
67+0\diameter=355.6
68+0\vFlip=false
69+0\hFlip=true
70+1\name=80EDF
71+1\focalLength=500
72+1\diameter=80
73+1\vFlip=false
74+1\hFlip=false
75+
76+[ccd]
77+0\name=EOS 450D
78+0\resolutionX=4272
79+0\resolutionY=2848
80+0\chip_width=22.2
81+0\chip_height=14.8
82+0\pixel_width=5.2
83+0\pixel_heght=4.2
84
85=== modified file 'plugins/Oculars/src/CCD.cpp'
86--- plugins/Oculars/src/CCD.cpp 2010-05-26 08:03:06 +0000
87+++ plugins/Oculars/src/CCD.cpp 2010-10-23 15:46:40 +0000
88@@ -1,20 +1,21 @@
89 /*
90- * Copyright (C) 2010 Bernhard Reutner-Fischer
91- *
92- * This program is free software; you can redistribute it and/or
93- * modify it under the terms of the GNU General Public License
94- * as published by the Free Software Foundation; either version 2
95- * of the License, or (at your option) any later version.
96- *
97- * This program is distributed in the hope that it will be useful,
98- * but WITHOUT ANY WARRANTY; without even the implied warranty of
99- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
100- * GNU General Public License for more details.
101- *
102- * You should have received a copy of the GNU General Public License
103- * along with this program; if not, write to the Free Software
104- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
105- */
106+ * portions Copyright (C) 2010 Bernhard Reutner-Fischer
107+ * portions Copyright (C) 2010 Timothy Reaves
108+ *
109+ * This program is free software; you can redistribute it and/or
110+ * modify it under the terms of the GNU General Public License
111+ * as published by the Free Software Foundation; either version 2
112+ * of the License, or (at your option) any later version.
113+ *
114+ * This program is distributed in the hope that it will be useful,
115+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
116+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117+ * GNU General Public License for more details.
118+ *
119+ * You should have received a copy of the GNU General Public License
120+ * along with this program; if not, write to the Free Software
121+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
122+ */
123
124 #include "CCD.hpp"
125 #include "Ocular.hpp"
126@@ -22,30 +23,164 @@
127 #include <QDebug>
128 #include <QSettings>
129
130-CCD::CCD(QSqlRecord record)
131-{
132- CCDID = record.value("id").toInt();
133- name = record.value("name").toString();
134- resolution_x = record.value("resolution_x").toInt();
135- resolution_y = record.value("resolution_y").toInt();
136- chip_width = record.value("chip_width").toFloat();
137- chip_height = record.value("chip_height").toFloat();
138- pixel_width = record.value("pixel_width").toFloat();
139- pixel_height = record.value("pixel_height").toFloat();
140+CCD::CCD()
141+{
142+}
143+
144+CCD::CCD(const QObject& other)
145+{
146+ Q_ASSERT(other);
147+ Q_ASSERT(other->metaObject()->className() == "CCD");
148+ this->m_name = other.property("name").toString();
149+ this->m_chipHeight = other.property("chipHeight").toFloat();
150+ this->m_chipWidth = other.property("chipWidth").toFloat();
151+ this->m_pixelHeight = other.property("pixelHeight").toFloat();
152+ this->m_pixelWidth = other.property("pixelWidth").toFloat();
153+ this->m_resolutionX = other.property("resolutionX").toInt();
154+ this->m_resolutionY = other.property("resolutionY").toInt();
155 }
156
157 CCD::~CCD()
158 {
159 }
160
161-float CCD::getActualFOVx(Ocular *ocular)
162-{
163- float FOVx = (chip_width * 206.265) / ocular->getEffectiveFocalLength();
164+
165+static QMap<int, QString> mapping;
166+
167+QMap<int, QString> CCD::propertyMap()
168+{
169+ if(mapping.isEmpty()) {
170+ mapping = QMap<int, QString>();
171+ mapping[0] = "name";
172+ mapping[1] = "chipHeight";
173+ mapping[2] = "chipWidth";
174+ mapping[3] = "pixelHeight";
175+ mapping[4] = "pixelWidth";
176+ mapping[5] = "resolutionX";
177+ mapping[6] = "resolutionY";
178+ }
179+ return mapping;
180+}
181+
182+
183+/* ********************************************************************* */
184+#if 0
185+#pragma mark -
186+#pragma mark Instance Methods
187+#endif
188+/* ********************************************************************* */
189+QString CCD::name() const
190+{
191+ return m_name;
192+}
193+
194+void CCD::setName(QString name)
195+{
196+ m_name = name;
197+}
198+
199+int CCD::resolutionX() const
200+{
201+ return m_resolutionX;
202+}
203+
204+void CCD::setResolutionX(int resolution)
205+{
206+ m_resolutionX = resolution;
207+}
208+
209+int CCD::resolutionY() const
210+{
211+ return m_resolutionY;
212+}
213+
214+void CCD::setResolutionY(int resolution)
215+{
216+ m_resolutionY = resolution;
217+}
218+
219+float CCD::chipWidth() const
220+{
221+ return m_chipWidth;
222+}
223+
224+void CCD::setChipWidth(float width)
225+{
226+ m_chipWidth = width;
227+}
228+
229+float CCD::chipHeight() const
230+{
231+ return m_chipHeight;
232+}
233+
234+void CCD::setChipHeight(float height)
235+{
236+ m_chipHeight = height;
237+}
238+
239+float CCD::pixelWidth() const
240+{
241+ return m_pixelWidth;
242+}
243+
244+void CCD::setPixelWidth(float width)
245+{
246+ m_pixelWidth = width;
247+}
248+
249+float CCD::pixelHeight() const
250+{
251+ return m_pixelHeight;
252+}
253+
254+void CCD::setPixelHeight(float height)
255+{
256+ m_pixelHeight = height;
257+}
258+
259+float CCD::getActualFOVx(Ocular *ocular) const
260+{
261+ float FOVx = (m_chipWidth * 206.265) / ocular->effectiveFocalLength();
262 return FOVx;
263 }
264
265-float CCD::getActualFOVy(Ocular *ocular)
266+float CCD::getActualFOVy(Ocular *ocular) const
267 {
268- float FOVy = (chip_height * 206.265) / ocular->getEffectiveFocalLength();
269+ float FOVy = (m_chipHeight * 206.265) / ocular->effectiveFocalLength();
270 return FOVy;
271 }
272+
273+/* ********************************************************************* */
274+#if 0
275+#pragma mark -
276+#pragma mark Static Methods
277+#endif
278+/* ********************************************************************* */
279+CCD* CCD::ccdFromSettings(QSettings* theSettings, int ccdIndex)
280+{
281+ CCD* ccd = new CCD();
282+ QString prefix = "ccd/" + QVariant(ccdIndex).toString() + "/";
283+ ccd->setName(theSettings->value(prefix + "name", "").toString());
284+ ccd->setResolutionX(theSettings->value(prefix + "resolutionX", "0").toInt());
285+ ccd->setResolutionY(theSettings->value(prefix + "resolutionY", "0").toInt());
286+ ccd->setChipWidth(theSettings->value(prefix + "chip_width", "0.0").toFloat());
287+ ccd->setChipHeight(theSettings->value(prefix + "chip_height", "0.0").toFloat());
288+ ccd->setPixelWidth(theSettings->value(prefix + "pixel_width", "0.0").toFloat());
289+ ccd->setPixelHeight(theSettings->value(prefix + "pixel_height", "0.0").toFloat());
290+
291+ return ccd;
292+}
293+
294+CCD* CCD::ccdModel()
295+{
296+ CCD* model = new CCD();
297+ model->setName("My CCD");
298+ model->setChipHeight(36.8);
299+ model->setChipWidth(36.8);
300+ model->setPixelHeight(9);
301+ model->setPixelWidth(9);
302+ model->setResolutionX(4096);
303+ model->setResolutionY(4096);
304+ return model;
305+}
306
307=== modified file 'plugins/Oculars/src/CCD.hpp'
308--- plugins/Oculars/src/CCD.hpp 2010-05-04 02:04:28 +0000
309+++ plugins/Oculars/src/CCD.hpp 2010-10-23 15:46:40 +0000
310@@ -1,62 +1,83 @@
311 /*
312- * Copyright (C) 2010 Bernhard Reutner-Fischer
313- *
314- * This program is free software; you can redistribute it and/or
315- * modify it under the terms of the GNU General Public License
316- * as published by the Free Software Foundation; either version 2
317- * of the License, or (at your option) any later version.
318- *
319- * This program is distributed in the hope that it will be useful,
320- * but WITHOUT ANY WARRANTY; without even the implied warranty of
321- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
322- * GNU General Public License for more details.
323- *
324- * You should have received a copy of the GNU General Public License
325- * along with this program; if not, write to the Free Software
326- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
327- */
328+ * portions Copyright (C) 2010 Bernhard Reutner-Fischer
329+ * portions Copyright (C) 2010 Timothy Reaves
330+ *
331+ * This program is free software; you can redistribute it and/or
332+ * modify it under the terms of the GNU General Public License
333+ * as published by the Free Software Foundation; either version 2
334+ * of the License, or (at your option) any later version.
335+ *
336+ * This program is distributed in the hope that it will be useful,
337+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
338+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
339+ * GNU General Public License for more details.
340+ *
341+ * You should have received a copy of the GNU General Public License
342+ * along with this program; if not, write to the Free Software
343+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
344+ */
345
346 #ifndef CCD_HPP_
347 #define CCD_HPP_
348
349 #include <QObject>
350 #include <QString>
351-#include <QSqlRecord>
352+#include <QSettings>
353
354 class Ocular;
355
356 class CCD : public QObject
357 {
358 Q_OBJECT
359+ Q_PROPERTY(QString name READ name WRITE setName)
360+ Q_PROPERTY(int resolutionX READ resolutionX WRITE setResolutionX)
361+ Q_PROPERTY(int resolutionY READ resolutionY WRITE setResolutionY)
362+ Q_PROPERTY(float chipWidth READ chipWidth WRITE setChipWidth)
363+ Q_PROPERTY(float chipHeight READ chipHeight WRITE setChipHeight)
364+ Q_PROPERTY(float pixelWidth READ pixelWidth WRITE setPixelWidth)
365+ Q_PROPERTY(float pixelHeight READ pixelHeight WRITE setPixelHeight)
366 public:
367- CCD(QSqlRecord record);
368+ CCD();
369+ Q_INVOKABLE CCD(const QObject& other);
370 virtual ~CCD();
371- const QString getName() {return name;};
372- int getCCDID() {return CCDID;};
373- int getResolutionX() {return resolution_x;};
374- int getResolutionY() {return resolution_y;};
375- float getChipWidth() {return chip_width;};
376- float getChipHeight() {return chip_height;};
377- float getPixelWidth() {return pixel_width;};
378- float getPixelHeight() {return pixel_height;};
379-
380- float getActualFOVx(Ocular *ocular);
381- float getActualFOVy(Ocular *ocular);
382+ static CCD* ccdFromSettings(QSettings* theSettings, int ccdIndex);
383+ static CCD* ccdModel();
384+
385+ QString name() const;
386+ void setName(QString name);
387+ int getCCDID();
388+ int resolutionX() const;
389+ void setResolutionX(int resolution);
390+ int resolutionY() const;
391+ void setResolutionY(int resolution);
392+ float chipWidth() const;
393+ void setChipWidth(float width);
394+ float chipHeight() const;
395+ void setChipHeight(float height);
396+ float pixelWidth() const;
397+ void setPixelWidth(float width);
398+ float pixelHeight() const;
399+ void setPixelHeight(float height);
400+
401+ float getActualFOVx(Ocular *ocular) const;
402+ float getActualFOVy(Ocular *ocular) const;
403+ QMap<int, QString> propertyMap();
404 private:
405- int CCDID;
406- QString name;
407+ int ccdID;
408+ QString m_name;
409 //! total resolution width in pixels
410- int resolution_x;
411+ int m_resolutionX;
412 //! total resolution height in pixels
413- int resolution_y;
414+ int m_resolutionY;
415 //! chip width in millimeters
416- float chip_width;
417+ float m_chipWidth;
418 //! chip height in millimeters
419- float chip_height;
420+ float m_chipHeight;
421 //! height of 1 pixel in micron (micrometer)
422- float pixel_width;
423+ float m_pixelWidth;
424 //! width of 1 pixel in micron (micrometer)
425- float pixel_height;
426+ float m_pixelHeight;
427 };
428
429+
430 #endif /* CCD_HPP_ */
431
432=== modified file 'plugins/Oculars/src/CMakeLists.txt'
433--- plugins/Oculars/src/CMakeLists.txt 2010-05-10 08:59:49 +0000
434+++ plugins/Oculars/src/CMakeLists.txt 2010-10-23 15:46:40 +0000
435@@ -17,6 +17,8 @@
436 Telescope.cpp
437 gui/OcularDialog.hpp
438 gui/OcularDialog.cpp
439+ gui/PropertyBasedTableModel.hpp
440+ gui/PropertyBasedTableModel.cpp
441 gui/StelDialogOculars.hpp
442 gui/StelDialogOculars.cpp
443 )
444@@ -38,13 +40,13 @@
445 Oculars.hpp
446 Telescope.hpp
447 gui/OcularDialog.hpp
448+ gui/PropertyBasedTableModel.hpp
449 gui/StelDialogOculars.hpp
450 )
451
452 # After this call, Oculars_MOC_SRCS = moc_Oculars.cxx
453 QT4_WRAP_CPP(Oculars_MOC_SRCS ${Oculars_MOC_HDRS})
454
455-SET(QT_USE_QTSQL TRUE)
456 INCLUDE(${QT_USE_FILE})
457
458 SET(extLinkerOption ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${ICONV_LIBRARIES} ${INTL_LIBRARIES})
459
460=== modified file 'plugins/Oculars/src/Ocular.cpp'
461--- plugins/Oculars/src/Ocular.cpp 2010-07-12 01:49:07 +0000
462+++ plugins/Oculars/src/Ocular.cpp 2010-10-23 15:46:40 +0000
463@@ -19,43 +19,59 @@
464 #include "Ocular.hpp"
465 #include "Telescope.hpp"
466
467-#include <QDebug>
468-#include <QSettings>
469+Ocular::Ocular()
470+{
471+}
472
473-Ocular::Ocular(QSqlRecord record)
474+Ocular::Ocular(const QObject& other)
475 {
476- ocularID = record.value("id").toInt();
477- name = record.value("name").toString();
478- appearentFOV = record.value("afov").toDouble();
479- effectiveFocalLength = record.value("efl").toDouble();
480- fieldStop = record.value("fieldStop").toDouble();
481+ Q_ASSERT(other);
482+ Q_ASSERT(other->metaObject()->className() == "Ocular");
483+ this->m_appearentFOV = other.property("appearentFOV").toDouble();
484+ this->m_effectiveFocalLength = other.property("effectiveFocalLength").toDouble();
485+ this->m_fieldStop = other.property("fieldStop").toDouble();
486+ this->m_name = other.property("name").toString();
487 }
488
489 Ocular::~Ocular()
490 {
491 }
492
493+static QMap<int, QString> mapping;
494+QMap<int, QString> Ocular::propertyMap()
495+{
496+ if(mapping.isEmpty()) {
497+ mapping = QMap<int, QString>();
498+ mapping[0] = "name";
499+ mapping[1] = "appearentFOV";
500+ mapping[2] = "effectiveFocalLength";
501+ mapping[3] = "fieldStop";
502+ }
503+ return mapping;
504+}
505+
506+
507 /* ********************************************************************* */
508 #if 0
509 #pragma mark -
510 #pragma mark Instance Methods
511 #endif
512 /* ********************************************************************* */
513-double Ocular::getActualFOV(Telescope *telescope)
514+double Ocular::actualFOV(Telescope *telescope) const
515 {
516 double actualFOV = 0.0;
517- if (fieldStop > 0.0) {
518- actualFOV = fieldStop / telescope->getFocalLength() * 57.3;
519+ if (fieldStop() > 0.0) {
520+ actualFOV = fieldStop() / telescope->focalLength() * 57.3;
521 } else {
522 //actualFOV = apparent / mag
523- actualFOV = appearentFOV / (telescope->getFocalLength() / effectiveFocalLength);
524+ actualFOV = appearentFOV() / (telescope->focalLength() / effectiveFocalLength());
525 }
526 return actualFOV;
527 }
528
529-double Ocular::getMagnification(Telescope *telescope)
530+double Ocular::magnification(Telescope *telescope) const
531 {
532- return telescope->getFocalLength() / effectiveFocalLength;
533+ return telescope->focalLength() / effectiveFocalLength();
534 }
535
536 /* ********************************************************************* */
537@@ -64,27 +80,81 @@
538 #pragma mark Accessors & Mutators
539 #endif
540 /* ********************************************************************* */
541-const QString Ocular::getName()
542-{
543- return name;
544-}
545-
546-int Ocular::getOcularID()
547-{
548- return ocularID;
549-}
550-
551-double Ocular::getAppearentFOV()
552-{
553- return appearentFOV;
554-}
555-
556-double Ocular::getEffectiveFocalLength()
557-{
558- return effectiveFocalLength;
559-}
560-
561-double Ocular::getFieldStop()
562-{
563- return fieldStop;
564+const QString Ocular::name() const
565+{
566+ return m_name;
567+}
568+
569+void Ocular::setName(QString aName)
570+{
571+ m_name = aName;
572+}
573+
574+double Ocular::appearentFOV() const
575+{
576+ return m_appearentFOV;
577+}
578+
579+void Ocular::setAppearentFOV(double fov)
580+{
581+ m_appearentFOV = fov;
582+}
583+
584+double Ocular::effectiveFocalLength() const
585+{
586+ return m_effectiveFocalLength;
587+}
588+
589+void Ocular::setEffectiveFocalLength(double fl)
590+{
591+ m_effectiveFocalLength = fl;
592+}
593+
594+double Ocular::fieldStop() const
595+{
596+ return m_fieldStop;
597+}
598+
599+void Ocular::setFieldStop(double fs)
600+{
601+ m_fieldStop = fs;
602+}
603+
604+/* ********************************************************************* */
605+#if 0
606+#pragma mark -
607+#pragma mark Static Methods
608+#endif
609+/* ********************************************************************* */
610+
611+Ocular* Ocular::ocularFromSettings(QSettings* theSettings, int ocularIndex)
612+{
613+ Ocular* ocular = new Ocular();
614+ QString prefix = "ocular/" + QVariant(ocularIndex).toString() + "/";
615+
616+ ocular->setName(theSettings->value(prefix + "name", "").toString());
617+ ocular->setAppearentFOV(theSettings->value(prefix + "afov", "0.0").toDouble());
618+ ocular->setEffectiveFocalLength(theSettings->value(prefix + "efl", "0.0").toDouble());
619+ ocular->setFieldStop(theSettings->value(prefix + "fieldStop", "0.0").toDouble());
620+
621+ if (!(ocular->appearentFOV() > 0.0 && ocular->effectiveFocalLength() > 0.0)) {
622+ qWarning() << "WARNING: Invalid data for ocular. Ocular values must be positive. \n"
623+ << "\tafov: " << ocular->appearentFOV() << "\n"
624+ << "\tefl: " << ocular->effectiveFocalLength() << "\n"
625+ << "\tThis ocular will be ignored.";
626+ delete ocular;
627+ ocular = NULL;
628+ }
629+
630+ return ocular;
631+}
632+
633+Ocular* Ocular::ocularModel()
634+{
635+ Ocular* model = new Ocular();
636+ model->setName("My Ocular");
637+ model->setAppearentFOV(68);
638+ model->setEffectiveFocalLength(32);
639+ model->setFieldStop(0);
640+ return model;
641 }
642
643=== modified file 'plugins/Oculars/src/Ocular.hpp'
644--- plugins/Oculars/src/Ocular.hpp 2010-07-12 01:49:07 +0000
645+++ plugins/Oculars/src/Ocular.hpp 2010-10-23 15:46:40 +0000
646@@ -19,32 +19,46 @@
647 #ifndef OCULAR_HPP_
648 #define OCULAR_HPP_
649
650+#include <QDebug>
651 #include <QObject>
652 #include <QString>
653-#include <QSqlRecord>
654+#include <QSettings>
655
656 class Telescope;
657
658 class Ocular : public QObject
659 {
660 Q_OBJECT
661+ Q_PROPERTY(QString name READ name WRITE setName)
662+ Q_PROPERTY(double appearentFOV READ appearentFOV WRITE setAppearentFOV)
663+ Q_PROPERTY(double effectiveFocalLength READ effectiveFocalLength WRITE setEffectiveFocalLength)
664+ Q_PROPERTY(double fieldStop READ fieldStop WRITE setFieldStop)
665 public:
666- Ocular(QSqlRecord record);
667+ Ocular();
668+ Q_INVOKABLE Ocular(const QObject& other);
669 virtual ~Ocular();
670- const QString getName();
671- int getOcularID();
672- double getAppearentFOV();
673- double getEffectiveFocalLength();
674- double getFieldStop();
675-
676- double getActualFOV(Telescope *telescope);
677- double getMagnification(Telescope *telescope);
678+ static Ocular* ocularFromSettings(QSettings* theSettings, int ocularIndex);
679+ static Ocular* ocularModel();
680+
681+ const QString name() const;
682+ void setName(QString aName);
683+ double appearentFOV() const;
684+ void setAppearentFOV(double fov);
685+ double effectiveFocalLength() const;
686+ void setEffectiveFocalLength(double fl);
687+ double fieldStop() const;
688+ void setFieldStop(double fs);
689+
690+ double actualFOV(Telescope *telescope) const;
691+ double magnification(Telescope *telescope) const;
692+ QMap<int, QString> propertyMap();
693
694 private:
695- int ocularID;
696- QString name;
697- double appearentFOV;
698- double effectiveFocalLength;
699- double fieldStop;
700+ QString m_name;
701+ double m_appearentFOV;
702+ double m_effectiveFocalLength;
703+ double m_fieldStop;
704 };
705+
706+
707 #endif /* OCULAR_HPP_ */
708
709=== modified file 'plugins/Oculars/src/Oculars.cpp'
710--- plugins/Oculars/src/Oculars.cpp 2010-07-20 17:53:11 +0000
711+++ plugins/Oculars/src/Oculars.cpp 2010-10-23 15:46:40 +0000
712@@ -39,11 +39,6 @@
713 #include <QMouseEvent>
714 #include <QtNetwork>
715 #include <QPixmap>
716-#include <QSettings>
717-#include <QSqlDatabase>
718-#include <QSqlError>
719-#include <QSqlQuery>
720-#include <QSqlTableModel>
721
722 #include <cmath>
723
724@@ -53,6 +48,7 @@
725 #include <GL/glu.h> /* Header File For The GLU Library */
726 #endif
727
728+static QSettings *settings; //!< The settings as read in from the ini file.
729
730 /* ********************************************************************* */
731 #if 0
732@@ -96,31 +92,27 @@
733 flagShowOculars = false;
734 flagShowCrosshairs = false;
735 flagShowTelrad = false;
736+ ready = false;
737+ useMaxEyepieceAngle = true;
738+ visible = false;
739+
740 font.setPixelSize(14);
741 maxEyepieceAngle = 0.0;
742- CCDs = QList<CCD *>();
743+
744+ ccds = QList<CCD *>();
745 oculars = QList<Ocular *>();
746- ready = false;
747- selectedCCDIndex = 0;
748+ telescopes = QList<Telescope *>();
749+
750+ selectedCCDIndex = -1;
751 selectedOcularIndex = 0;
752 selectedTelescopeIndex = 0;
753+
754 setObjectName("Oculars");
755- telescopes = QList<Telescope *>();
756- useMaxEyepieceAngle = true;
757- visible = false;
758- ocularsTableModel = NULL;
759- telescopesTableModel = NULL;
760- ocularDialog = NULL;
761+
762 }
763
764 Oculars::~Oculars()
765 {
766- delete CCDsTableModel;
767- CCDsTableModel = NULL;
768- delete ocularsTableModel;
769- ocularsTableModel = NULL;
770- delete telescopesTableModel;
771- telescopesTableModel = NULL;
772 delete ocularDialog;
773 ocularDialog = NULL;
774 }
775@@ -145,9 +137,42 @@
776
777 void Oculars::deinit()
778 {
779- QSqlDatabase db = QSqlDatabase::database("oculars");
780- db.close();
781- QSqlDatabase::removeDatabase(QSqlDatabase::defaultConnection);
782+ // update the ini file.
783+ settings->remove("ccd");
784+ settings->remove("ocular");
785+ settings->remove("telescope");
786+ int index = 0;
787+ foreach(CCD* ccd, ccds) {
788+ QString prefix = "ccd/" + QVariant(index).toString() + "/";
789+ settings->setValue(prefix + "name", ccd->name());
790+ settings->setValue(prefix + "resolutionX", ccd->resolutionX());
791+ settings->setValue(prefix + "resolutionY", ccd->resolutionY());
792+ settings->setValue(prefix + "chip_width", ccd->chipWidth());
793+ settings->setValue(prefix + "chip_height", ccd->chipHeight());
794+ settings->setValue(prefix + "pixel_width", ccd->pixelWidth());
795+ settings->setValue(prefix + "pixel_height", ccd->pixelWidth());
796+ index++;
797+ }
798+ index = 0;
799+ foreach(Ocular* ocular, oculars) {
800+ QString prefix = "ocular/" + QVariant(index).toString() + "/";
801+ settings->setValue(prefix + "name", ocular->name());
802+ settings->setValue(prefix + "afov", ocular->appearentFOV());
803+ settings->setValue(prefix + "efl", ocular->effectiveFocalLength());
804+ settings->setValue(prefix + "fieldStop", ocular->fieldStop());
805+ index++;
806+ }
807+ index = 0;
808+ foreach(Telescope* telescope, telescopes){
809+ QString prefix = "telescope/" + QVariant(index).toString() + "/";
810+ settings->setValue(prefix + "name", telescope->name());
811+ settings->setValue(prefix + "focalLength", telescope->focalLength());
812+ settings->setValue(prefix + "diameter", telescope->diameter());
813+ settings->setValue(prefix + "hFlip", telescope->isHFlipped());
814+ settings->setValue(prefix + "vFlip", telescope->isVFlipped());
815+ index++;
816+ }
817+ settings->sync();
818 }
819
820 //! Draw any parts on the screen which are for our module
821@@ -158,9 +183,9 @@
822 }
823 if (flagShowOculars){
824 // Insure there is a selected ocular & telescope
825- if (selectedCCDIndex > CCDs.count()) {
826+ if (selectedCCDIndex > ccds.count()) {
827 qWarning() << "Oculars: the selected sensor index of " << selectedCCDIndex << " is greater than the sensor count of "
828- << CCDs.count() << ". Module disabled!";
829+ << ccds.count() << ". Module disabled!";
830 ready = false;
831 }
832 if (selectedOcularIndex > oculars.count()) {
833@@ -252,19 +277,37 @@
834 qDebug() << "Ocular plugin - press Command-O to toggle eyepiece view mode. Press ALT-o for configuration.";
835
836 // Load settings from ocular.ini
837- validateIniFile();
838- if (initializeDB()) {
839+ try {
840+ validateAndLoadIniFile();
841 // assume all is well
842+
843+ useMaxEyepieceAngle = settings->value("use_max_exit_circle", 0.0).toBool();
844+ int ocularCount = settings->value("ocular_count", 0).toInt();
845+ for (int index = 0; index < ocularCount; index++) {
846+ Ocular *newOcular = Ocular::ocularFromSettings(settings, index);
847+ if (newOcular != NULL) {
848+ oculars.append(newOcular);
849+ }
850+ }
851+ int ccdCount = settings->value("ccd_count", 0).toInt();
852+ for (int index = 0; index < ccdCount; index++) {
853+ CCD *newCCD = CCD::ccdFromSettings(settings, index);
854+ if (newCCD != NULL) {
855+ ccds.append(newCCD);
856+ }
857+ }
858+ int telescopeCount = settings->value("telescope_count", 0).toInt();
859+ for (int index = 0; index < telescopeCount; index++) {
860+ Telescope *newTelescope = Telescope::telescopeFromSettings(settings, index);
861+ if (newTelescope != NULL) {
862+ telescopes.append(newTelescope);
863+ }
864+ }
865+
866 ready = true;
867- ocularDialog = new OcularDialog(CCDsTableModel, ocularsTableModel, telescopesTableModel);
868+ ocularDialog = new OcularDialog(&ccds, &oculars, &telescopes);
869 initializeActivationActions();
870- }
871- try {
872- StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable);
873- QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", flags) + "ocular.ini";
874-
875- QSettings settings(ocularIniPath, QSettings::IniFormat);
876- useMaxEyepieceAngle = settings.value("use_max_exit_circle", 0.0).toBool();
877+ determineMaxEyepieceAngle();
878 } catch (std::runtime_error& e) {
879 qWarning() << "WARNING: unable to locate ocular.ini file or create a default one for Ocular plugin: " << e.what();
880 }
881@@ -305,8 +348,8 @@
882 while (ocularIterator.hasNext()) {
883 Ocular *ocular = ocularIterator.next();
884
885- if (ocular->getAppearentFOV() > maxEyepieceAngle) {
886- maxEyepieceAngle = ocular->getAppearentFOV();
887+ if (ocular->appearentFOV() > maxEyepieceAngle) {
888+ maxEyepieceAngle = ocular->appearentFOV();
889 }
890 }
891 }
892@@ -322,33 +365,6 @@
893 zoom(true);
894 }
895
896-void Oculars::loadCCDs()
897-{
898- CCDs.clear();
899- int rowCount = CCDsTableModel->rowCount();
900- for (int row = 0; row < rowCount; row++) {
901- CCDs.append(new CCD(CCDsTableModel->record(row)));
902- }
903-}
904-
905-void Oculars::loadOculars()
906-{
907- oculars.clear();
908- int rowCount = ocularsTableModel->rowCount();
909- for (int row = 0; row < rowCount; row++) {
910- oculars.append(new Ocular(ocularsTableModel->record(row)));
911- }
912-}
913-
914-void Oculars::loadTelescopes()
915-{
916- telescopes.clear();
917- int rowCount = telescopesTableModel->rowCount();
918- for (int row = 0; row < rowCount; row++) {
919- telescopes.append(new Telescope(telescopesTableModel->record(row)));
920- }
921-}
922-
923 void Oculars::setScaleImageCircle(bool state)
924 {
925 if (state) {
926@@ -372,7 +388,6 @@
927
928 if (b) {
929 // load data and determine if we're ready (if we have all required data)
930- loadDatabaseObjects();
931 }
932 if (!ready) {
933 // no, some data was missing. We already warned, done.
934@@ -417,8 +432,8 @@
935 void Oculars::decrementCCDIndex()
936 {
937 selectedCCDIndex--;
938- if (selectedCCDIndex == -1) {
939- selectedCCDIndex = CCDs.count() - 1;
940+ if (selectedCCDIndex == -2) {
941+ selectedCCDIndex = ccds.count() - 1;
942 }
943 emit(selectedCCDChanged());
944 }
945@@ -444,8 +459,8 @@
946 void Oculars::incrementCCDIndex()
947 {
948 selectedCCDIndex++;
949- if (selectedCCDIndex == CCDs.count()) {
950- selectedCCDIndex = 0;
951+ if (selectedCCDIndex == ccds.count()) {
952+ selectedCCDIndex = -1;
953 }
954 emit(selectedCCDChanged());
955 }
956@@ -494,8 +509,8 @@
957 projector->getViewportPosY()+projector->getViewportHeight()/2);
958 GLdouble length = 0.5 * params.viewportFovDiameter;
959 // See if we need to scale the length
960- if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->getAppearentFOV() > 0.0) {
961- length = oculars[selectedOcularIndex]->getAppearentFOV() * length / maxEyepieceAngle;
962+ if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFOV() > 0.0) {
963+ length = oculars[selectedOcularIndex]->appearentFOV() * length / maxEyepieceAngle;
964 }
965
966 // Draw the lines
967@@ -550,13 +565,25 @@
968 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
969 Q_ASSERT(gui);
970
971- gui->addGuiActions("actionShow_Ocular", N_("Enable ocular"), "Ctrl+O", "Plugin Key Bindings", true);
972+ gui->addGuiActions("actionShow_Ocular",
973+ N_("Enable ocular"),
974+ settings->value("toggle_oculars", "Ctrl+O").toString(),
975+ "Plugin Key Bindings",
976+ true);
977 gui->getGuiActions("actionShow_Ocular")->setChecked(flagShowOculars);
978 connect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(toggled(bool)), this, SLOT(enableOcular(bool)));
979- gui->addGuiActions("actionShow_Ocular_Window", N_("Configuration Window"), "ALT+O", group, true);
980+ gui->addGuiActions("actionShow_Ocular_Window",
981+ N_("Configuration Window"),
982+ settings->value("toggle_config_dialog", "ALT+O").toString(),
983+ group,
984+ true);
985 connect(gui->getGuiActions("actionShow_Ocular_Window"), SIGNAL(toggled(bool)), ocularDialog, SLOT(setVisible(bool)));
986 connect(ocularDialog, SIGNAL(visibleChanged(bool)), gui->getGuiActions("actionShow_Ocular_Window"), SLOT(setChecked(bool)));
987- gui->addGuiActions("actionShow_Ocular_Telrad", N_("Display Telrad"), "Ctrl+B", group, true);
988+ gui->addGuiActions("actionShow_Ocular_Telrad",
989+ N_("Display Telrad"),
990+ settings->value("toggle_telrad", "Ctrl+B").toString(),
991+ group,
992+ true);
993 gui->getGuiActions("actionShow_Ocular_Telrad")->setChecked(flagShowTelrad);
994 connect(gui->getGuiActions("actionShow_Ocular_Telrad"), SIGNAL(toggled(bool)), this, SLOT(toggleTelrad()));
995
996@@ -587,14 +614,35 @@
997 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
998
999 Q_ASSERT(gui);
1000- gui->addGuiActions("actionShow_Ocular_Crosshair", N_("Toggle Crosshair"), "ALT+C", group, true);
1001+ gui->addGuiActions("actionShow_Ocular_Crosshair",
1002+ N_("Toggle Crosshair"),
1003+ settings->value("toggle_crosshair", "ALT+C").toString(),
1004+ group, true);
1005
1006- gui->addGuiActions("actionShow_CCD_increment", N_("Select next sensor"), "Shift+Ctrl+]", group, false);
1007- gui->addGuiActions("actionShow_CCD_decrement", N_("Select previous sensor"), "Shift+Ctrl+[", group, false);
1008- gui->addGuiActions("actionShow_Ocular_increment", N_("Select next ocular"), "Ctrl+]", group, false);
1009- gui->addGuiActions("actionShow_Ocular_decrement", N_("Select previous ocular"), "Ctrl+[", group, false);
1010- gui->addGuiActions("actionShow_Telescope_increment", N_("Select next telescope"), "Shift+]", group, false);
1011- gui->addGuiActions("actionShow_Telescope_decrement", N_("Select previous telescope"), "Shift+[", group, false);
1012+ gui->addGuiActions("actionShow_CCD_increment",
1013+ N_("Select next sensor"),
1014+ settings->value("next_ccd", "Shift+Ctrl+]").toString(),
1015+ group, false);
1016+ gui->addGuiActions("actionShow_CCD_decrement",
1017+ N_("Select previous sensor"),
1018+ settings->value("prev_ccd", "Shift+Ctrl+[").toString(),
1019+ group, false);
1020+ gui->addGuiActions("actionShow_Ocular_increment",
1021+ N_("Select next ocular"),
1022+ settings->value("next_ocular", "Ctrl+]").toString(),
1023+ group, false);
1024+ gui->addGuiActions("actionShow_Ocular_decrement",
1025+ N_("Select previous ocular"),
1026+ settings->value("prev_ocular", "Ctrl+[").toString(),
1027+ group, false);
1028+ gui->addGuiActions("actionShow_Telescope_increment",
1029+ N_("Select next telescope"),
1030+ settings->value("next_telescope", "Shift+]").toString(),
1031+ group, false);
1032+ gui->addGuiActions("actionShow_Telescope_decrement",
1033+ N_("Select previous telescope"),
1034+ settings->value("prev_telescope", "Shift+[").toString(),
1035+ group, false);
1036
1037 connect(gui->getGuiActions("actionShow_Ocular_Crosshair"), SIGNAL(toggled(bool)), this, SLOT(toggleCrosshair()));
1038
1039@@ -616,59 +664,6 @@
1040 connect(ocularDialog, SIGNAL(scaleImageCircleChanged(bool)), this, SLOT(setScaleImageCircle(bool)));
1041 }
1042
1043-// Return true if we're ready (could read all required data), false otherwise
1044-bool Oculars::initializeDB()
1045-{
1046- StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable);
1047- QString dbPath = StelFileMgr::findFile("modules/Oculars/", flags);
1048- QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "oculars");
1049- db.setDatabaseName(dbPath + "oculars.sqlite");
1050- if (db.open()) {
1051-#define EXEC(sql) if (!query.exec(sql)) { qDebug() << query.lastError(); return false;}
1052- qDebug() << "Oculars opened the DB successfully.";
1053- // See if the tables alreadt exist.
1054- QStringList tableList = db.tables();
1055- if (!tableList.contains("oculars")) {
1056- QSqlQuery query = QSqlQuery(db);
1057- EXEC("create table oculars (id INTEGER PRIMARY KEY, name VARCHAR, afov FLOAT, efl FLOAT, fieldStop FLOAT)");
1058- EXEC("INSERT INTO oculars (name, afov, efl, fieldStop) VALUES ('one', 43, 40, 0)");
1059- EXEC("INSERT INTO oculars (name, afov, efl, fieldStop) VALUES ('two', 82, 31, 0)");
1060- EXEC("INSERT INTO oculars (name, afov, efl, fieldStop) VALUES ('three', 52, 10.5, 0)");
1061- EXEC("INSERT INTO oculars (name, afov, efl, fieldStop) VALUES ('four', 52, 26, 0)");
1062- EXEC("INSERT INTO oculars (name, afov, efl, fieldStop) VALUES ('five', 82, 20, 0)");
1063- }
1064- if (!tableList.contains("telescopes")) {
1065- QSqlQuery query = QSqlQuery(db);
1066- EXEC("create table telescopes (id INTEGER PRIMARY KEY, name VARCHAR, focalLength FLOAT, diameter FLOAT, vFlip VARCHAR, hFlip VARCHAR)");
1067- EXEC("INSERT INTO telescopes (name, focalLength, diameter, vFlip, hFlip) VALUES ('C1400', 3190, 355.6, 'false', 'true')");
1068- EXEC("INSERT INTO telescopes (name, focalLength, diameter, vFlip, hFlip) VALUES ('80EDF', 500, 80, 'false', 'false')");
1069- }
1070- if (!tableList.contains("ccd")) {
1071- QSqlQuery query = QSqlQuery(db);
1072- EXEC("create table ccd (id INTEGER PRIMARY KEY, name VARCHAR, resolution_x INTEGER, resolution_y INTEGER, chip_width FLOAT, chip_height FLOAT, pixel_width FLOAT, pixel_height FLOAT)");
1073- EXEC("INSERT INTO ccd (name, resolution_x, resolution_y, chip_width, chip_height, pixel_width, pixel_height) VALUES ('None', 0, 0, 0, 0, 0, 0)");
1074- EXEC("INSERT INTO ccd (name, resolution_x, resolution_y, chip_width, chip_height, pixel_width, pixel_height) VALUES ('EOS 450D', 4272, 2848, 22.2, 14.8, 5.2, 5.2)");
1075- }
1076-
1077- // Set the table models
1078- CCDsTableModel = new QSqlTableModel(0, db);
1079- CCDsTableModel->setTable("ccd");
1080- CCDsTableModel->select();
1081- ocularsTableModel = new QSqlTableModel(0, db);
1082- ocularsTableModel->setTable("oculars");
1083- if (!ocularsTableModel->select())
1084- return false;
1085- telescopesTableModel = new QSqlTableModel(0, db);
1086- telescopesTableModel->setTable("telescopes");
1087- if (!telescopesTableModel->select())
1088- return false;
1089-#undef EXEC
1090- return true;
1091- } else {
1092- qDebug() << "Oculars could not open its database; disabling module.";
1093- }
1094- return false;
1095-}
1096
1097 void Oculars::interceptMovementKey(QKeyEvent* event)
1098 {
1099@@ -769,30 +764,6 @@
1100 }
1101 }
1102
1103-void Oculars::loadDatabaseObjects()
1104-{
1105- loadCCDs();
1106- loadOculars();
1107- loadTelescopes();
1108- if (useMaxEyepieceAngle) {
1109- determineMaxEyepieceAngle();
1110- }
1111- // A telescope and one of [CCD|Ocular] must be defined for the plugin to be usable.
1112- if (telescopes.size() == 0)
1113- {
1114- ready = false;
1115- qWarning() << "WARNING: no telescopes found. Ocular will be disabled.";
1116- }
1117- else if (oculars.size() == 0 && CCDs.size() == 0) {
1118- ready = false;
1119- qWarning() << "WARNING: no oculars or CCDs found. Ocular will be disabled.";
1120- }
1121- else
1122- {
1123- ready = true;
1124- }
1125-}
1126-
1127 void Oculars::paintMask()
1128 {
1129 StelCore *core = StelApp::getInstance().getCore();
1130@@ -807,8 +778,8 @@
1131 GLdouble inner = 0.5 * params.viewportFovDiameter;
1132
1133 // See if we need to scale the mask
1134- if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->getAppearentFOV() > 0.0) {
1135- inner = oculars[selectedOcularIndex]->getAppearentFOV() * inner / maxEyepieceAngle;
1136+ if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFOV() > 0.0) {
1137+ inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle;
1138 }
1139
1140 GLdouble outer = params.viewportXywh[2] + params.viewportXywh[3];
1141@@ -819,21 +790,23 @@
1142 gluDisk(quadric, inner - 1.0, inner, 256, 1);
1143 gluDeleteQuadric(quadric);
1144 // draw sensor rectangle
1145- CCD *ccd = CCDs[selectedCCDIndex];
1146- if (ccd) {
1147- glColor4f(0.77, 0.14, 0.16, 0.5);
1148- Ocular *ocular = oculars[selectedOcularIndex];
1149- float CCDx = ccd->getActualFOVx(ocular);
1150- float CCDy = ccd->getActualFOVy(ocular);
1151- if (CCDx > 0.0 && CCDy > 0.0) {
1152- glBegin(GL_LINE_LOOP);
1153- glVertex2f(-CCDx, CCDy);
1154- glVertex2f(CCDx, CCDy);
1155- glVertex2f(CCDx, -CCDy);
1156- glVertex2f(-CCDx, -CCDy);
1157- glEnd();
1158+ if(selectedCCDIndex != -1) {
1159+ CCD *ccd = ccds[selectedCCDIndex];
1160+ if (ccd) {
1161+ glColor4f(0.77, 0.14, 0.16, 0.5);
1162+ Ocular *ocular = oculars[selectedOcularIndex];
1163+ float CCDx = ccd->getActualFOVx(ocular);
1164+ float CCDy = ccd->getActualFOVy(ocular);
1165+ if (CCDx > 0.0 && CCDy > 0.0) {
1166+ glBegin(GL_LINE_LOOP);
1167+ glVertex2f(-CCDx, CCDy);
1168+ glVertex2f(CCDx, CCDy);
1169+ glVertex2f(CCDx, -CCDy);
1170+ glVertex2f(-CCDx, -CCDy);
1171+ glEnd();
1172+ }
1173 }
1174- }
1175+}
1176 glPopMatrix();
1177 }
1178
1179@@ -843,7 +816,10 @@
1180 StelPainter painter(prj);
1181
1182 // Get the current instruments
1183- CCD *ccd = CCDs[selectedCCDIndex];
1184+ CCD *ccd = NULL;
1185+ if(selectedCCDIndex != -1) {
1186+ ccd = ccds[selectedCCDIndex];
1187+ }
1188 Ocular *ocular = oculars[selectedOcularIndex];
1189 Telescope *telescope = telescopes[selectedTelescopeIndex];
1190
1191@@ -865,16 +841,16 @@
1192 const int lineHeight = painter.getFontMetrics().height();
1193
1194 // The CCD
1195- QString ccdSensorLabel, ccdInfoLabel;
1196- if (ccd && ccd->getChipWidth() > .0 && ccd->getChipHeight() > .0) {
1197- ccdInfoLabel = "Dimension : " + QVariant(ccd->getChipWidth()).toString() + "x" + QVariant(ccd->getChipHeight()).toString() + " mm";
1198- if (ccd->getName() != QString("")) {
1199- ccdSensorLabel = "Sensor #" + QVariant(selectedCCDIndex).toString();
1200- ccdSensorLabel.append(" : ").append(ccd->getName());
1201+ QString ccdsensorLabel, ccdInfoLabel;
1202+ if (ccd && ccd->chipWidth() > .0 && ccd->chipHeight() > .0) {
1203+ ccdInfoLabel = "Dimension : " + QVariant(ccd->chipWidth()).toString() + "x" + QVariant(ccd->chipHeight()).toString() + " mm";
1204+ if (ccd->name() != QString("")) {
1205+ ccdsensorLabel = "Sensor #" + QVariant(selectedCCDIndex).toString();
1206+ ccdsensorLabel.append(" : ").append(ccd->name());
1207 }
1208 }
1209- if (ccdSensorLabel != QString("")) {
1210- painter.drawText(xPosition, yPosition, ccdSensorLabel);
1211+ if (ccdsensorLabel != QString("")) {
1212+ painter.drawText(xPosition, yPosition, ccdsensorLabel);
1213 yPosition-=lineHeight;
1214 painter.drawText(xPosition, yPosition, ccdInfoLabel);
1215 yPosition-=lineHeight;
1216@@ -882,42 +858,41 @@
1217
1218 // The Ocular
1219 QString ocularNumberLabel = "Ocular #" + QVariant(selectedOcularIndex).toString();
1220- if (ocular->getName() != QString("")) {
1221- ocularNumberLabel.append(" : ").append(ocular->getName());
1222+ if (ocular->name() != QString("")) {
1223+ ocularNumberLabel.append(" : ").append(ocular->name());
1224 }
1225 painter.drawText(xPosition, yPosition, ocularNumberLabel);
1226 yPosition-=lineHeight;
1227
1228- QString ocularFLLabel = "Ocular FL: " + QVariant(ocular->getEffectiveFocalLength()).toString() + QChar(0x00B0);
1229+ QString ocularFLLabel = "Ocular FL: " + QVariant(ocular->effectiveFocalLength()).toString() + QChar(0x00B0);
1230 painter.drawText(xPosition, yPosition, ocularFLLabel);
1231 yPosition-=lineHeight;
1232
1233- QString ocularFOVLabel = "Ocular aFOV: " + QVariant(ocular->getAppearentFOV()).toString() + QChar(0x00B0);
1234+ QString ocularFOVLabel = "Ocular aFOV: " + QVariant(ocular->appearentFOV()).toString() + QChar(0x00B0);
1235 painter.drawText(xPosition, yPosition, ocularFOVLabel);
1236 yPosition-=lineHeight;
1237
1238 // The telescope
1239 QString telescopeNumberLabel = "Telescope #" + QVariant(selectedTelescopeIndex).toString();
1240- if (telescope->getName() != QString("")) {
1241- telescopeNumberLabel.append(" : ").append(telescope->getName());
1242+ if (telescope->name() != QString("")) {
1243+ telescopeNumberLabel.append(" : ").append(telescope->name());
1244 }
1245 painter.drawText(xPosition, yPosition, telescopeNumberLabel);
1246 yPosition-=lineHeight;
1247
1248 // General info
1249- QString magnificationLabel = "Magnification: " + QVariant(((int)(ocular->getMagnification(telescope) * 10.0)) / 10.0).toString() + "x";
1250+ QString magnificationLabel = "Magnification: " + QVariant(((int)(ocular->magnification(telescope) * 10.0)) / 10.0).toString() + "x";
1251 painter.drawText(xPosition, yPosition, magnificationLabel);
1252 yPosition-=lineHeight;
1253
1254- QString fovLabel = "FOV: " + QVariant(((int)(ocular->getActualFOV(telescope) * 10000.00)) / 10000.0).toString() + QChar(0x00B0);
1255+ QString fovLabel = "FOV: " + QVariant(((int)(ocular->actualFOV(telescope) * 10000.00)) / 10000.0).toString() + QChar(0x00B0);
1256 painter.drawText(xPosition, yPosition, fovLabel);
1257 }
1258
1259-void Oculars::validateIniFile()
1260+void Oculars::validateAndLoadIniFile()
1261 {
1262 // Insure the module directory exists
1263 StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Oculars");
1264-
1265 StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable);
1266 QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", flags) + "ocular.ini";
1267
1268@@ -925,7 +900,8 @@
1269 if(!QFileInfo(ocularIniPath).exists()) {
1270 QFile src(":/ocular/default_ocular.ini");
1271 if (!src.copy(ocularIniPath)) {
1272- qWarning() << "Oculars::validateIniFile cannot copy default_ocular.ini resource to [non-existing] " + ocularIniPath;
1273+ qWarning() << "Oculars::validateIniFile cannot copy default_ocular.ini resource to [non-existing] "
1274+ + ocularIniPath;
1275 } else {
1276 qDebug() << "Oculars::validateIniFile copied default_ocular.ini to " << ocularIniPath;
1277 // The resource is read only, and the new file inherits this, so set write-able.
1278@@ -948,12 +924,15 @@
1279 // Rename the old one, and copy over a new one
1280 QFile oldFile(ocularIniPath);
1281 if (!oldFile.rename(ocularIniPath + ".old")) {
1282- qWarning() << "Oculars::validateIniFile cannot move ocular.ini resource to ocular.ini.old at path " + ocularIniPath;
1283+ qWarning() << "Oculars::validateIniFile cannot move ocular.ini resource to ocular.ini.old at path "
1284+ + ocularIniPath;
1285 } else {
1286- qWarning() << "Oculars::validateIniFile ocular.ini resource renamed to ocular.ini.old at path " + ocularIniPath;
1287+ qWarning() << "Oculars::validateIniFile ocular.ini resource renamed to ocular.ini.old at path "
1288+ + ocularIniPath;
1289 QFile src(":/ocular/default_ocular.ini");
1290 if (!src.copy(ocularIniPath)) {
1291- qWarning() << "Oculars::validateIniFile cannot copy default_ocular.ini resource to [non-existing] " + ocularIniPath;
1292+ qWarning() << "Oculars::validateIniFile cannot copy default_ocular.ini resource to [non-existing] "
1293+ + ocularIniPath;
1294 } else {
1295 qDebug() << "Oculars::validateIniFile copied default_ocular.ini to " << ocularIniPath;
1296 // The resource is read only, and the new file inherits this... make sure the new file
1297@@ -964,6 +943,12 @@
1298 }
1299 }
1300 }
1301+ settings = new QSettings(ocularIniPath, QSettings::IniFormat, this);
1302+}
1303+
1304+QSettings* Oculars::appSettings()
1305+{
1306+ return settings;
1307 }
1308
1309 void Oculars::unzoomOcular()
1310@@ -1045,10 +1030,10 @@
1311 core->setFlipHorz(telescope->isHFlipped());
1312 core->setFlipVert(telescope->isVFlipped());
1313
1314- double actualFOV = ocular->getActualFOV(telescope);
1315+ double actualFOV = ocular->actualFOV(telescope);
1316 // See if the mask was scaled; if so, correct the actualFOV.
1317- if (useMaxEyepieceAngle && ocular->getAppearentFOV() > 0.0) {
1318- actualFOV = maxEyepieceAngle * actualFOV / ocular->getAppearentFOV();
1319+ if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0) {
1320+ actualFOV = maxEyepieceAngle * actualFOV / ocular->appearentFOV();
1321 }
1322 movementManager->zoomTo(actualFOV, 0.0);
1323 }
1324
1325=== modified file 'plugins/Oculars/src/Oculars.hpp'
1326--- plugins/Oculars/src/Oculars.hpp 2010-07-12 01:49:07 +0000
1327+++ plugins/Oculars/src/Oculars.hpp 2010-10-23 15:46:40 +0000
1328@@ -27,15 +27,15 @@
1329 #include "Telescope.hpp"
1330
1331 #include <QFont>
1332+#include <QSettings>
1333
1334 #define MIN_OCULARS_INI_VERSION 0.12
1335
1336 QT_BEGIN_NAMESPACE
1337-class QSqlTableModel;
1338 class QKeyEvent;
1339 class QMouseEvent;
1340 class QPixmap;
1341-class QSqlQuery;
1342+class QSettings;
1343 QT_END_NAMESPACE
1344
1345 class StelButton;
1346@@ -48,6 +48,7 @@
1347 public:
1348 Oculars();
1349 virtual ~Oculars();
1350+ static QSettings* appSettings();
1351
1352 ///////////////////////////////////////////////////////////////////////////
1353 // Methods defined in the StelModule class
1354@@ -89,9 +90,6 @@
1355 //! Signifies a change in ocular or telescope. Sets new zoom level.
1356 void instrumentChanged();
1357 void determineMaxEyepieceAngle();
1358- void loadCCDs();
1359- void loadOculars();
1360- void loadTelescopes();
1361 void setScaleImageCircle(bool state);
1362
1363 private:
1364@@ -101,10 +99,6 @@
1365 //! Renders the three Telrad circles, but only if not in ocular mode.
1366 void drawTelrad();
1367
1368- //! Insures that each required table exists in the database, as well as instantiate the table models.
1369- //! @return true if the DB was correctly initialized, false if it was not.
1370- bool initializeDB();
1371-
1372 //! Set up the Qt actions needed to activate the plugin.
1373 void initializeActivationActions();
1374
1375@@ -116,8 +110,6 @@
1376 //! while flagShowOculars == true.
1377 void interceptMovementKey(class QKeyEvent* event);
1378
1379- void loadDatabaseObjects();
1380-
1381 //! Paint the mask into the viewport.
1382 void paintMask();
1383
1384@@ -133,7 +125,8 @@
1385 //! ends. However, if one does exist, it opens it, and looks for the oculars_version key. The value (or even
1386 //! presence) is used to determine if the ini file is usable. If not, it is renamed, and a new one copied over.
1387 //! It does not ty to cope values over.
1388- void validateIniFile();
1389+ //! Once there is a valid ini file, it is loaded into the settings attribute.
1390+ void validateAndLoadIniFile();
1391
1392 //! Recordd the state of the GridLinesMgr views beforehand, so that it can be reset afterwords.
1393 //! @param rezoom if true, this zoom operation is starting from an already zoomed state.
1394@@ -144,7 +137,7 @@
1395 void zoomOcular();
1396
1397 //! A list of all the oculars defined in the ini file. Must have at least one, or module will not run.
1398- QList<CCD *> CCDs;
1399+ QList<CCD *> ccds;
1400 QList<Ocular *> oculars;
1401 QList<Telescope *> telescopes;
1402 int selectedCCDIndex;
1403@@ -179,10 +172,6 @@
1404 bool ready; //!< A flag that determines that this module is usable. If false, we won't open.
1405 bool newInstrument; //!< true the first time draw is called for a new ocular or telescope, false otherwise.
1406
1407- QSqlTableModel *CCDsTableModel;
1408- QSqlTableModel *ocularsTableModel;
1409- QSqlTableModel *telescopesTableModel;
1410-
1411 //Styles
1412 QByteArray normalStyleSheet;
1413 QByteArray nightStyleSheet;
1414
1415=== modified file 'plugins/Oculars/src/Telescope.cpp'
1416--- plugins/Oculars/src/Telescope.cpp 2010-01-22 20:35:39 +0000
1417+++ plugins/Oculars/src/Telescope.cpp 2010-10-23 15:46:40 +0000
1418@@ -21,52 +21,122 @@
1419 #include <QDebug>
1420 #include <QSettings>
1421
1422-Telescope::Telescope(QSqlRecord record)
1423-{
1424- telescopeID = record.value("id").toInt();
1425- name = record.value("name").toString();
1426- focalLength = record.value("focalLength").toDouble();
1427- diameter = record.value("diameter").toDouble();
1428- hFlipped = record.value("hFlip").toBool();
1429- vFlipped = record.value("vFlip").toBool();
1430+Telescope::Telescope()
1431+{
1432+}
1433+
1434+Telescope::Telescope(const QObject& other)
1435+{
1436+ Q_ASSERT(other);
1437+ Q_ASSERT(other->metaObject()->className() == "Telescope");
1438+ this->m_diameter = other.property("diameter").toDouble();
1439+ this->m_focalLength = other.property("focalLength").toDouble();
1440+ this->m_hFlipped = other.property("hFlipped").toBool();
1441+ this->m_vFlipped = other.property("vFlipped").toBool();
1442+ this->m_name = other.property("name").toString();
1443 }
1444
1445 Telescope::~Telescope()
1446 {
1447 }
1448
1449+static QMap<int, QString> mapping;
1450+QMap<int, QString> Telescope::propertyMap()
1451+{
1452+ if(mapping.isEmpty()) {
1453+ mapping = QMap<int, QString>();
1454+ mapping[0] = "name";
1455+ mapping[1] = "diameter";
1456+ mapping[2] = "focalLength";
1457+ mapping[3] = "hFlipped";
1458+ mapping[4] = "vFlipped";
1459+ }
1460+ return mapping;
1461+}
1462+
1463 /* ********************************************************************* */
1464 #if 0
1465 #pragma mark -
1466 #pragma mark Accessors & Mutators
1467 #endif
1468 /* ********************************************************************* */
1469-const QString Telescope::getName()
1470-{
1471- return name;
1472-}
1473-
1474-double Telescope::getFocalLength()
1475-{
1476- return focalLength;
1477-}
1478-
1479-int Telescope::getTelescopeID()
1480-{
1481- return telescopeID;
1482-}
1483-
1484-double Telescope::getDiameter()
1485-{
1486- return diameter;
1487-}
1488-
1489-bool Telescope::isHFlipped()
1490-{
1491- return hFlipped;
1492-}
1493-
1494-bool Telescope::isVFlipped()
1495-{
1496- return vFlipped;
1497+const QString Telescope::name() const
1498+{
1499+ return m_name;
1500+}
1501+
1502+void Telescope::setName(QString theValue)
1503+{
1504+ m_name = theValue;
1505+}
1506+
1507+double Telescope::focalLength() const
1508+{
1509+ return m_focalLength;
1510+}
1511+
1512+void Telescope::setFocalLength(double theValue)
1513+{
1514+ m_focalLength = theValue;
1515+}
1516+
1517+double Telescope::diameter() const
1518+{
1519+ return m_diameter;
1520+}
1521+
1522+void Telescope::setDiameter(double theValue)
1523+{
1524+ m_diameter = theValue;
1525+}
1526+
1527+bool Telescope::isHFlipped() const
1528+{
1529+ return m_hFlipped;
1530+}
1531+
1532+void Telescope::setHFlipped(bool flipped)
1533+{
1534+ m_hFlipped = flipped;
1535+}
1536+
1537+bool Telescope::isVFlipped() const
1538+{
1539+ return m_vFlipped;
1540+}
1541+
1542+void Telescope::setVFlipped(bool flipped)
1543+{
1544+ m_vFlipped = flipped;
1545+}
1546+
1547+/* ********************************************************************* */
1548+#if 0
1549+#pragma mark -
1550+#pragma mark Static Methods
1551+#endif
1552+/* ********************************************************************* */
1553+
1554+Telescope* Telescope::telescopeFromSettings(QSettings* theSettings, int telescopeIndex)
1555+{
1556+ Telescope* telescope = new Telescope();
1557+ QString prefix = "telescope/" + QVariant(telescopeIndex).toString() + "/";
1558+
1559+ telescope->setName(theSettings->value(prefix + "name", "").toString());
1560+ telescope->setFocalLength(theSettings->value(prefix + "focalLength", "0").toDouble());
1561+ telescope->setDiameter(theSettings->value(prefix + "diameter", "0").toDouble());
1562+ telescope->setHFlipped(theSettings->value(prefix + "hFlip").toBool());
1563+ telescope->setVFlipped(theSettings->value(prefix + "vFlip").toBool());
1564+
1565+ return telescope;
1566+}
1567+Telescope* Telescope::telescopeModel()
1568+{
1569+ Telescope* model = new Telescope();
1570+ model->setName("My Telescope");
1571+ model->setDiameter(80);
1572+ model->setFocalLength(500);
1573+ model->setHFlipped(true);
1574+ model->setVFlipped(true);
1575+ return model;
1576 }
1577
1578=== modified file 'plugins/Oculars/src/Telescope.hpp'
1579--- plugins/Oculars/src/Telescope.hpp 2010-04-28 16:30:31 +0000
1580+++ plugins/Oculars/src/Telescope.hpp 2010-10-23 15:46:40 +0000
1581@@ -21,26 +21,40 @@
1582
1583 #include <QObject>
1584 #include <QString>
1585-#include <QSqlRecord>
1586+#include <QSettings>
1587
1588 class Telescope : public QObject
1589 {
1590 Q_OBJECT
1591+ Q_PROPERTY(QString name READ name WRITE setName)
1592+ Q_PROPERTY(double diameter READ diameter WRITE setDiameter)
1593+ Q_PROPERTY(double focalLength READ focalLength WRITE setFocalLength)
1594+ Q_PROPERTY(bool hFlipped READ isHFlipped WRITE setHFlipped)
1595+ Q_PROPERTY(bool vFlipped READ isVFlipped WRITE setVFlipped)
1596 public:
1597- Telescope(QSqlRecord record);
1598+ Telescope();
1599+ Q_INVOKABLE Telescope(const QObject& other);
1600 virtual ~Telescope();
1601- double getDiameter();
1602- double getFocalLength();
1603- int getTelescopeID();
1604- const QString getName();
1605- bool isHFlipped();
1606- bool isVFlipped();
1607+ static Telescope* telescopeFromSettings(QSettings* theSettings, int telescopeIndex);
1608+ static Telescope* telescopeModel();
1609+
1610+ double diameter() const;
1611+ void setDiameter(double theValue);
1612+ double focalLength() const;
1613+ void setFocalLength(double theValue);
1614+ const QString name() const;
1615+ void setName(QString theValue);
1616+ bool isHFlipped() const;
1617+ void setHFlipped(bool flipped);
1618+ bool isVFlipped() const;
1619+ void setVFlipped(bool flipped);
1620+ QMap<int, QString> propertyMap();
1621 private:
1622- int telescopeID;
1623- QString name;
1624- double diameter;
1625- double focalLength;
1626- bool hFlipped;
1627- bool vFlipped;
1628+ QString m_name;
1629+ double m_diameter;
1630+ double m_focalLength;
1631+ bool m_hFlipped;
1632+ bool m_vFlipped;
1633 };
1634+
1635 #endif /*TELESCOPE_HPP_*/
1636
1637=== modified file 'plugins/Oculars/src/gui/OcularDialog.cpp'
1638--- plugins/Oculars/src/gui/OcularDialog.cpp 2010-10-08 13:15:36 +0000
1639+++ plugins/Oculars/src/gui/OcularDialog.cpp 2010-10-23 15:46:40 +0000
1640@@ -16,7 +16,6 @@
1641 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1642 */
1643
1644-#include "Ocular.hpp"
1645 #include "Oculars.hpp"
1646 #include "OcularDialog.hpp"
1647 #include "ui_ocularDialog.h"
1648@@ -28,25 +27,33 @@
1649 #include "StelMainGraphicsView.hpp"
1650 #include "StelTranslator.hpp"
1651
1652+#include <QAbstractItemModel>
1653 #include <QDataWidgetMapper>
1654 #include <QDebug>
1655 #include <QFrame>
1656 #include <QModelIndex>
1657 #include <QSettings>
1658-#include <QSqlError>
1659-#include <QSqlField>
1660-#include <QSqlDatabase>
1661-#include <QSqlRecord>
1662-#include <QSqlTableModel>
1663+#include <QStandardItemModel>
1664 #include <limits>
1665
1666-OcularDialog::OcularDialog(QSqlTableModel *CCDsTableModel, QSqlTableModel *ocularsTableModel, QSqlTableModel *telescopesTableModel)
1667+OcularDialog::OcularDialog(QList<CCD *>* ccds, QList<Ocular *>* oculars, QList<Telescope *>* telescopes)
1668 {
1669 ui = new Ui_ocularDialogForm;
1670- this->CCDsTableModel = CCDsTableModel;
1671- this->ocularsTableModel = ocularsTableModel;
1672- this->telescopesTableModel = telescopesTableModel;
1673-
1674+ this->ccds = ccds;
1675+ ccdTableModel = new PropertyBasedTableModel(this);
1676+ ccdTableModel->init(reinterpret_cast<QList<QObject *>* >(ccds),
1677+ CCD::ccdModel(),
1678+ CCD::ccdModel()->propertyMap());
1679+ this->oculars = oculars;
1680+ ocularTableModel = new PropertyBasedTableModel(this);
1681+ ocularTableModel->init(reinterpret_cast<QList<QObject *>* >(oculars),
1682+ Ocular::ocularModel(), Ocular::ocularModel()->propertyMap());
1683+ this->telescopes = telescopes;
1684+ telescopeTableModel = new PropertyBasedTableModel(this);
1685+ telescopeTableModel->init(reinterpret_cast<QList<QObject *>* >(telescopes),
1686+ Telescope::telescopeModel(),
1687+ Telescope::telescopeModel()->propertyMap());
1688+
1689 validatorPositiveInt = new QIntValidator(0, std::numeric_limits<int>::max(), this);
1690 validatorPositiveDouble = new QDoubleValidator(.0, std::numeric_limits<double>::max(), 24, this);
1691 validatorOcularAFOV = new QIntValidator(35, 120, this);
1692@@ -69,15 +76,15 @@
1693 ui->ocularName->setValidator(0);
1694 ui->telescopeName->setValidator(0);
1695 ui->ocularName->setValidator(0);
1696- ui->CCDName->setValidator(0);
1697- ui->CCDResX->setValidator(0);
1698- ui->CCDResY->setValidator(0);
1699- ui->CCDChipX->setValidator(0);
1700- ui->CCDChipY->setValidator(0);
1701- ui->CCDPixelX->setValidator(0);
1702- ui->CCDPixelX->setValidator(0);
1703- delete CCDMapper;
1704- CCDMapper = NULL;
1705+ ui->ccdName->setValidator(0);
1706+ ui->ccdResX->setValidator(0);
1707+ ui->ccdResY->setValidator(0);
1708+ ui->ccdChipX->setValidator(0);
1709+ ui->ccdChipY->setValidator(0);
1710+ ui->ccdPixelX->setValidator(0);
1711+ ui->ccdPixelX->setValidator(0);
1712+ delete ccdMapper;
1713+ ccdMapper = NULL;
1714 delete ocularMapper;
1715 ocularMapper = NULL;
1716 delete telescopeMapper;
1717@@ -144,154 +151,39 @@
1718
1719 void OcularDialog::deleteSelectedCCD()
1720 {
1721- QModelIndex selection = ui->ccdListView->currentIndex();
1722- if (selection.row() != -1 && CCDsTableModel->rowCount() > 1) {
1723- CCDsTableModel->removeRows(selection.row(), 1);
1724- ui->ccdListView->setCurrentIndex(CCDsTableModel->index(0, 1));
1725- }
1726+ ccdTableModel->removeRows(ui->ccdListView->currentIndex().row(), 1);
1727+ ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1));
1728 }
1729
1730
1731 void OcularDialog::deleteSelectedOcular()
1732 {
1733- QModelIndex selection = ui->ocularListView->currentIndex();
1734- if (selection.row() != -1 && ocularsTableModel->rowCount() > 1) {
1735- ocularsTableModel->removeRows(selection.row(), 1);
1736- ui->ocularListView->setCurrentIndex(ocularsTableModel->index(0, 1));
1737- }
1738+ ocularTableModel->removeRows(ui->ocularListView->currentIndex().row(), 1);
1739+ ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1));
1740 }
1741
1742 void OcularDialog::deleteSelectedTelescope()
1743 {
1744- QModelIndex selection = ui->telescopeListView->currentIndex();
1745- if (selection.row() != -1 && telescopesTableModel->rowCount() > 1) {
1746- telescopesTableModel->removeRows(selection.row(), 1);
1747- ui->telescopeListView->setCurrentIndex(telescopesTableModel->index(0, 1));
1748- }
1749+ telescopeTableModel->removeRows(ui->telescopeListView->currentIndex().row(), 1);
1750+ ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0, 1));
1751 }
1752
1753 void OcularDialog::insertNewCCD()
1754 {
1755- QSqlField field1("name", QVariant::String);
1756- QSqlField field2("resolution_x", QVariant::Int);
1757- QSqlField field3("resolution_y", QVariant::Int);
1758- QSqlField field4("chip_width", QVariant::Double);
1759- QSqlField field5("chip_height", QVariant::Double);
1760- QSqlField field6("pixel_width", QVariant::Double);
1761- QSqlField field7("pixel_height", QVariant::Double);
1762- field1.setValue(QVariant("New Sensor"));
1763- field2.setValue(QVariant(4096));
1764- field3.setValue(QVariant(4096));
1765- field4.setValue(QVariant(36.8));
1766- field5.setValue(QVariant(36.8));
1767- field6.setValue(QVariant(9));
1768- field7.setValue(QVariant(9));
1769- QSqlRecord newRecord = QSqlRecord();
1770- newRecord.append(field1);
1771- newRecord.append(field2);
1772- newRecord.append(field3);
1773- newRecord.append(field4);
1774- newRecord.append(field5);
1775- newRecord.append(field6);
1776- newRecord.append(field7);
1777-
1778- if (CCDsTableModel->insertRecord(-1, newRecord)) {
1779- ui->ccdListView->setCurrentIndex(CCDsTableModel->index(CCDsTableModel->rowCount() - 1, 1));
1780- } else {
1781- qWarning() << "Oculars: could not insert new sensor. The error is: " << CCDsTableModel->lastError();
1782- }
1783+ ccdTableModel->insertRows(ccdTableModel->rowCount(), 1);
1784+ ui->ccdListView->setCurrentIndex(ccdTableModel->index(ccdTableModel->rowCount() - 1, 1));
1785 }
1786
1787 void OcularDialog::insertNewOcular()
1788 {
1789- QSqlField field1("name", QVariant::String);
1790- QSqlField field2("afov", QVariant::Double);
1791- QSqlField field3("efl", QVariant::Double);
1792- QSqlField field4("fieldStop", QVariant::Double);
1793- field1.setValue(QVariant("New Ocular"));
1794- field2.setValue(QVariant(82));
1795- field3.setValue(QVariant(32));
1796- field4.setValue(QVariant(0));
1797- QSqlRecord newRecord = QSqlRecord();
1798- newRecord.append(field1);
1799- newRecord.append(field2);
1800- newRecord.append(field3);
1801- newRecord.append(field4);
1802-
1803- if (ocularsTableModel->insertRecord(-1, newRecord)) {
1804- ui->ocularListView->setCurrentIndex(ocularsTableModel->index(ocularsTableModel->rowCount() - 1, 1));
1805- } else {
1806- qWarning() << "Oculars: could not insert new ocular. The error is: " << ocularsTableModel->lastError();
1807- }
1808+ ocularTableModel->insertRows(ocularTableModel->rowCount(), 1);
1809+ ui->ocularListView->setCurrentIndex(ocularTableModel->index(ocularTableModel->rowCount() - 1, 1));
1810 }
1811
1812 void OcularDialog::insertNewTelescope()
1813 {
1814- QSqlField field1("name", QVariant::String);
1815- QSqlField field2("focalLength", QVariant::Double);
1816- QSqlField field3("diameter", QVariant::Double);
1817- QSqlField field4("vFlip", QVariant::String);
1818- QSqlField field5("hFlip", QVariant::String);
1819- field1.setValue(QVariant("New Telescope"));
1820- field2.setValue(QVariant(500));
1821- field3.setValue(QVariant(80));
1822- field4.setValue(QVariant("false"));
1823- field5.setValue(QVariant("false"));
1824- QSqlRecord newRecord = QSqlRecord();
1825- newRecord.append(field1);
1826- newRecord.append(field2);
1827- newRecord.append(field3);
1828- newRecord.append(field4);
1829- newRecord.append(field5);
1830-
1831- if (telescopesTableModel->insertRecord(-1, newRecord)) {
1832- ui->telescopeListView->setCurrentIndex(telescopesTableModel->index(telescopesTableModel->rowCount() - 1, 1));
1833- } else {
1834- qWarning() << "Oculars: could not insert new telescope. The error is: " << telescopesTableModel->lastError();
1835- }
1836-}
1837-
1838-void OcularDialog::CCDSelected(const QModelIndex &)
1839-{
1840-}
1841-
1842-void OcularDialog::ocularSelected(const QModelIndex &)
1843-{
1844-}
1845-
1846-void OcularDialog::telescopeSelected(const QModelIndex &)
1847-{
1848-}
1849-
1850-void OcularDialog::updateCCD()
1851-{
1852- int selectionIndex = ui->ccdListView->currentIndex().row();
1853- if (CCDMapper->submit()) {
1854- ui->ccdListView->setCurrentIndex(CCDsTableModel->index(selectionIndex, 1));
1855- } else {
1856- qWarning() << "Oculars: error saving modified sensor. Error is: " << CCDsTableModel->lastError();
1857- }
1858-}
1859-
1860-void OcularDialog::updateOcular()
1861-{
1862- int selectionIndex = ui->ocularListView->currentIndex().row();
1863- if (ocularMapper->submit()) {
1864- ui->ocularListView->setCurrentIndex(ocularsTableModel->index(selectionIndex, 1));
1865- } else {
1866- qWarning() << "Oculars: error saving modified ocular. Error is: " << ocularsTableModel->lastError();
1867- }
1868-}
1869-
1870-void OcularDialog::updateTelescope()
1871-{
1872- int selectionIndex = ui->telescopeListView->currentIndex().row();
1873- if (telescopeMapper->submit()) {
1874- ui->telescopeListView->setCurrentIndex(telescopesTableModel->index(selectionIndex, 1));
1875- } else {
1876- qWarning() << "Oculars: error saving modified telescope. Error is: " << telescopesTableModel->lastError();
1877- }
1878-
1879+ telescopeTableModel->insertRows(ccdTableModel->rowCount(), 1);
1880+ ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(telescopeTableModel->rowCount() - 1, 1));
1881 }
1882
1883 /* ********************************************************************* */
1884@@ -300,6 +192,56 @@
1885 #pragma mark Private Slot Methods
1886 #endif
1887 /* ********************************************************************* */
1888+void OcularDialog::keyBindingTextTogglePluginChanged(const QString& newString)
1889+{
1890+ Oculars::appSettings()->setValue("bindings/toggle_oculars", newString);
1891+}
1892+
1893+void OcularDialog::keyBindingTextTogglePluginConfigChanged(const QString& newString)
1894+{
1895+ Oculars::appSettings()->setValue("bindings/toggle_config_dialog", newString);
1896+}
1897+
1898+void OcularDialog::keyBindingTextToggleCrosshairChanged(const QString& newString)
1899+{
1900+ Oculars::appSettings()->setValue("bindings/toggle_crosshair", newString);
1901+}
1902+
1903+void OcularDialog::keyBindingTextToggleTelradChanged(const QString& newString)
1904+{
1905+ Oculars::appSettings()->setValue("bindings/toggle_telrad", newString);
1906+}
1907+
1908+void OcularDialog::keyBindingTextNextCCDChanged(const QString& newString)
1909+{
1910+ Oculars::appSettings()->setValue("bindings/next_ccd", newString);
1911+}
1912+
1913+void OcularDialog::keyBindingTextNextOcularChanged(const QString& newString)
1914+{
1915+ Oculars::appSettings()->setValue("bindings/next_ocular", newString);
1916+}
1917+
1918+void OcularDialog::keyBindingTextNextTelescopeChanged(const QString& newString)
1919+{
1920+ Oculars::appSettings()->setValue("bindings/next_telescope", newString);
1921+}
1922+
1923+void OcularDialog::keyBindingTextPreviousCCDChanged(const QString& newString)
1924+{
1925+ Oculars::appSettings()->setValue("bindings/prev_ccd", newString);
1926+}
1927+
1928+void OcularDialog::keyBindingTextPreviousOcularChanged(const QString& newString)
1929+{
1930+ Oculars::appSettings()->setValue("bindings/prev_ocular", newString);
1931+}
1932+
1933+void OcularDialog::keyBindingTextPreviousTelescopeChanged(const QString& newString)
1934+{
1935+ Oculars::appSettings()->setValue("bindings/prev_telescope", newString);
1936+}
1937+
1938 void OcularDialog::scaleImageCircleStateChanged(int state)
1939 {
1940 bool shouldScale = (state == Qt::Checked);
1941@@ -322,12 +264,12 @@
1942 void OcularDialog::createDialogContent()
1943 {
1944 ui->setupUi(dialog);
1945-
1946+ ui->ccdListView->setModel(ccdTableModel);
1947+ ui->ocularListView->setModel(ocularTableModel);
1948+ ui->telescopeListView->setModel(telescopeTableModel);
1949+
1950 //Now the rest of the actions.
1951 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
1952- connect(ui->updateCCDButton, SIGNAL(clicked()), this, SLOT(updateCCD()));
1953- connect(ui->updateOcularButton, SIGNAL(clicked()), this, SLOT(updateOcular()));
1954- connect(ui->updateTelescopeButton, SIGNAL(clicked()), this, SLOT(updateTelescope()));
1955 connect(ui->scaleImageCircleCheckBox, SIGNAL(stateChanged(int)), this, SLOT(scaleImageCircleStateChanged(int)));
1956 // The add & delete buttons
1957 connect(ui->addCCD, SIGNAL(clicked()), this, SLOT(insertNewCCD()));
1958@@ -337,27 +279,14 @@
1959 connect(ui->addTelescope, SIGNAL(clicked()), this, SLOT(insertNewTelescope()));
1960 connect(ui->deleteTelescope, SIGNAL(clicked()), this, SLOT(deleteSelectedTelescope()));
1961
1962- // Oculars model
1963- ui->ccdListView->setModel(CCDsTableModel);
1964- ui->ccdListView->setModelColumn(1);
1965- connect(ui->ccdListView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(CCDSelected(const QModelIndex &)));
1966-
1967- ui->ocularListView->setModel(ocularsTableModel);
1968- ui->ocularListView->setModelColumn(1);
1969- connect(ui->ocularListView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(ocularSelected(const QModelIndex &)));
1970-
1971- ui->telescopeListView->setModel(telescopesTableModel);
1972- ui->telescopeListView->setModelColumn(1);
1973- connect(ui->telescopeListView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(telescopeSelected(const QModelIndex &)));
1974-
1975 // Validators
1976- ui->CCDName->setValidator(validatorName);
1977- ui->CCDResX->setValidator(validatorPositiveInt);
1978- ui->CCDResY->setValidator(validatorPositiveInt);
1979- ui->CCDChipX->setValidator(validatorPositiveDouble);
1980- ui->CCDChipY->setValidator(validatorPositiveDouble);
1981- ui->CCDPixelX->setValidator(validatorPositiveDouble);
1982- ui->CCDPixelY->setValidator(validatorPositiveDouble);
1983+ ui->ccdName->setValidator(validatorName);
1984+ ui->ccdResX->setValidator(validatorPositiveInt);
1985+ ui->ccdResY->setValidator(validatorPositiveInt);
1986+ ui->ccdChipX->setValidator(validatorPositiveDouble);
1987+ ui->ccdChipY->setValidator(validatorPositiveDouble);
1988+ ui->ccdPixelX->setValidator(validatorPositiveDouble);
1989+ ui->ccdPixelY->setValidator(validatorPositiveDouble);
1990 ui->ocularAFov->setValidator(validatorOcularAFOV);
1991 ui->ocularFL->setValidator(validatorOcularEFL);
1992 ui->ocularFieldStop->setValidator(validatorOcularEFL);
1993@@ -365,59 +294,84 @@
1994 ui->telescopeDiameter->setValidator(validatorTelescopeDiameter);
1995 ui->ocularName->setValidator(validatorName);
1996 ui->telescopeName->setValidator(validatorName);
1997-
1998+
1999+ // The key bindings
2000+ ui->togglePluginLineEdit->setText(Oculars::appSettings()->value("bindings/toggle_oculars").toString());
2001+ ui->toggleConfigWindowLineEdit->setText(Oculars::appSettings()->value("bindings/toggle_config_dialog").toString());
2002+ ui->toggleCrosshairLineEdit->setText(Oculars::appSettings()->value("bindings/toggle_crosshair").toString());
2003+ ui->toggleTelradLineEdit->setText(Oculars::appSettings()->value("bindings/toggle_telrad").toString());
2004+ ui->nextCCDLineEdit->setText(Oculars::appSettings()->value("bindings/next_ccd").toString());
2005+ ui->nextOcularLineEdit->setText(Oculars::appSettings()->value("bindings/next_ocular").toString());
2006+ ui->nextTelescopeLineEdit->setText(Oculars::appSettings()->value("bindings/next_telescope").toString());
2007+ ui->previousCCDLineEdit->setText(Oculars::appSettings()->value("bindings/prev_ccd").toString());
2008+ ui->previousOcularLineEdit->setText(Oculars::appSettings()->value("bindings/prev_ocular").toString());
2009+ ui->previousTelescopeLineEdit->setText(Oculars::appSettings()->value("bindings/prev_telescope").toString());
2010+ connect(ui->togglePluginLineEdit, SIGNAL(textEdited(const QString&)),
2011+ this, SLOT(keyBindingTextTogglePluginChanged(const QString&)));
2012+ connect(ui->toggleConfigWindowLineEdit, SIGNAL(textEdited(const QString&)),
2013+ this, SLOT(keyBindingTextTogglePluginConfigChanged(const QString&)));
2014+ connect(ui->toggleCrosshairLineEdit, SIGNAL(textEdited(const QString&)),
2015+ this, SLOT(keyBindingTextToggleCrosshairChanged(const QString&)));
2016+ connect(ui->toggleTelradLineEdit, SIGNAL(textEdited(const QString&)),
2017+ this, SLOT(keyBindingTextToggleTelradChanged(const QString&)));
2018+ connect(ui->nextCCDLineEdit, SIGNAL(textEdited(const QString&)),
2019+ this, SLOT(keyBindingTextNextCCDChanged(const QString&)));
2020+ connect(ui->nextOcularLineEdit, SIGNAL(textEdited(const QString&)),
2021+ this, SLOT(keyBindingTextNextOcularChanged(const QString&)));
2022+ connect(ui->nextTelescopeLineEdit, SIGNAL(textEdited(const QString&)),
2023+ this, SLOT(keyBindingTextNextTelescopeChanged(const QString&)));
2024+ connect(ui->previousCCDLineEdit, SIGNAL(textEdited(const QString&)),
2025+ this, SLOT(keyBindingTextPreviousCCDChanged(const QString&)));
2026+ connect(ui->previousOcularLineEdit, SIGNAL(textEdited(const QString&)),
2027+ this, SLOT(keyBindingTextPreviousOcularChanged(const QString&)));
2028+ connect(ui->previousTelescopeLineEdit, SIGNAL(textEdited(const QString&)),
2029+ this, SLOT(keyBindingTextPreviousTelescopeChanged(const QString&)));
2030+
2031 // The CCD mapper
2032- CCDMapper = new QDataWidgetMapper();
2033- CCDMapper->setModel(CCDsTableModel);
2034-// CCDMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
2035- CCDMapper->addMapping(ui->CCDID, CCDsTableModel->fieldIndex("id"), "text");
2036- CCDMapper->addMapping(ui->CCDName, CCDsTableModel->fieldIndex("name"));
2037- CCDMapper->addMapping(ui->CCDResX, CCDsTableModel->fieldIndex("resolution_x"));
2038- CCDMapper->addMapping(ui->CCDResY, CCDsTableModel->fieldIndex("resolution_y"));
2039- CCDMapper->addMapping(ui->CCDChipX, CCDsTableModel->fieldIndex("chip_width"));
2040- CCDMapper->addMapping(ui->CCDChipY, CCDsTableModel->fieldIndex("chip_height"));
2041- CCDMapper->addMapping(ui->CCDPixelX, CCDsTableModel->fieldIndex("pixel_width"));
2042- CCDMapper->addMapping(ui->CCDPixelY, CCDsTableModel->fieldIndex("pixel_height"));
2043- CCDMapper->toFirst();
2044+ ccdMapper = new QDataWidgetMapper();
2045+ ccdMapper->setModel(ccdTableModel);
2046+ ccdMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
2047+ ccdMapper->addMapping(ui->ccdName, 0);
2048+ ccdMapper->addMapping(ui->ccdChipY, 1);
2049+ ccdMapper->addMapping(ui->ccdChipX, 2);
2050+ ccdMapper->addMapping(ui->ccdPixelY, 3);
2051+ ccdMapper->addMapping(ui->ccdPixelX, 4);
2052+ ccdMapper->addMapping(ui->ccdResX, 5);
2053+ ccdMapper->addMapping(ui->ccdResY, 6);
2054+ ccdMapper->toFirst();
2055 connect(ui->ccdListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
2056- CCDMapper, SLOT(setCurrentModelIndex(QModelIndex)));
2057- ui->ccdListView->setCurrentIndex(CCDsTableModel->index(0, 1));
2058+ ccdMapper, SLOT(setCurrentModelIndex(QModelIndex)));
2059+ ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1));
2060
2061 // The ocular mapper
2062 ocularMapper = new QDataWidgetMapper();
2063- ocularMapper->setModel(ocularsTableModel);
2064-// ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
2065- ocularMapper->addMapping(ui->ocularID, ocularsTableModel->fieldIndex("id"), "text");
2066- ocularMapper->addMapping(ui->ocularName, ocularsTableModel->fieldIndex("name"));
2067- ocularMapper->addMapping(ui->ocularAFov, ocularsTableModel->fieldIndex("afov"));
2068- ocularMapper->addMapping(ui->ocularFL, ocularsTableModel->fieldIndex("efl"));
2069- ocularMapper->addMapping(ui->ocularFieldStop, ocularsTableModel->fieldIndex("fieldStop"));
2070+ ocularMapper->setModel(ocularTableModel);
2071+ ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
2072+ ocularMapper->addMapping(ui->ocularName, 0);
2073+ ocularMapper->addMapping(ui->ocularAFov, 1);
2074+ ocularMapper->addMapping(ui->ocularFL, 2);
2075+ ocularMapper->addMapping(ui->ocularFieldStop, 3);
2076 ocularMapper->toFirst();
2077 connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
2078- ocularMapper, SLOT(setCurrentModelIndex(QModelIndex)));
2079- ui->ocularListView->setCurrentIndex(ocularsTableModel->index(0, 1));
2080+ ocularMapper, SLOT(setCurrentModelIndex(QModelIndex)));
2081+ ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1));
2082
2083 // The telescope mapper
2084 telescopeMapper = new QDataWidgetMapper();
2085- telescopeMapper->setModel(telescopesTableModel);
2086-// telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
2087- telescopeMapper->addMapping(ui->telescopeID, telescopesTableModel->fieldIndex("id"), "text");
2088- telescopeMapper->addMapping(ui->telescopeName, telescopesTableModel->fieldIndex("name"));
2089- telescopeMapper->addMapping(ui->telescopeDiameter, telescopesTableModel->fieldIndex("diameter"));
2090- telescopeMapper->addMapping(ui->telescopeFL, telescopesTableModel->fieldIndex("focalLength"));
2091- telescopeMapper->addMapping(ui->telescopeVFlip, telescopesTableModel->fieldIndex("vFlip"), "checked");
2092- telescopeMapper->addMapping(ui->telescopeHFlip, telescopesTableModel->fieldIndex("hFlip"), "checked");
2093+ telescopeMapper->setModel(telescopeTableModel);
2094+ telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
2095+ telescopeMapper->addMapping(ui->telescopeName, 0);
2096+ telescopeMapper->addMapping(ui->telescopeDiameter, 1);
2097+ telescopeMapper->addMapping(ui->telescopeFL, 2);
2098+ telescopeMapper->addMapping(ui->telescopeHFlip, 3, "checked");
2099+ telescopeMapper->addMapping(ui->telescopeVFlip, 4, "checked");
2100 ocularMapper->toFirst();
2101 connect(ui->telescopeListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
2102 telescopeMapper, SLOT(setCurrentModelIndex(QModelIndex)));
2103- ui->telescopeListView->setCurrentIndex(telescopesTableModel->index(0, 1));
2104+ ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0, 1));
2105
2106 // set the initial state
2107- StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable);
2108- QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", flags) + "ocular.ini";
2109- QSettings settings(ocularIniPath, QSettings::IniFormat);
2110- bool useMaxImageCircle = settings.value("use_max_exit_circle", false).toBool();
2111- if (useMaxImageCircle) {
2112+ if (Oculars::appSettings()->value("use_max_exit_circle", false).toBool()) {
2113 ui->scaleImageCircleCheckBox->setCheckState(Qt::Checked);
2114 }
2115
2116
2117=== modified file 'plugins/Oculars/src/gui/OcularDialog.hpp'
2118--- plugins/Oculars/src/gui/OcularDialog.hpp 2010-06-08 18:22:16 +0000
2119+++ plugins/Oculars/src/gui/OcularDialog.hpp 2010-10-23 15:46:40 +0000
2120@@ -20,11 +20,12 @@
2121 #define _OCULARDIALOG_HPP_
2122
2123 #include <QObject>
2124+#include "CCD.hpp"
2125+#include "Ocular.hpp"
2126+#include "PropertyBasedTableModel.hpp"
2127 #include "StelDialogOculars.hpp"
2128-#include "Ocular.hpp"
2129 #include "StelStyle.hpp"
2130-
2131-#include <QSqlRecord>
2132+#include "Telescope.hpp"
2133
2134 class Ui_ocularDialogForm;
2135
2136@@ -34,8 +35,7 @@
2137 class QIntValidator;
2138 class QRegExpValidator;
2139 class QModelIndex;
2140-class QSqlRecord;
2141-class QSqlTableModel;
2142+class QStandardItemModel;
2143 QT_END_NAMESPACE
2144
2145
2146@@ -44,7 +44,7 @@
2147 Q_OBJECT
2148
2149 public:
2150- OcularDialog(QSqlTableModel *CCDsTableModel, QSqlTableModel *ocularsTableModel, QSqlTableModel *telescopesTableModel);
2151+ OcularDialog(QList<CCD *>* ccds, QList<Ocular *>* oculars, QList<Telescope *>* telescopes);
2152 virtual ~OcularDialog();
2153 void languageChanged();
2154 //! Notify that the application style changed
2155@@ -60,37 +60,45 @@
2156 void insertNewCCD();
2157 void insertNewOcular();
2158 void insertNewTelescope();
2159- void CCDSelected(const QModelIndex &index);
2160- void ocularSelected(const QModelIndex &index);
2161- void telescopeSelected(const QModelIndex &index);
2162- void updateCCD();
2163- void updateOcular();
2164- void updateTelescope();
2165
2166 signals:
2167 void scaleImageCircleChanged(bool state);
2168+
2169 protected:
2170 //! Initialize the dialog widgets and connect the signals/slots
2171 virtual void createDialogContent();
2172 Ui_ocularDialogForm* ui;
2173
2174 private slots:
2175+ void keyBindingTextTogglePluginChanged(const QString& newString);
2176+ void keyBindingTextTogglePluginConfigChanged(const QString& newString);
2177+ void keyBindingTextToggleCrosshairChanged(const QString& newString);
2178+ void keyBindingTextToggleTelradChanged(const QString& newString);
2179+ void keyBindingTextNextCCDChanged(const QString& newString);
2180+ void keyBindingTextNextOcularChanged(const QString& newString);
2181+ void keyBindingTextNextTelescopeChanged(const QString& newString);
2182+ void keyBindingTextPreviousCCDChanged(const QString& newString);
2183+ void keyBindingTextPreviousOcularChanged(const QString& newString);
2184+ void keyBindingTextPreviousTelescopeChanged(const QString& newString);
2185 void scaleImageCircleStateChanged(int state);
2186
2187 private:
2188- QDataWidgetMapper *CCDMapper;
2189- QSqlTableModel *CCDsTableModel;
2190- QDataWidgetMapper *ocularMapper;
2191- QSqlTableModel *ocularsTableModel;
2192- QDataWidgetMapper *telescopeMapper;
2193- QSqlTableModel *telescopesTableModel;
2194- QIntValidator *validatorOcularAFOV;
2195- QDoubleValidator *validatorOcularEFL;
2196- QDoubleValidator *validatorTelescopeDiameter;
2197- QDoubleValidator *validatorTelescopeFL;
2198- QRegExpValidator *validatorName;
2199- QIntValidator *validatorPositiveInt;
2200- QDoubleValidator *validatorPositiveDouble;
2201+ QDataWidgetMapper* ccdMapper;
2202+ QList<CCD *>* ccds;
2203+ PropertyBasedTableModel* ccdTableModel;
2204+ QDataWidgetMapper* ocularMapper;
2205+ QList<Ocular *>* oculars;
2206+ PropertyBasedTableModel* ocularTableModel;
2207+ QDataWidgetMapper* telescopeMapper;
2208+ QList<Telescope *>* telescopes;
2209+ PropertyBasedTableModel* telescopeTableModel;
2210+ QIntValidator* validatorOcularAFOV;
2211+ QDoubleValidator* validatorOcularEFL;
2212+ QDoubleValidator* validatorTelescopeDiameter;
2213+ QDoubleValidator* validatorTelescopeFL;
2214+ QRegExpValidator* validatorName;
2215+ QIntValidator* validatorPositiveInt;
2216+ QDoubleValidator* validatorPositiveDouble;
2217 };
2218
2219 #endif // _OCULARDIALOG_HPP_
2220
2221=== added file 'plugins/Oculars/src/gui/PropertyBasedTableModel.cpp'
2222--- plugins/Oculars/src/gui/PropertyBasedTableModel.cpp 1970-01-01 00:00:00 +0000
2223+++ plugins/Oculars/src/gui/PropertyBasedTableModel.cpp 2010-10-23 15:46:40 +0000
2224@@ -0,0 +1,109 @@
2225+#include "PropertyBasedTableModel.hpp"
2226+#include <QDebug>
2227+
2228+PropertyBasedTableModel::PropertyBasedTableModel(QObject *parent)
2229+ : QAbstractTableModel(parent)
2230+{
2231+}
2232+
2233+
2234+PropertyBasedTableModel::~PropertyBasedTableModel()
2235+{
2236+ delete modelObject;
2237+ modelObject = NULL;
2238+}
2239+
2240+void PropertyBasedTableModel::init(QList<QObject *>* content, QObject *model, QMap<int,QString> mappings)
2241+{
2242+ beginResetModel();
2243+ this->content = content;
2244+ this->modelObject = model;
2245+ this->mappings = mappings;
2246+ endResetModel();
2247+}
2248+
2249+/* ********************************************************************* */
2250+#if 0
2251+#pragma mark -
2252+#pragma mark Model Methods
2253+#endif
2254+/* ********************************************************************* */
2255+
2256+int PropertyBasedTableModel::rowCount(const QModelIndex &parent) const
2257+{
2258+ Q_UNUSED(parent);
2259+ return content->size();
2260+}
2261+
2262+int PropertyBasedTableModel::columnCount(const QModelIndex &parent) const
2263+{
2264+ Q_UNUSED(parent);
2265+ return mappings.size();
2266+}
2267+
2268+QVariant PropertyBasedTableModel::data(const QModelIndex &index, int role) const
2269+{
2270+ QVariant data;
2271+ if ((role == Qt::DisplayRole || role ==Qt::EditRole)
2272+ && index.isValid()
2273+ && index.row() < content->size()
2274+ && index.row() >= 0
2275+ && index.column() < mappings.size()
2276+ && index.column() >= 0){
2277+ QObject *object = content->at(index.row());
2278+ data = object->property(mappings[index.column()].toStdString().c_str());
2279+ }
2280+ return data;
2281+}
2282+
2283+bool PropertyBasedTableModel::insertRows(int position, int rows, const QModelIndex &index)
2284+{
2285+ Q_UNUSED(index);
2286+ beginInsertRows(QModelIndex(), position, position+rows-1);
2287+
2288+ for (int row=0; row < rows; row++) {
2289+ QObject* newInstance = modelObject->metaObject()->newInstance(Q_ARG(QObject, *modelObject));
2290+ Q_ASSERT(newInstance != 0);
2291+ content->insert(position, newInstance);
2292+ }
2293+
2294+ endInsertRows();
2295+ return true;
2296+}
2297+
2298+bool PropertyBasedTableModel::removeRows(int position, int rows, const QModelIndex &index)
2299+{
2300+ Q_UNUSED(index);
2301+ beginRemoveRows(QModelIndex(), position, position+rows-1);
2302+
2303+ for (int row=0; row < rows; ++row) {
2304+ content->removeAt(position);
2305+ }
2306+
2307+ endRemoveRows();
2308+ return true;
2309+}
2310+
2311+bool PropertyBasedTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
2312+{
2313+ bool changeMade = false;
2314+ if (index.isValid() && role == Qt::EditRole && index.column() < mappings.size()) {
2315+ QObject* object = content->at(index.row());
2316+ object->setProperty(mappings[index.column()].toStdString().c_str(), value);
2317+ emit(dataChanged(index, index));
2318+
2319+ changeMade = true;
2320+ }
2321+
2322+ return changeMade;
2323+}
2324+
2325+Qt::ItemFlags PropertyBasedTableModel::flags(const QModelIndex &index) const
2326+{
2327+ if (!index.isValid()) {
2328+ return Qt::ItemIsEnabled;
2329+ }
2330+
2331+ return QAbstractTableModel::flags(index) | Qt::ItemIsEditable;
2332+}
2333+
2334
2335=== added file 'plugins/Oculars/src/gui/PropertyBasedTableModel.hpp'
2336--- plugins/Oculars/src/gui/PropertyBasedTableModel.hpp 1970-01-01 00:00:00 +0000
2337+++ plugins/Oculars/src/gui/PropertyBasedTableModel.hpp 2010-10-23 15:46:40 +0000
2338@@ -0,0 +1,32 @@
2339+#ifndef PROPERTYBASEDTABLEMODEL_H
2340+#define PROPERTYBASEDTABLEMODEL_H
2341+
2342+#include <QAbstractTableModel>
2343+
2344+class PropertyBasedTableModel : public QAbstractTableModel
2345+{
2346+ Q_OBJECT
2347+public:
2348+ PropertyBasedTableModel(QObject *parent = 0);
2349+ virtual ~PropertyBasedTableModel();
2350+
2351+ void init(QList<QObject *>* content, QObject *model, QMap<int, QString> mappings);
2352+
2353+ //Over-rides from QAbstractTableModel
2354+ virtual QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const;
2355+
2356+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
2357+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
2358+
2359+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
2360+ virtual bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex());
2361+ virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
2362+ virtual bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex());
2363+
2364+private:
2365+ QList<QObject *>* content;
2366+ QMap<int, QString> mappings;
2367+ QObject* modelObject;
2368+};
2369+
2370+#endif // PROPERTYBASEDTABLEMODEL_H
2371
2372=== modified file 'plugins/Oculars/src/gui/ocularDialog.ui'
2373--- plugins/Oculars/src/gui/ocularDialog.ui 2010-06-07 17:32:10 +0000
2374+++ plugins/Oculars/src/gui/ocularDialog.ui 2010-10-23 15:46:40 +0000
2375@@ -7,7 +7,7 @@
2376 <x>0</x>
2377 <y>0</y>
2378 <width>513</width>
2379- <height>342</height>
2380+ <height>400</height>
2381 </rect>
2382 </property>
2383 <property name="sizePolicy">
2384@@ -169,6 +169,363 @@
2385 <string>Scale Image Circle</string>
2386 </property>
2387 </widget>
2388+ <widget class="QGroupBox" name="groupBox">
2389+ <property name="geometry">
2390+ <rect>
2391+ <x>0</x>
2392+ <y>40</y>
2393+ <width>503</width>
2394+ <height>249</height>
2395+ </rect>
2396+ </property>
2397+ <property name="title">
2398+ <string>Key Mappings</string>
2399+ </property>
2400+ <layout class="QGridLayout" name="gridLayout_2">
2401+ <item row="0" column="1">
2402+ <widget class="QLabel" name="label_24">
2403+ <property name="text">
2404+ <string>Toggle</string>
2405+ </property>
2406+ </widget>
2407+ </item>
2408+ <item row="0" column="3">
2409+ <widget class="QLabel" name="label_25">
2410+ <property name="text">
2411+ <string>Toggle</string>
2412+ </property>
2413+ </widget>
2414+ </item>
2415+ <item row="1" column="0">
2416+ <widget class="QLabel" name="label_11">
2417+ <property name="text">
2418+ <string>Plugin:</string>
2419+ </property>
2420+ <property name="alignment">
2421+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2422+ </property>
2423+ </widget>
2424+ </item>
2425+ <item row="1" column="1">
2426+ <widget class="QLineEdit" name="togglePluginLineEdit">
2427+ <property name="sizePolicy">
2428+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2429+ <horstretch>0</horstretch>
2430+ <verstretch>0</verstretch>
2431+ </sizepolicy>
2432+ </property>
2433+ <property name="baseSize">
2434+ <size>
2435+ <width>100</width>
2436+ <height>22</height>
2437+ </size>
2438+ </property>
2439+ <property name="text">
2440+ <string/>
2441+ </property>
2442+ <property name="maxLength">
2443+ <number>50</number>
2444+ </property>
2445+ </widget>
2446+ </item>
2447+ <item row="1" column="2">
2448+ <widget class="QLabel" name="label_13">
2449+ <property name="text">
2450+ <string>Configuration:</string>
2451+ </property>
2452+ <property name="alignment">
2453+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2454+ </property>
2455+ </widget>
2456+ </item>
2457+ <item row="1" column="3">
2458+ <widget class="QLineEdit" name="toggleConfigWindowLineEdit">
2459+ <property name="sizePolicy">
2460+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2461+ <horstretch>0</horstretch>
2462+ <verstretch>0</verstretch>
2463+ </sizepolicy>
2464+ </property>
2465+ <property name="baseSize">
2466+ <size>
2467+ <width>100</width>
2468+ <height>22</height>
2469+ </size>
2470+ </property>
2471+ <property name="maxLength">
2472+ <number>50</number>
2473+ </property>
2474+ </widget>
2475+ </item>
2476+ <item row="2" column="0">
2477+ <widget class="QLabel" name="label_14">
2478+ <property name="text">
2479+ <string>Telrad:</string>
2480+ </property>
2481+ <property name="alignment">
2482+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2483+ </property>
2484+ </widget>
2485+ </item>
2486+ <item row="2" column="1" rowspan="2">
2487+ <widget class="QLineEdit" name="toggleTelradLineEdit">
2488+ <property name="sizePolicy">
2489+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2490+ <horstretch>0</horstretch>
2491+ <verstretch>0</verstretch>
2492+ </sizepolicy>
2493+ </property>
2494+ <property name="baseSize">
2495+ <size>
2496+ <width>100</width>
2497+ <height>22</height>
2498+ </size>
2499+ </property>
2500+ <property name="maxLength">
2501+ <number>50</number>
2502+ </property>
2503+ </widget>
2504+ </item>
2505+ <item row="2" column="2">
2506+ <widget class="QLabel" name="label_15">
2507+ <property name="text">
2508+ <string>Crosshair:</string>
2509+ </property>
2510+ <property name="alignment">
2511+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2512+ </property>
2513+ </widget>
2514+ </item>
2515+ <item row="2" column="3" rowspan="2">
2516+ <widget class="QLineEdit" name="toggleCrosshairLineEdit">
2517+ <property name="sizePolicy">
2518+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2519+ <horstretch>0</horstretch>
2520+ <verstretch>0</verstretch>
2521+ </sizepolicy>
2522+ </property>
2523+ <property name="baseSize">
2524+ <size>
2525+ <width>100</width>
2526+ <height>22</height>
2527+ </size>
2528+ </property>
2529+ <property name="text">
2530+ <string/>
2531+ </property>
2532+ <property name="maxLength">
2533+ <number>50</number>
2534+ </property>
2535+ </widget>
2536+ </item>
2537+ <item row="4" column="1">
2538+ <widget class="QLabel" name="label_22">
2539+ <property name="text">
2540+ <string>Previous</string>
2541+ </property>
2542+ </widget>
2543+ </item>
2544+ <item row="4" column="3">
2545+ <widget class="QLabel" name="label_23">
2546+ <property name="text">
2547+ <string>Next</string>
2548+ </property>
2549+ </widget>
2550+ </item>
2551+ <item row="5" column="0">
2552+ <widget class="QLabel" name="label_16">
2553+ <property name="text">
2554+ <string>CCD:</string>
2555+ </property>
2556+ <property name="alignment">
2557+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2558+ </property>
2559+ </widget>
2560+ </item>
2561+ <item row="5" column="1">
2562+ <widget class="QLineEdit" name="previousCCDLineEdit">
2563+ <property name="sizePolicy">
2564+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2565+ <horstretch>0</horstretch>
2566+ <verstretch>0</verstretch>
2567+ </sizepolicy>
2568+ </property>
2569+ <property name="baseSize">
2570+ <size>
2571+ <width>100</width>
2572+ <height>22</height>
2573+ </size>
2574+ </property>
2575+ <property name="text">
2576+ <string/>
2577+ </property>
2578+ <property name="maxLength">
2579+ <number>50</number>
2580+ </property>
2581+ </widget>
2582+ </item>
2583+ <item row="5" column="3">
2584+ <widget class="QLineEdit" name="nextCCDLineEdit">
2585+ <property name="sizePolicy">
2586+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2587+ <horstretch>0</horstretch>
2588+ <verstretch>0</verstretch>
2589+ </sizepolicy>
2590+ </property>
2591+ <property name="baseSize">
2592+ <size>
2593+ <width>100</width>
2594+ <height>22</height>
2595+ </size>
2596+ </property>
2597+ <property name="text">
2598+ <string/>
2599+ </property>
2600+ <property name="maxLength">
2601+ <number>50</number>
2602+ </property>
2603+ </widget>
2604+ </item>
2605+ <item row="6" column="0">
2606+ <widget class="QLabel" name="label_18">
2607+ <property name="text">
2608+ <string>Ocular:</string>
2609+ </property>
2610+ <property name="alignment">
2611+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2612+ </property>
2613+ </widget>
2614+ </item>
2615+ <item row="6" column="1">
2616+ <widget class="QLineEdit" name="previousOcularLineEdit">
2617+ <property name="sizePolicy">
2618+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2619+ <horstretch>0</horstretch>
2620+ <verstretch>0</verstretch>
2621+ </sizepolicy>
2622+ </property>
2623+ <property name="baseSize">
2624+ <size>
2625+ <width>100</width>
2626+ <height>22</height>
2627+ </size>
2628+ </property>
2629+ <property name="text">
2630+ <string/>
2631+ </property>
2632+ <property name="maxLength">
2633+ <number>50</number>
2634+ </property>
2635+ </widget>
2636+ </item>
2637+ <item row="6" column="3">
2638+ <widget class="QLineEdit" name="nextOcularLineEdit">
2639+ <property name="sizePolicy">
2640+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2641+ <horstretch>0</horstretch>
2642+ <verstretch>0</verstretch>
2643+ </sizepolicy>
2644+ </property>
2645+ <property name="baseSize">
2646+ <size>
2647+ <width>100</width>
2648+ <height>22</height>
2649+ </size>
2650+ </property>
2651+ <property name="text">
2652+ <string/>
2653+ </property>
2654+ <property name="maxLength">
2655+ <number>50</number>
2656+ </property>
2657+ </widget>
2658+ </item>
2659+ <item row="7" column="0">
2660+ <widget class="QLabel" name="label_20">
2661+ <property name="text">
2662+ <string>Telescope:</string>
2663+ </property>
2664+ <property name="alignment">
2665+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2666+ </property>
2667+ </widget>
2668+ </item>
2669+ <item row="7" column="1">
2670+ <widget class="QLineEdit" name="previousTelescopeLineEdit">
2671+ <property name="sizePolicy">
2672+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2673+ <horstretch>0</horstretch>
2674+ <verstretch>0</verstretch>
2675+ </sizepolicy>
2676+ </property>
2677+ <property name="baseSize">
2678+ <size>
2679+ <width>100</width>
2680+ <height>22</height>
2681+ </size>
2682+ </property>
2683+ <property name="text">
2684+ <string/>
2685+ </property>
2686+ <property name="maxLength">
2687+ <number>50</number>
2688+ </property>
2689+ </widget>
2690+ </item>
2691+ <item row="7" column="3">
2692+ <widget class="QLineEdit" name="nextTelescopeLineEdit">
2693+ <property name="sizePolicy">
2694+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2695+ <horstretch>0</horstretch>
2696+ <verstretch>0</verstretch>
2697+ </sizepolicy>
2698+ </property>
2699+ <property name="baseSize">
2700+ <size>
2701+ <width>100</width>
2702+ <height>22</height>
2703+ </size>
2704+ </property>
2705+ <property name="text">
2706+ <string/>
2707+ </property>
2708+ <property name="maxLength">
2709+ <number>50</number>
2710+ </property>
2711+ </widget>
2712+ </item>
2713+ <item row="7" column="2">
2714+ <widget class="QLabel" name="label_21">
2715+ <property name="text">
2716+ <string>Telescope:</string>
2717+ </property>
2718+ <property name="alignment">
2719+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2720+ </property>
2721+ </widget>
2722+ </item>
2723+ <item row="6" column="2">
2724+ <widget class="QLabel" name="label_19">
2725+ <property name="text">
2726+ <string>Ocular:</string>
2727+ </property>
2728+ <property name="alignment">
2729+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2730+ </property>
2731+ </widget>
2732+ </item>
2733+ <item row="5" column="2">
2734+ <widget class="QLabel" name="label_17">
2735+ <property name="text">
2736+ <string>CCD:</string>
2737+ </property>
2738+ <property name="alignment">
2739+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
2740+ </property>
2741+ </widget>
2742+ </item>
2743+ </layout>
2744+ </widget>
2745 </widget>
2746 <widget class="QWidget" name="Eyepieces">
2747 <attribute name="title">
2748@@ -428,60 +785,6 @@
2749 </widget>
2750 </item>
2751 <item>
2752- <widget class="QFrame" name="frame_2">
2753- <property name="frameShape">
2754- <enum>QFrame::StyledPanel</enum>
2755- </property>
2756- <property name="frameShadow">
2757- <enum>QFrame::Raised</enum>
2758- </property>
2759- <layout class="QHBoxLayout" name="horizontalLayout_3">
2760- <property name="spacing">
2761- <number>0</number>
2762- </property>
2763- <property name="topMargin">
2764- <number>0</number>
2765- </property>
2766- <property name="bottomMargin">
2767- <number>12</number>
2768- </property>
2769- <item>
2770- <spacer name="horizontalSpacer_2">
2771- <property name="orientation">
2772- <enum>Qt::Horizontal</enum>
2773- </property>
2774- <property name="sizeHint" stdset="0">
2775- <size>
2776- <width>68</width>
2777- <height>20</height>
2778- </size>
2779- </property>
2780- </spacer>
2781- </item>
2782- <item>
2783- <widget class="QPushButton" name="updateOcularButton">
2784- <property name="text">
2785- <string>Update Ocular</string>
2786- </property>
2787- </widget>
2788- </item>
2789- <item>
2790- <spacer name="horizontalSpacer_4">
2791- <property name="orientation">
2792- <enum>Qt::Horizontal</enum>
2793- </property>
2794- <property name="sizeHint" stdset="0">
2795- <size>
2796- <width>68</width>
2797- <height>20</height>
2798- </size>
2799- </property>
2800- </spacer>
2801- </item>
2802- </layout>
2803- </widget>
2804- </item>
2805- <item>
2806 <spacer name="verticalSpacer">
2807 <property name="orientation">
2808 <enum>Qt::Vertical</enum>
2809@@ -669,7 +972,7 @@
2810 </widget>
2811 </item>
2812 <item row="1" column="1">
2813- <widget class="QLineEdit" name="CCDName">
2814+ <widget class="QLineEdit" name="ccdName">
2815 <property name="sizePolicy">
2816 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2817 <horstretch>0</horstretch>
2818@@ -695,7 +998,7 @@
2819 </widget>
2820 </item>
2821 <item row="2" column="1">
2822- <widget class="QLineEdit" name="CCDResX">
2823+ <widget class="QLineEdit" name="ccdResX">
2824 <property name="sizePolicy">
2825 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2826 <horstretch>0</horstretch>
2827@@ -721,7 +1024,7 @@
2828 </widget>
2829 </item>
2830 <item row="3" column="1">
2831- <widget class="QLineEdit" name="CCDResY">
2832+ <widget class="QLineEdit" name="ccdResY">
2833 <property name="sizePolicy">
2834 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2835 <horstretch>0</horstretch>
2836@@ -747,7 +1050,7 @@
2837 </widget>
2838 </item>
2839 <item row="4" column="1">
2840- <widget class="QLineEdit" name="CCDChipX">
2841+ <widget class="QLineEdit" name="ccdChipX">
2842 <property name="sizePolicy">
2843 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2844 <horstretch>0</horstretch>
2845@@ -773,7 +1076,7 @@
2846 </widget>
2847 </item>
2848 <item row="5" column="1">
2849- <widget class="QLineEdit" name="CCDChipY">
2850+ <widget class="QLineEdit" name="ccdChipY">
2851 <property name="sizePolicy">
2852 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2853 <horstretch>0</horstretch>
2854@@ -799,7 +1102,7 @@
2855 </widget>
2856 </item>
2857 <item row="6" column="1">
2858- <widget class="QLineEdit" name="CCDPixelX">
2859+ <widget class="QLineEdit" name="ccdPixelX">
2860 <property name="sizePolicy">
2861 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2862 <horstretch>0</horstretch>
2863@@ -825,7 +1128,7 @@
2864 </widget>
2865 </item>
2866 <item row="7" column="1">
2867- <widget class="QLineEdit" name="CCDPixelY">
2868+ <widget class="QLineEdit" name="ccdPixelY">
2869 <property name="sizePolicy">
2870 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2871 <horstretch>0</horstretch>
2872@@ -847,60 +1150,6 @@
2873 </widget>
2874 </item>
2875 <item>
2876- <widget class="QFrame" name="CCDframe_update">
2877- <property name="frameShape">
2878- <enum>QFrame::StyledPanel</enum>
2879- </property>
2880- <property name="frameShadow">
2881- <enum>QFrame::Raised</enum>
2882- </property>
2883- <layout class="QHBoxLayout" name="CCD_horizontalLayout_3">
2884- <property name="spacing">
2885- <number>0</number>
2886- </property>
2887- <property name="topMargin">
2888- <number>0</number>
2889- </property>
2890- <property name="bottomMargin">
2891- <number>12</number>
2892- </property>
2893- <item>
2894- <spacer name="horizontalSpacer_CCD_update_left">
2895- <property name="orientation">
2896- <enum>Qt::Horizontal</enum>
2897- </property>
2898- <property name="sizeHint" stdset="0">
2899- <size>
2900- <width>68</width>
2901- <height>20</height>
2902- </size>
2903- </property>
2904- </spacer>
2905- </item>
2906- <item>
2907- <widget class="QPushButton" name="updateCCDButton">
2908- <property name="text">
2909- <string>Update Sensor</string>
2910- </property>
2911- </widget>
2912- </item>
2913- <item>
2914- <spacer name="horizontalSpacer_CCD_update_right">
2915- <property name="orientation">
2916- <enum>Qt::Horizontal</enum>
2917- </property>
2918- <property name="sizeHint" stdset="0">
2919- <size>
2920- <width>68</width>
2921- <height>20</height>
2922- </size>
2923- </property>
2924- </spacer>
2925- </item>
2926- </layout>
2927- </widget>
2928- </item>
2929- <item>
2930 <spacer name="CCDverticalSpacer">
2931 <property name="orientation">
2932 <enum>Qt::Vertical</enum>
2933@@ -1125,60 +1374,6 @@
2934 </widget>
2935 </item>
2936 <item>
2937- <widget class="QFrame" name="frame_6">
2938- <property name="frameShape">
2939- <enum>QFrame::StyledPanel</enum>
2940- </property>
2941- <property name="frameShadow">
2942- <enum>QFrame::Raised</enum>
2943- </property>
2944- <layout class="QHBoxLayout" name="horizontalLayout_4">
2945- <property name="spacing">
2946- <number>0</number>
2947- </property>
2948- <property name="topMargin">
2949- <number>0</number>
2950- </property>
2951- <property name="bottomMargin">
2952- <number>12</number>
2953- </property>
2954- <item>
2955- <spacer name="horizontalSpacer_5">
2956- <property name="orientation">
2957- <enum>Qt::Horizontal</enum>
2958- </property>
2959- <property name="sizeHint" stdset="0">
2960- <size>
2961- <width>40</width>
2962- <height>20</height>
2963- </size>
2964- </property>
2965- </spacer>
2966- </item>
2967- <item>
2968- <widget class="QPushButton" name="updateTelescopeButton">
2969- <property name="text">
2970- <string>Update Telescope</string>
2971- </property>
2972- </widget>
2973- </item>
2974- <item>
2975- <spacer name="horizontalSpacer_6">
2976- <property name="orientation">
2977- <enum>Qt::Horizontal</enum>
2978- </property>
2979- <property name="sizeHint" stdset="0">
2980- <size>
2981- <width>40</width>
2982- <height>20</height>
2983- </size>
2984- </property>
2985- </spacer>
2986- </item>
2987- </layout>
2988- </widget>
2989- </item>
2990- <item>
2991 <spacer name="verticalSpacer_2">
2992 <property name="orientation">
2993 <enum>Qt::Vertical</enum>
2994@@ -1220,15 +1415,18 @@
2995 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
2996 p, li { white-space: pre-wrap; }
2997 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
2998+&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
2999+&lt;tr&gt;
3000+&lt;td style=&quot;border: none;&quot;&gt;
3001 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Author: &lt;a href=&quot;treaves@silverfieldstech.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Timothy Reaves&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
3002 &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
3003-&lt;p style=&quot; margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:xx-large; font-weight:600;&quot;&gt;Overview&lt;/span&gt;&lt;/p&gt;
3004+&lt;p style=&quot; margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Overview&lt;/span&gt;&lt;/p&gt;
3005 &lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This plugin is intended to simulate what you would see through an eyepiece. This configuration dialog can be used to add, modify, or delete eyepieces and telescopes, as well as CCD Sensors. Your first time running the app will populate some samples to get your started.&lt;/p&gt;
3006 &lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;You can choose to scale the image you see on the screen. This is intended to show you a better comparison of what one eyepiece/telescope combination will be like as compared to another. The same eyepiece in two different telescopes of differing focal length will produce two different exit circles, changing the view someone. The trade-off of this is that, with the image scaled, a good deal of the screen can be wasted. Therefor I recommend that you leave it off, unless you feel you have a need of it.&lt;/p&gt;
3007 &lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;You can toggle a crosshair in the view. Ideally, I wanted this to be aligned to North. I've been unable to do so. So currently it aligns to the top of the screen.&lt;/p&gt;
3008 &lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;You can toggle a Telrad finder; this can only be done when you have not turned on the Ocular view. This feature draws three concentric circles of 0.5°, 2.0°, and 4.0°, helping you see what you would expect to see with the naked eye through the Telrad (or similar) finder.&lt;/p&gt;
3009 &lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If you find any issues, please let me know. Enjoy!&lt;/p&gt;
3010-&lt;p style=&quot; margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:xx-large; font-weight:600;&quot;&gt;Hot Keys&lt;/span&gt;&lt;/p&gt;
3011+&lt;p style=&quot; margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Hot Keys&lt;/span&gt;&lt;/p&gt;
3012 &lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;There are several keys that allow you to use the features of this plugin. If you are not a Mac user, replace the &lt;span style=&quot; font-style:italic;&quot;&gt;Command&lt;/span&gt; key with the &lt;span style=&quot; font-style:italic;&quot;&gt;CTRL&lt;/span&gt; key.&lt;/p&gt;
3013 &lt;p style=&quot; margin-top:8px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Command-B&lt;/span&gt;&lt;/p&gt;
3014 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:30px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Activate / de-activate the Telrad overlay. Only available when not using an ocular. This will display a 0.5°, 2.0°, and 4.0° red circle at the center of the screen.&lt;/p&gt;
3015@@ -1249,7 +1447,7 @@
3016 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Alt-C&lt;/span&gt;&lt;/p&gt;
3017 &lt;p style=&quot; margin-top:0px; margin-bottom:8px; margin-left:30px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Toggle the reticale on and off.&lt;/p&gt;
3018 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Alt-O&lt;/span&gt;&lt;/p&gt;
3019-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:30px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Shows this configuration dialog. Unfortunatly, you must close it by clicking the close button. I've been unable to figure out why this does not toggle the dialog open and close.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
3020+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:30px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Shows this configuration dialog. Unfortunatly, you must close it by clicking the close button. I've been unable to figure out why this does not toggle the dialog open and close.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
3021 </property>
3022 </widget>
3023 </item>