Skip to content

Commit

Permalink
Apply StelDialog changes also here
Browse files Browse the repository at this point in the history
  • Loading branch information
gzotti committed Nov 27, 2023
1 parent 5d9ed12 commit d02ff4e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 112 deletions.
35 changes: 16 additions & 19 deletions plugins/PrintSky/src/gui/PrintSkyDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ void PrintSkyDialog::updateStyle()
}
}

void PrintSkyDialog::styleChanged()
{
// Nothing for now
}

/* ********************************************************************* */
void PrintSkyDialog::closeWindow()
{
Expand All @@ -88,7 +83,9 @@ void PrintSkyDialog::createDialogContent()
ui->setupUi(dialog);

//Now the rest of the actions.
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
connect(ui->titleBar, &TitleBar::closeClicked, this, &StelDialog::close);
connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

connect(ui->previewSkyPushButton, SIGNAL(clicked()), this, SLOT(previewSky()));
connect(ui->printSkyPushButton, SIGNAL(clicked()), this, SLOT(printSky()));

Expand Down Expand Up @@ -117,8 +114,8 @@ void PrintSkyDialog::printFooter(QPrinter * printer, QPainter *painter, int page
QString stelVersion = q_("Stellarium %1").arg(StelUtils::getApplicationVersion());
StelLocaleMgr lMgr=StelApp::getInstance().getLocaleMgr();

QString footerDate=QString("%1 %2 (%3)").arg(lMgr.getPrintableDateLocal(jd)).arg(lMgr.getPrintableTimeLocal(jd)).arg(lMgr.getPrintableTimeZoneLocal(jd));
QString footerText=QString("%1 %2 %3 %4").arg(q_("Created on")).arg(footerDate).arg(q_("by")).arg(stelVersion);
QString footerDate=QString("%1 %2 (%3)").arg(lMgr.getPrintableDateLocal(jd), lMgr.getPrintableTimeLocal(jd), lMgr.getPrintableTimeZoneLocal(jd));
QString footerText=QString("%1 %2 %3 %4").arg(q_("Created on"), footerDate, q_("by"), stelVersion);

const QPageLayout pageLayout=printer->pageLayout();
const QRectF fullRect=pageLayout.fullRect();
Expand All @@ -130,7 +127,7 @@ void PrintSkyDialog::printFooter(QPrinter * printer, QPainter *painter, int page
qDebug() << "printFooter of page " << pageNumber << "at x:" << marginLeft << " y: " << yPos << "in fontsize" << fontSize;

painter->drawText(QRectF(marginLeft, yPos, fullRect.width()-marginLeft-marginRight, 2*fontSize), Qt::AlignLeft, footerText);
painter->drawText(QRectF(marginLeft, yPos, fullRect.width()-marginLeft-marginRight, 2*fontSize), Qt::AlignRight, QString("%1 %2").arg(q_("Page")).arg(QString::number(pageNumber)));
painter->drawText(QRectF(marginLeft, yPos, fullRect.width()-marginLeft-marginRight, 2*fontSize), Qt::AlignRight, QString("%1 %2").arg(q_("Page"), QString::number(pageNumber)));
qDebug() << "printFooter done";
}

Expand Down Expand Up @@ -200,18 +197,18 @@ void PrintSkyDialog::printDataSky(QPrinter * printer)

painter.drawText(surfaceData.adjusted(0, 0, 0, -(surfaceData.height()-lineSpacing)), Qt::AlignCenter, q_("CHART INFORMATION"));

QString printLatitude=StelUtils::radToDmsStr((std::fabs(static_cast<double>(location.latitude))/180.)*M_PI);
QString printLongitude=StelUtils::radToDmsStr((std::fabs(static_cast<double>(location.longitude))/180.)*M_PI);
QString printLatitude=StelUtils::radToDmsStr((std::fabs(static_cast<double>(location.getLatitude()))/180.)*M_PI);
QString printLongitude=StelUtils::radToDmsStr((std::fabs(static_cast<double>(location.getLongitude()))/180.)*M_PI);

QString locationStr = QString("%1: %2,\t%3,\t%4;\t%5\t%6\t%7%8")
.arg(q_("Location"))
.arg(location.name)
.arg(q_(location.region))
.arg(q_(location.planetName))
.arg(location.latitude<0 ? QString("%1S").arg(printLatitude) : QString("%1N").arg(printLatitude))
.arg(location.longitude<0 ? QString("%1W").arg(printLongitude) : QString("%1E").arg(printLongitude))
.arg(location.altitude)
.arg(qc_("m", "altitude, metres"));
.arg(q_("Location"),
location.name,
q_(location.region),
q_(location.planetName),
location.getLatitude()<0 ? QString("%1S").arg(printLatitude) : QString("%1N").arg(printLatitude),
location.getLongitude()<0 ? QString("%1W").arg(printLongitude) : QString("%1E").arg(printLongitude),
QString::number(location.altitude),
qc_("m", "altitude, metres"));
painter.drawText(surfaceData.adjusted(50, lineSpacing, 0, 0), Qt::AlignLeft, locationStr);

qDebug() << "PrintSky: Basic info 1 ";
Expand Down
2 changes: 0 additions & 2 deletions plugins/PrintSky/src/gui/PrintSkyDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class PrintSkyDialog : public StelDialog // PrintSky
void retranslate() override;
void updateStyle();

//! Notify that the application style changed
void styleChanged() override;
void enableOutputOptions(bool enable);

public slots:
Expand Down
95 changes: 4 additions & 91 deletions plugins/PrintSky/src/gui/printskyDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,97 +39,10 @@
<number>0</number>
</property>
<item>
<widget class="BarFrame" name="TitleBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<widget class="TitleBar" name="titleBar">
<property name="title" stdset="0">
<string>PrintSky Plug-in Configuration</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="stelWindowTitle">
<property name="text">
<string>Print sky</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="closeStelWindow">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
Expand Down Expand Up @@ -410,7 +323,7 @@ In a optional second page you can get some Solar System ephemerides.</string>
</widget>
<customwidgets>
<customwidget>
<class>BarFrame</class>
<class>TitleBar</class>
<extends>QFrame</extends>
<header>Dialog.hpp</header>
<container>1</container>
Expand Down

0 comments on commit d02ff4e

Please sign in to comment.