Commit ac956f9e authored by Jasem Mutlaq's avatar Jasem Mutlaq

Fix odd Windows bug, add splitters, remove miniButton

parent cc7aa3a2
......@@ -92,8 +92,7 @@ ObservingListUI::ObservingListUI(QWidget *p) : QFrame(p)
// ObservingList
// ---------------------------------
ObservingList::ObservingList()
: QDialog((QWidget *)KStars::Instance()), LogObject(0), m_CurrentObject(0), isModified(false), bIsLarge(true),
m_dl(0)
: QDialog((QWidget *)KStars::Instance()), LogObject(0), m_CurrentObject(0), isModified(false), m_dl(0)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
......@@ -101,16 +100,8 @@ ObservingList::ObservingList()
ui = new ObservingListUI(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(ui);
mainLayout->setMargin(3);
setWindowTitle(i18n("Observation Planner"));
// Close button seems redundant since one can close the window -- occupies space
/*
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
mainLayout->addWidget(buttonBox);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
*/
setLayout(mainLayout);
dt = KStarsDateTime::currentDateTime();
......@@ -176,7 +167,6 @@ ObservingList::ObservingList()
connect(ui->SaveButton, SIGNAL(clicked()), this, SLOT(slotSaveSession()));
connect(ui->SaveAsButton, SIGNAL(clicked()), this, SLOT(slotSaveSessionAs()));
connect(ui->WizardButton, SIGNAL(clicked()), this, SLOT(slotWizard()));
connect(ui->MiniButton, SIGNAL(clicked()), this, SLOT(slotToggleSize()));
connect(ui->SetLocation, SIGNAL(clicked()), this, SLOT(slotLocation()));
connect(ui->Update, SIGNAL(clicked()), this, SLOT(slotUpdate()));
connect(ui->DeleteImage, SIGNAL(clicked()), this, SLOT(slotDeleteCurrentImage()));
......@@ -197,7 +187,6 @@ ObservingList::ObservingList()
ui->SaveAsButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
ui->WizardButton->setIcon(QIcon::fromTheme("tools-wizard", QIcon(":/icons/breeze/default/tools-wizard.svg")));
ui->WizardButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
ui->MiniButton->setIcon(QIcon::fromTheme("view-restore", QIcon(":/icons/breeze/default/view-restore.svg")));
noSelection = true;
showScope = false;
ui->NotesEdit->setEnabled(false);
......@@ -245,6 +234,12 @@ ObservingList::ObservingList()
// qDebug() << "Updating altitude for " << p.ra().toHMSString() << " " << p.dec().toDMSString() << " alt = " << p.alt().toDMSString() << " info to " << itemText;
return altItem;
};
// Needed to fix weird bug on Windows that started with Qt 5.9 that makes the title bar
// not visible and therefore dialog not movable.
#ifdef Q_OS_WIN
move(100,100);
#endif
}
ObservingList::~ObservingList()
......@@ -267,13 +262,7 @@ void ObservingList::showEvent(QShowEvent *)
slotLoadWishList(); //Load the wishlist from disk if present
m_CurrentObject = 0;
setSaveImagesButton();
//Hide the MiniButton until I can figure out how to resize the Dialog!
// ui->MiniButton->hide();
// Set up for the large-size view
bIsLarge = false;
slotToggleSize();
setSaveImagesButton();
slotUpdateAltitudes();
m_altitudeUpdater = new QTimer(this);
......@@ -1186,89 +1175,6 @@ double ObservingList::findAltitude(SkyPoint *p, double hour)
return sp.alt().Degrees();
}
void ObservingList::slotToggleSize()
{
if (isLarge())
{
ui->MiniButton->setIcon(
QIcon::fromTheme("view-fullscreen", QIcon(":/icons/breeze/default/view-fullscreen.svg")));
//Abbreviate text on each button
ui->FindButton->setText("");
ui->FindButton->setIcon(QIcon::fromTheme("edit-find", QIcon(":/icons/breeze/default/edit-find.svg")));
ui->WUTButton->setText(i18nc("Abbreviation of What's Up Tonight", "WUT"));
ui->saveImages->setText("");
ui->DeleteAllImages->setText("");
ui->saveImages->setIcon(QIcon::fromTheme("download", QIcon(":/icons/breeze/default/download.svg")));
ui->DeleteAllImages->setIcon(QIcon::fromTheme("edit-delete", QIcon(":/icons/breeze/default/edit-delete.svg")));
ui->refLabel->setText(i18nc("Abbreviation for Reference Images:", "RefImg:"));
ui->addLabel->setText(i18nc("Add objects to a list", "Add:"));
//Hide columns 1-5
ui->WishListView->hideColumn(1);
ui->WishListView->hideColumn(2);
ui->WishListView->hideColumn(3);
ui->WishListView->hideColumn(4);
ui->WishListView->hideColumn(5);
//Hide the headers
ui->WishListView->horizontalHeader()->hide();
ui->WishListView->verticalHeader()->hide();
//Hide Observing notes
ui->NotesEdit->hide();
//ui->kseparator->hide();
ui->avt->hide();
ui->dssMetadataLabel->hide();
ui->setMinimumSize(320, 600);
//Set the width of the Table to be the width of 5 toolbar buttons,
//or the width of column 1, whichever is larger
/*
int w = 5*ui->MiniButton->width();
if ( ui->WishListView->columnWidth(0) > w ) {
w = ui->WishListView->columnWidth(0);
} else {
ui->WishListView->setColumnWidth(0, w);
}
int left, right, top, bottom;
ui->layout()->getContentsMargins( &left, &top, &right, &bottom );
resize( w + left + right, height() );
*/
bIsLarge = false;
ui->resize(400, ui->height());
adjustSize();
this->resize(400, this->height());
update();
}
else
{
ui->MiniButton->setIcon(QIcon::fromTheme("view-restore", QIcon(":/icons/breeze/default/view-restore.svg")));
//Show columns 1-5
ui->WishListView->showColumn(1);
ui->WishListView->showColumn(2);
ui->WishListView->showColumn(3);
ui->WishListView->showColumn(4);
ui->WishListView->showColumn(5);
//Show the horizontal header
ui->WishListView->horizontalHeader()->show();
//Expand text on each button
ui->FindButton->setText(i18n("Find &Object"));
ui->saveImages->setText(i18n("Download all Images"));
ui->DeleteAllImages->setText(i18n("Delete all Images"));
ui->FindButton->setIcon(QIcon());
ui->saveImages->setIcon(QIcon());
ui->DeleteAllImages->setIcon(QIcon());
ui->WUTButton->setText(i18n("What's up Tonight tool"));
ui->refLabel->setText(i18nc("Abbreviation for Reference Images:", "Reference Images:"));
ui->addLabel->setText(i18nc("Add objects to a list", "Adding Objects:"));
//Show Observing notes
ui->NotesEdit->show();
//ui->kseparator->show();
ui->setMinimumSize(837, 650);
ui->avt->show();
ui->dssMetadataLabel->show();
adjustSize();
update();
bIsLarge = true;
}
}
void ObservingList::slotChangeTab(int index)
{
noSelection = true;
......
......@@ -95,10 +95,6 @@ class ObservingList : public QDialog
*/
~ObservingList();
/** @return true if the window is in its default "large" state.
*/
bool isLarge() const { return bIsLarge; }
/** @return reference to the current observing list
*/
QList<QSharedPointer<SkyObject>> &obsList() { return m_WishList; }
......@@ -278,10 +274,6 @@ class ObservingList : public QDialog
*/
void slotWizard();
/** @short toggle between the large and small window states
*/
void slotToggleSize();
/** @short toggle the setEnabled flags according to current view
*set the m_currentItem to nullptr and clear selections
*@p index captures the integer value sent by the signal
......@@ -410,7 +402,7 @@ class ObservingList : public QDialog
ObservingListUI *ui;
QList<QSharedPointer<SkyObject>> m_WishList, m_SessionList;
SkyObject *LogObject, *m_CurrentObject;
bool isModified, bIsLarge, sessionView, dss, singleSelection, showScope, noSelection;
bool isModified, sessionView, dss, singleSelection, showScope, noSelection;
QString m_listFileName, m_currentImageFileName, m_currentThumbImageFileName;
KStarsDateTime dt;
GeoLocation *geo;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment