Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions plugins/AngleMeasure/src/AngleMeasure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <QApplication>
#include <QDebug>
#include <QFont>
#include <QTimer>
#include <QPixmap>
#include <QSettings>
Expand Down Expand Up @@ -64,7 +65,8 @@ StelPluginInfo AngleMeasureStelPluginInterface::getPluginInfo() const
}

AngleMeasure::AngleMeasure()
: flagShowAngleMeasure(false)
: fontSize(16)
, flagShowAngleMeasure(false)
, withDecimalDegree(false)
, dragging(false)
, angleEquatorial(0.)
Expand Down Expand Up @@ -95,7 +97,6 @@ AngleMeasure::AngleMeasure()
perp2EndPointHor.set(0.,0.,0.);

setObjectName("AngleMeasure");
font.setPixelSize(16);

configDialog = new AngleMeasureDialog();
conf = StelApp::getInstance().getSettings();
Expand Down Expand Up @@ -195,6 +196,8 @@ void AngleMeasure::drawOne(StelCore *core, const StelCore::FrameType frameType,
{
const StelProjectorP prj = core->getProjection(frameType, refractionMode);
StelPainter painter(prj);
QFont font=QGuiApplication::font();
font.setPixelSize(fontSize);
painter.setFont(font);
painter.setBlending(true);

Expand Down
3 changes: 1 addition & 2 deletions plugins/AngleMeasure/src/AngleMeasure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#ifndef ANGLEMEASURE_HPP
#define ANGLEMEASURE_HPP

#include <QFont>
#include "VecMath.hpp"
#include "StelModule.hpp"
#include "StelFader.hpp"
Expand Down Expand Up @@ -165,7 +164,7 @@ private slots:
void clearMessage();

private:
QFont font;
int fontSize;
bool flagShowAngleMeasure;
bool withDecimalDegree;
LinearFader lineVisible;
Expand Down
4 changes: 3 additions & 1 deletion plugins/ArchaeoLines/src/ArchaeoLines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <QTimer>
#include <QPixmap>
#include <QColor>
#include <QFont>
#include <QSettings>
#include <QMouseEvent>
#include <cmath>
Expand Down Expand Up @@ -97,7 +98,6 @@ ArchaeoLines::ArchaeoLines()
, toolbarButton(Q_NULLPTR)
{
setObjectName("ArchaeoLines");
font.setPixelSize(16);
core=StelApp::getInstance().getCore();
Q_ASSERT(core);
objMgr=GETSTELMODULE(StelObjectMgr);
Expand Down Expand Up @@ -1515,6 +1515,8 @@ void ArchaeoLine::draw(StelCore *core, float intensity) const
//Vec4f textColor(color[0], color[1], color[2], intensity*fader.getInterstate());

ALViewportEdgeIntersectCallbackData userData(&sPainter);
QFont font=QGuiApplication::font();
font.setPixelSize(fontSize);
sPainter.setFont(font);
//userData.textColor = textColor;
userData.text = (isLabelVisible() ? label : "");
Expand Down
8 changes: 3 additions & 5 deletions plugins/ArchaeoLines/src/ArchaeoLines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef ARCHAEOLINES_HPP
#define ARCHAEOLINES_HPP

#include <QFont>
#include <QColor>
#include <QKeyEvent>
#include "VecMath.hpp"
Expand Down Expand Up @@ -133,9 +132,9 @@ public slots:
void update(const double deltaTime) {fader.update(static_cast<int>(deltaTime*1000));}
void setFadeDuration(const float duration) {fader.setDuration(static_cast<int>(duration*1000.f));}
void setDisplayed(const bool displayed){fader = displayed;}
void setFontSize(const int newSize){font.setPixelSize(newSize);}
void setFontSize(const int newSize){fontSize = newSize;}
//! To be connected to StelApp font size. newSize will be enlarged by 1.
void setFontSizeFromApp(const int newSize){font.setPixelSize(newSize+1);}
void setFontSizeFromApp(const int newSize){fontSize = newSize+1;}
//! reset declination/azimuth angle (degrees) of this arc. Any azimuth angles MUST be given counted from north.
void setDefiningAngle(const double angle);
double getDefiningAngle(void) const {return definingAngle;} // returns declination for most, or azimuth.
Expand All @@ -156,7 +155,7 @@ public slots:
bool flagLabel; //! show the label. (some should be permanently silent)
QString label;
LinearFader fader;
QFont font;
int fontSize;
};

//! Main class of the ArchaeoLines plug-in.
Expand Down Expand Up @@ -483,7 +482,6 @@ private slots:
void updateObserverLocation(const StelLocation &loc);

private:
QFont font;
bool flagShowArchaeoLines;
LinearFader lineFader;
int lineWidth;
Expand Down
18 changes: 15 additions & 3 deletions plugins/Calendars/src/Calendars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <QDebug>
#include <QStyleOptionGraphicsItem>
#include <QPainter>
#include <QFont>
#include "StelGuiItems.hpp"
#include "StelApp.hpp"
#include "StelCore.hpp"
Expand Down Expand Up @@ -142,13 +143,25 @@ Calendars::Calendars():
flagShowTibetan(false)
{
setObjectName("Calendars");
font.setPixelSize(StelApp::getInstance().getScreenFontSize());
int fontSize = StelApp::getInstance().getScreenFontSize();

configDialog = new CalendarsDialog();
conf = StelApp::getInstance().getSettings();

infoPanel=new CalendarsInfoPanel(this, static_cast<StelGui*>(StelApp::getInstance().getGui())->getSkyGui());
connect(&StelApp::getInstance(), &StelApp::screenFontSizeChanged, this, [=](int size){font.setPixelSize(size); infoPanel->setFont(font); infoPanel->updatePosition(true);});
QFont pFont=QGuiApplication::font();
pFont.setPixelSize(fontSize);
infoPanel->setFont(pFont);
connect(&StelApp::getInstance(), &StelApp::fontChanged, this, [=](const QFont &font){
QFont pFont=font;
pFont.setPixelSize(fontSize);
infoPanel->setFont(pFont);
infoPanel->updatePosition(true);});
connect(&StelApp::getInstance(), &StelApp::screenFontSizeChanged, this, [=](int size){
QFont f=infoPanel->font();
f.setPixelSize(size);
infoPanel->setFont(f);
infoPanel->updatePosition(true);});
}

/*************************************************************************
Expand Down Expand Up @@ -217,7 +230,6 @@ void Calendars::init()
qWarning() << "Unable to create toolbar button for Calendars plugin: " << e.what();
}

infoPanel->setFont(font);
infoPanel->setPos(600, 300);

const double jd=StelApp::getInstance().getCore()->getJD();
Expand Down
3 changes: 0 additions & 3 deletions plugins/Calendars/src/Calendars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef CALENDARS_HPP
#define CALENDARS_HPP

#include <QFont>
#include <QMap>

#include "StelModule.hpp"
Expand Down Expand Up @@ -293,8 +292,6 @@ public slots:
void showTibetan(bool b); //!< activate display of Tibetan

private:
// Font used for displaying text
QFont font;
CalendarsInfoPanel *infoPanel;
CalendarsDialog* configDialog;
StelButton* toolbarButton;
Expand Down
3 changes: 2 additions & 1 deletion plugins/EquationOfTime/src/EquationOfTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
#include "EquationOfTime.hpp"
#include "EquationOfTimeWindow.hpp"

#include <QFont>
#include <QFontMetrics>
#include <QSettings>
#include <QPixmap>
#include <cmath>

StelModule* EquationOfTimeStelPluginInterface::getStelModule() const
{
Expand Down Expand Up @@ -118,6 +118,7 @@ void EquationOfTime::draw(StelCore *core)
float ppx = static_cast<float>(params.devicePixelsPerPixel);

sPainter.setColor(textColor, 1.f);
QFont font=QGuiApplication::font();
font.setPixelSize(getFontSize());
sPainter.setFont(font);

Expand Down
2 changes: 0 additions & 2 deletions plugins/EquationOfTime/src/EquationOfTime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "StelGui.hpp"
#include "StelModule.hpp"

#include <QFont>
#include <QString>

class QPixmap;
Expand Down Expand Up @@ -154,7 +153,6 @@ private slots:
QSettings* conf;
StelGui* gui;

QFont font;
bool flagShowSolutionEquationOfTime;
bool flagUseInvertedValue;
bool flagUseMsFormat;
Expand Down
1 change: 0 additions & 1 deletion plugins/Exoplanets/src/Exoplanet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <QVariant>
#include <QString>
#include <QStringList>
#include <QFont>
#include <QList>
#include <QDateTime>

Expand Down
7 changes: 5 additions & 2 deletions plugins/Exoplanets/src/Exoplanets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "StelCore.hpp"
#include "StelGui.hpp"
#include "StelGuiItems.hpp"
#include "StelLocaleMgr.hpp"
//#include "StelLocaleMgr.hpp"
#include "StelModuleMgr.hpp"
#include "StelObjectMgr.hpp"
#include "StelTextureMgr.hpp"
Expand All @@ -36,7 +36,7 @@
#include "Exoplanets.hpp"
#include "Exoplanet.hpp"
#include "ExoplanetsDialog.hpp"
#include "StelActionMgr.hpp"
//#include "StelActionMgr.hpp"
#include "StelProgressController.hpp"

#include <QNetworkAccessManager>
Expand All @@ -45,6 +45,7 @@
#include <QDebug>
#include <QFileInfo>
#include <QFile>
#include <QFont>
#include <QTimer>
#include <QVariantMap>
#include <QVariant>
Expand Down Expand Up @@ -232,6 +233,8 @@ void Exoplanets::draw(StelCore* core)

StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);
StelPainter painter(prj);
QFont font=QGuiApplication::font();
font.setPixelSize(fontSize);
painter.setFont(font);

for (const auto& eps : std::as_const(ep))
Expand Down
5 changes: 2 additions & 3 deletions plugins/Exoplanets/src/Exoplanets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "StelObject.hpp"
#include "StelTextureTypes.hpp"
#include "Exoplanet.hpp"
#include <QFont>
#include <QVariantMap>
#include <QDateTime>
#include <QList>
Expand Down Expand Up @@ -359,11 +358,11 @@ public slots:
void setCurrentTemperatureScaleKey(const QString &key);

//! Connect this to StelApp font size.
void setFontSize(int s){font.setPixelSize(s);}
void setFontSize(int s){fontSize = s;}

private:
// Font used for displaying our text
QFont font;
int fontSize;

// if existing, delete Satellites section in main config.ini, then create with default values
void resetConfiguration(void);
Expand Down
6 changes: 4 additions & 2 deletions plugins/HelloStelModule/src/HelloStelModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "HelloStelModule.hpp"

#include <QDebug>
#include <QFont>

/*************************************************************************
This method is the one called automatically by the StelModuleMgr just
Expand All @@ -49,10 +50,9 @@ StelPluginInfo HelloStelModuleStelPluginInterface::getPluginInfo() const
/*************************************************************************
Constructor
*************************************************************************/
HelloStelModule::HelloStelModule()
HelloStelModule::HelloStelModule(): fontSize(25)
{
setObjectName("HelloStelModule");
font.setPixelSize(25);
}

/*************************************************************************
Expand Down Expand Up @@ -88,6 +88,8 @@ void HelloStelModule::draw(StelCore* core)
{
StelPainter painter(core->getProjection2d());
painter.setColor(1,1,1,1);
QFont font=QGuiApplication::font();
font.setPixelSize(fontSize);
painter.setFont(font);
painter.drawText(300, 300, "Hello World!");
}
Expand Down
5 changes: 2 additions & 3 deletions plugins/HelloStelModule/src/HelloStelModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#define HELLOSTELMODULE_HPP

#include "StelModule.hpp"
#include <QFont>

//! This is an example of a plug-in which can be dynamically loaded into stellarium
class HelloStelModule : public StelModule
Expand All @@ -37,8 +36,8 @@ class HelloStelModule : public StelModule
void draw(StelCore* core) override;
double getCallOrder(StelModuleActionName actionName) const override;
private:
// Font used for displaying our text
QFont font;
// Fontsize used for displaying our text
int fontSize;
};


Expand Down
5 changes: 4 additions & 1 deletion plugins/MeteorShowers/src/MeteorShower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <QtMath>
#include <QFont>

#include "LandscapeMgr.hpp"
#include "StelLocaleMgr.hpp"
Expand Down Expand Up @@ -377,7 +378,9 @@ void MeteorShower::drawRadiant(StelCore *core)
if (m_mgr->getEnableLabels())
{
painter.setColor(rgb);
painter.setFont(m_mgr->getFont());
QFont font=QGuiApplication::font();
font.setPixelSize(m_mgr->getFontSize());
painter.setFont(font);
const float shift = 8.f;
if ((mag+1.f)<mlimit)
painter.drawText(static_cast<float>(XY[0])+shift, static_cast<float>(XY[1])+shift, getNameI18n(), 0, 0, 0, false);
Expand Down
2 changes: 1 addition & 1 deletion plugins/MeteorShowers/src/MeteorShowersMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ void MeteorShowersMgr::setEnableAtStartup(const bool& b)
void MeteorShowersMgr::setFontSize(int pixelSize)
{
pixelSize = pixelSize < 1 ? 13 : pixelSize;
m_font.setPixelSize(pixelSize);
m_fontSize = pixelSize;
m_conf->setValue(MS_CONFIG_PREFIX + "/font_size", pixelSize);
}

Expand Down
7 changes: 2 additions & 5 deletions plugins/MeteorShowers/src/MeteorShowersMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ class MeteorShowersMgr : public StelModule
void setEnablePlugin(const bool& b);
bool getEnablePlugin() { return m_enablePlugin; }

//! Get the font.
QFont getFont() { return m_font; }

//! Set the URL for downloading the meteor showers catalog.
void setUrl(const QString& url);
QString getUrl() { return m_url; }
Expand Down Expand Up @@ -225,7 +222,7 @@ public slots:
//! // example of usage in scripts
//! var size = MeteorShowers.getFontSize();
//! @endcode
int getFontSize() { return m_font.pixelSize(); }
int getFontSize() { return m_fontSize; }

//! Set the update frequency in hours.
//! @param hours update frequency in hours
Expand Down Expand Up @@ -305,7 +302,7 @@ private slots:
MSConfigDialog* m_configDialog;
MSSearchDialog* m_searchDialog;

QFont m_font;
int m_fontSize;
QSettings* m_conf;
QString m_catalogPath;

Expand Down
1 change: 0 additions & 1 deletion plugins/NebulaTextures/src/NebulaTextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ StelPluginInfo NebulaTexturesStelPluginInterface::getPluginInfo() const
NebulaTextures::NebulaTextures()
{
setObjectName("NebulaTextures");
font.setPixelSize(25);
configDialog = new NebulaTexturesDialog();
connect(StelApp::getInstance().getModule("StelSkyLayerMgr"),
SIGNAL(collectionLoaded()),configDialog,SLOT(initializeRefreshIfNeeded()));
Expand Down
Loading
Loading