TelescopeDialog.cpp   TelescopeDialog.cpp 
skipping to change at line 47 skipping to change at line 47
#include <QFile> #include <QFile>
#include <QFileDialog> #include <QFileDialog>
#include <QHash> #include <QHash>
#include <QHeaderView> #include <QHeaderView>
#include <QSettings> #include <QSettings>
#include <QStandardItem> #include <QStandardItem>
using namespace TelescopeControlGlobals; using namespace TelescopeControlGlobals;
TelescopeDialog::TelescopeDialog() TelescopeDialog::TelescopeDialog()
: telescopeCount(0)
, configuredSlot(0)
, configuredTelescopeIsNew(false)
{ {
telescopeStatus[0] = StatusNA;
telescopeType[0] = ConnectionNA;
ui = new Ui_telescopeDialogForm; ui = new Ui_telescopeDialogForm;
//TODO: Fix this - it's in the same plugin //TODO: Fix this - it's in the same plugin
telescopeManager = GETSTELMODULE(TelescopeControl); telescopeManager = GETSTELMODULE(TelescopeControl);
telescopeListModel = new QStandardItemModel(0, ColumnCount); telescopeListModel = new QStandardItemModel(0, ColumnCount);
//TODO: This shouldn't be a hash... //TODO: This shouldn't be a hash...
statusString[StatusNA] = QString(N_("N/A")); statusString[StatusNA] = QString(N_("N/A"));
statusString[StatusStarting] = QString(N_("Starting")); statusString[StatusStarting] = QString(N_("Starting"));
statusString[StatusConnecting] = QString(N_("Connecting")); statusString[StatusConnecting] = QString(N_("Connecting"));
statusString[StatusConnected] = QString(N_("Connected")); statusString[StatusConnected] = QString(N_("Connected"));
statusString[StatusDisconnected] = QString(N_("Disconnected")); statusString[StatusDisconnected] = QString(N_("Disconnected"));
statusString[StatusStopped] = QString(N_("Stopped")); statusString[StatusStopped] = QString(N_("Stopped"));
telescopeCount = 0;
} }
TelescopeDialog::~TelescopeDialog() TelescopeDialog::~TelescopeDialog()
{ {
delete ui; delete ui;
delete telescopeListModel; delete telescopeListModel;
} }
void TelescopeDialog::retranslate() void TelescopeDialog::retranslate()
skipping to change at line 140 skipping to change at line 144
connect(&configurationDialog, SIGNAL(changesSaved(QString, Connectio nType)), this, SLOT(saveChanges(QString, ConnectionType))); connect(&configurationDialog, SIGNAL(changesSaved(QString, Connectio nType)), this, SLOT(saveChanges(QString, ConnectionType)));
//Initialize the style //Initialize the style
updateStyle(); updateStyle();
//Initializing the list of telescopes //Initializing the list of telescopes
telescopeListModel->setColumnCount(ColumnCount); telescopeListModel->setColumnCount(ColumnCount);
setHeaderNames(); setHeaderNames();
ui->telescopeTreeView->setModel(telescopeListModel); ui->telescopeTreeView->setModel(telescopeListModel);
ui->telescopeTreeView->header()->setMovable(false); ui->telescopeTreeView->header()->setSectionsMovable(false);
ui->telescopeTreeView->header()->setResizeMode(ColumnSlot, QHeaderVi ui->telescopeTreeView->header()->setSectionResizeMode(ColumnSlot, QH
ew::ResizeToContents); eaderView::ResizeToContents);
ui->telescopeTreeView->header()->setStretchLastSection(true); ui->telescopeTreeView->header()->setStretchLastSection(true);
//Populating the list //Populating the list
//Cycle the slots //Cycle the slots
for (int slotNumber = MIN_SLOT_NUMBER; slotNumber < SLOT_NUMBER_LIMI T; slotNumber++) for (int slotNumber = MIN_SLOT_NUMBER; slotNumber < SLOT_NUMBER_LIMI T; slotNumber++)
{ {
//Slot # //Slot #
//int slotNumber = (i+1)%SLOT_COUNT;//Making sure slot 0 is last //int slotNumber = (i+1)%SLOT_COUNT;//Making sure slot 0 is last
//Make sure that this is initialized for all slots //Make sure that this is initialized for all slots
skipping to change at line 199 skipping to change at line 203
//Finished populating the table, let's sort it by slot number //Finished populating the table, let's sort it by slot number
//ui->telescopeTreeView->setSortingEnabled(true);//Set in the .ui fi le //ui->telescopeTreeView->setSortingEnabled(true);//Set in the .ui fi le
ui->telescopeTreeView->sortByColumn(ColumnSlot, Qt::AscendingOrder); ui->telescopeTreeView->sortByColumn(ColumnSlot, Qt::AscendingOrder);
//(Works even when the table is empty) //(Works even when the table is empty)
//(Makes redundant the delay of 0 above) //(Makes redundant the delay of 0 above)
//TODO: Reuse code. //TODO: Reuse code.
if(telescopeCount > 0) if(telescopeCount > 0)
{ {
ui->telescopeTreeView->setFocus(); ui->telescopeTreeView->setFocus();
ui->telescopeTreeView->header()->setResizeMode(ColumnType, Q HeaderView::ResizeToContents); ui->telescopeTreeView->header()->setSectionResizeMode(Column Type, QHeaderView::ResizeToContents);
} }
else else
{ {
ui->pushButtonChangeStatus->setEnabled(false); ui->pushButtonChangeStatus->setEnabled(false);
ui->pushButtonConfigure->setEnabled(false); ui->pushButtonConfigure->setEnabled(false);
ui->pushButtonRemove->setEnabled(false); ui->pushButtonRemove->setEnabled(false);
ui->pushButtonAdd->setFocus(); ui->pushButtonAdd->setFocus();
} }
updateWarningTexts(); updateWarningTexts();
skipping to change at line 240 skipping to change at line 244
updateTimer->start(200); updateTimer->start(200);
} }
void TelescopeDialog::setAboutText() void TelescopeDialog::setAboutText()
{ {
//TODO: Expand //TODO: Expand
QString aboutPage = "<html><head></head><body>"; QString aboutPage = "<html><head></head><body>";
aboutPage += QString("<h2>%1</h2>").arg(q_("Telescope Control plug-i n")); aboutPage += QString("<h2>%1</h2>").arg(q_("Telescope Control plug-i n"));
aboutPage += "<h3>" + QString(q_("Version %1")).arg(TELESCOPE_CONTRO L_VERSION) + "</h3>"; aboutPage += "<h3>" + QString(q_("Version %1")).arg(TELESCOPE_CONTRO L_VERSION) + "</h3>";
QFile aboutFile(":/telescopeControl/about.utf8"); QFile aboutFile(":/telescopeControl/about.utf8");
aboutFile.open(QFile::ReadOnly | QFile::Text); if(aboutFile.open(QFile::ReadOnly | QFile::Text))
aboutPage += aboutFile.readAll(); {
aboutFile.close(); aboutPage += aboutFile.readAll();
aboutFile.close();
}
aboutPage += "</body></html>"; aboutPage += "</body></html>";
QString helpPage = "<html><head></head><body>"; QString helpPage = "<html><head></head><body>";
QFile helpFile(":/telescopeControl/help.utf8"); QFile helpFile(":/telescopeControl/help.utf8");
helpFile.open(QFile::ReadOnly | QFile::Text); if(helpFile.open(QFile::ReadOnly | QFile::Text))
helpPage += helpFile.readAll(); {
helpFile.close(); helpPage += helpFile.readAll();
helpFile.close();
}
helpPage += "</body></html>"; helpPage += "</body></html>";
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
Q_ASSERT(gui); Q_ASSERT(gui);
ui->textBrowserAbout->document()->setDefaultStyleSheet(QString(gui-> getStelStyle().htmlStyleSheet)); ui->textBrowserAbout->document()->setDefaultStyleSheet(QString(gui-> getStelStyle().htmlStyleSheet));
ui->textBrowserHelp->document()->setDefaultStyleSheet(QString(gui->g etStelStyle().htmlStyleSheet)); ui->textBrowserHelp->document()->setDefaultStyleSheet(QString(gui->g etStelStyle().htmlStyleSheet));
ui->textBrowserAbout->setHtml(aboutPage); ui->textBrowserAbout->setHtml(aboutPage);
ui->textBrowserHelp->setHtml(helpPage); ui->textBrowserHelp->setHtml(helpPage);
} }
skipping to change at line 551 skipping to change at line 559
//Save the changes to file //Save the changes to file
telescopeManager->saveTelescopes(); telescopeManager->saveTelescopes();
telescopeStatus[selectedSlot] = StatusNA; telescopeStatus[selectedSlot] = StatusNA;
telescopeCount -= 1; telescopeCount -= 1;
//Update the interface to reflect the changes: //Update the interface to reflect the changes:
//Make sure that the header section keeps it size //Make sure that the header section keeps it size
if(telescopeCount == 0) if(telescopeCount == 0)
ui->telescopeTreeView->header()->setResizeMode(ColumnType, Q HeaderView::Interactive); ui->telescopeTreeView->header()->setSectionResizeMode(Column Type, QHeaderView::Interactive);
//Remove the telescope from the table/tree //Remove the telescope from the table/tree
telescopeListModel->removeRow(ui->telescopeTreeView->currentIndex(). row()); telescopeListModel->removeRow(ui->telescopeTreeView->currentIndex(). row());
//If there are less than the maximal number of telescopes now, new o nes can be added //If there are less than the maximal number of telescopes now, new o nes can be added
if(telescopeCount < SLOT_COUNT) if(telescopeCount < SLOT_COUNT)
ui->pushButtonAdd->setEnabled(true); ui->pushButtonAdd->setEnabled(true);
//If there are no telescopes left, disable some buttons //If there are no telescopes left, disable some buttons
if(telescopeCount == 0) if(telescopeCount == 0)
skipping to change at line 629 skipping to change at line 637
//Can't add more telescopes if they have reached the maximum number //Can't add more telescopes if they have reached the maximum number
if (telescopeCount >= SLOT_COUNT) if (telescopeCount >= SLOT_COUNT)
ui->pushButtonAdd->setEnabled(false); ui->pushButtonAdd->setEnabled(false);
// //
if (telescopeCount == 0) if (telescopeCount == 0)
{ {
ui->pushButtonChangeStatus->setEnabled(false); ui->pushButtonChangeStatus->setEnabled(false);
ui->pushButtonConfigure->setEnabled(false); ui->pushButtonConfigure->setEnabled(false);
ui->pushButtonRemove->setEnabled(false); ui->pushButtonRemove->setEnabled(false);
ui->telescopeTreeView->header()->setResizeMode(ColumnType, Q HeaderView::Interactive); ui->telescopeTreeView->header()->setSectionResizeMode(Column Type, QHeaderView::Interactive);
} }
else else
{ {
ui->telescopeTreeView->setFocus(); ui->telescopeTreeView->setFocus();
ui->telescopeTreeView->setCurrentIndex(telescopeListModel->i ndex(0,0)); ui->telescopeTreeView->setCurrentIndex(telescopeListModel->i ndex(0,0));
ui->pushButtonConfigure->setEnabled(true); ui->pushButtonConfigure->setEnabled(true);
ui->pushButtonRemove->setEnabled(true); ui->pushButtonRemove->setEnabled(true);
ui->telescopeTreeView->header()->setResizeMode(ColumnType, Q HeaderView::ResizeToContents); ui->telescopeTreeView->header()->setSectionResizeMode(Column Type, QHeaderView::ResizeToContents);
} }
updateWarningTexts(); updateWarningTexts();
configuredTelescopeIsNew = false; configuredTelescopeIsNew = false;
configurationDialog.setVisible(false); configurationDialog.setVisible(false);
setVisible(true);//Brings the current window to the foreground setVisible(true);//Brings the current window to the foreground
} }
void TelescopeDialog::discardChanges() void TelescopeDialog::discardChanges()
{ {
 End of changes. 10 change blocks. 
15 lines changed or deleted 23 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/