1
/***************************************************************************
2
detailstable.cpp - K Desktop Planetarium
4
begin : Fri Jul 29 2011
5
copyright : (C) 2011 by Rafał Kułaga
6
email : rl.kulaga@gmail.com
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
18
#include "detailstable.h"
20
#include "QTextDocument"
23
#include "kstarsdata.h"
24
#include "ksplanetbase.h"
25
#include "starobject.h"
26
#include "skymapcomposite.h"
27
#include "constellationboundarylines.h"
28
#include "deepskyobject.h"
29
#include "customcatalogcomponent.h"
31
#include "ksplanetbase.h"
32
#include "ksasteroid.h"
35
DetailsTable::DetailsTable()
37
m_Document = new QTextDocument(KStars::Instance());
39
setDefaultFormatting();
42
DetailsTable::~DetailsTable()
50
void DetailsTable::createGeneralTable(SkyObject *obj)
54
QTextCursor cursor = m_Document->rootFrame()->firstCursorPosition();
56
//Fill in the data fields
57
//Contents depend on type of object
59
DeepSkyObject *dso = 0;
63
QString objNamesVal, objTypeVal, objDistVal, objSizeVal, objMagVal, objBvVal, objIllumVal;
64
QString objSizeLabel, objMagLabel;
70
s = (StarObject *)obj;
72
objNamesVal = s->longname();
74
if(s->getHDIndex() != 0)
76
if(!s->longname().isEmpty())
78
objNamesVal = s->longname() + QString(", HD%1").arg(QString::number(s->getHDIndex())) ;
83
objNamesVal = QString(", HD%1").arg(QString::number(s->getHDIndex()));
87
objTypeVal = s->sptype() + ' ' + i18n("star");
88
objMagVal = i18nc("number in magnitudes", "%1 mag", KGlobal::locale()->formatNumber(s->mag(), 1)); //show to tenths place
90
if(s->getBVIndex() < 30.0)
92
objBvVal = QString::number(s->getBVIndex(), 'g', 2);
96
if(s->distance() > 2000. || s->distance() < 0.) // parallax < 0.5 mas
98
objDistVal = i18nc("larger than 2000 parsecs", "> 2000 pc");
101
else if(s->distance() > 50.0) //show to nearest integer
103
objDistVal = i18nc("number in parsecs", "%1 pc", KGlobal::locale()->formatNumber(s->distance(), 0));
106
else if(s->distance() > 10.0) //show to tenths place
108
objDistVal = i18nc("number in parsecs", "%1 pc", KGlobal::locale()->formatNumber(s->distance(), 1));
111
else //show to hundredths place
113
objDistVal = i18nc("number in parsecs", "%1 pc", KGlobal::locale()->formatNumber(s->distance(), 2));
116
//Note multiplicity/variablility in angular size label
117
if(s->isMultiple() && s->isVariable())
119
objSizeLabel = i18nc("the star is a multiple star", "multiple") + ',';
120
objSizeVal = i18nc("the star is a variable star", "variable");
123
else if(s->isMultiple())
125
objSizeLabel = i18nc("the star is a multiple star", "multiple");
128
else if(s->isVariable())
130
objSizeLabel = i18nc("the star is a variable star", "variable");
135
break; //End of stars case
138
case SkyObject::ASTEROID: //[fall through to planets]
140
case SkyObject::COMET: //[fall through to planets]
142
case SkyObject::MOON: //[fall through to planets]
144
case SkyObject::PLANET:
146
ps = (KSPlanetBase *)obj;
148
objNamesVal = ps->longname();
149
//Type is "G5 star" for Sun
150
if(ps->name() == "Sun")
152
objTypeVal = i18n("G5 star");
155
else if(ps->name() == "Moon")
157
objTypeVal = ps->translatedName();
160
else if(ps->name() == i18n("Pluto") || ps->name() == "Ceres" || ps->name() == "Eris") // TODO: Check if Ceres / Eris have translations and i18n() them
162
objTypeVal = i18n("Dwarf planet");
167
objTypeVal = ps->typeName();
170
//Magnitude: The moon displays illumination fraction instead
171
if(obj->name() == "Moon")
173
objIllumVal = QString("%1 %").arg(KGlobal::locale()->formatNumber(((KSMoon *)obj)->illum()*100., 0));
176
objMagVal = i18nc("number in magnitudes", "%1 mag", KGlobal::locale()->formatNumber(ps->mag(), 1)); //show to tenths place
178
//Distance from Earth. The moon requires a unit conversion
179
if(ps->name() == "Moon")
181
objDistVal = i18nc("distance in kilometers", "%1 km", KGlobal::locale()->formatNumber(ps->rearth() * AU_KM ));
186
objDistVal = i18nc("distance in Astronomical Units", "%1 AU", KGlobal::locale()->formatNumber(ps->rearth()));
189
//Angular size; moon and sun in arcmin, others in arcsec
192
if(ps->name() == "Sun" || ps->name() == "Moon")
194
// Needn't be a plural form because sun / moon will never contract to 1 arcminute
195
objSizeVal = i18nc("angular size in arcminutes", "%1 arcmin", KGlobal::locale()->formatNumber(ps->angSize()));
200
objSizeVal = i18nc("angular size in arcseconds","%1 arcsec", KGlobal::locale()->formatNumber(ps->angSize() * 60.0));
209
break; //End of planets/comets/asteroids case
212
default: //Deep-sky objects
214
dso = (DeepSkyObject *)obj;
216
//Show all names recorded for the object
217
if(!dso->longname().isEmpty() && dso->longname() != dso->name())
219
pname = dso->translatedLongName();
220
oname = dso->translatedName();
225
pname = dso->translatedName();
228
if(!dso->translatedName2().isEmpty())
232
oname = dso->translatedName2();
237
oname += ", " + dso->translatedName2();
248
oname += "UGC " + QString::number(dso->ugc());
257
oname += "PGC " + QString::number(dso->pgc());
262
pname += ", " + oname;
267
objTypeVal = dso->typeName();
269
if(dso->type() == SkyObject::RADIO_SOURCE)
271
objMagLabel = i18nc("integrated flux at a frequency", "Flux(%1):", dso->customCatalog()->fluxFrequency());
272
objMagVal = i18nc("integrated flux value", "%1 %2", KGlobal::locale()->formatNumber(dso->flux(), 1),
273
dso->customCatalog()->fluxUnit()); //show to tenths place
276
else if(dso->mag() > 90.0)
283
objMagVal = i18nc("number in magnitudes", "%1 mag", KGlobal::locale()->formatNumber(dso->mag(), 1)); //show to tenths place
286
//No distances at this point...
289
//Only show decimal place for small angular sizes
292
objSizeVal = i18nc("angular size in arcminutes", "%1 arcmin", KGlobal::locale()->formatNumber(dso->a(), 0));
297
objSizeVal = i18nc("angular size in arcminutes", "%1 arcmin", KGlobal::locale()->formatNumber(dso->a(), 1));
305
break; //End of deep-space objects case
309
//Common to all types:
310
if(obj->type() == SkyObject::CONSTELLATION )
312
objTypeVal = KStarsData::Instance()->skyComposite()->getConstellationBoundary()->constellationName(obj);
317
objTypeVal = i18nc("%1 type of sky object (planet, asteroid etc), %2 name of a constellation", "%1 in %2", objTypeVal,
318
KStarsData::Instance()->skyComposite()->getConstellationBoundary()->constellationName(obj));
321
QVector<QTextLength> constraints;
322
constraints << QTextLength(QTextLength::PercentageLength, 25)
323
<< QTextLength(QTextLength::PercentageLength, 25)
324
<< QTextLength(QTextLength::PercentageLength, 25)
325
<< QTextLength(QTextLength::PercentageLength, 25);
326
m_TableFormat.setColumnWidthConstraints(constraints);
328
QTextTable *table = cursor.insertTable(5, 4, m_TableFormat);
329
table->mergeCells(0, 0, 1, 4);
330
QTextBlockFormat centered;
331
centered.setAlignment(Qt::AlignCenter);
332
table->cellAt(0, 0).firstCursorPosition().setBlockFormat(centered);
333
table->cellAt(0, 0).firstCursorPosition().insertText(i18n("General"), m_TableTitleCharFormat);
335
table->mergeCells(1, 1, 1, 3);
336
table->cellAt(1, 0).firstCursorPosition().insertText(i18n("Names:"), m_ItemNameCharFormat);
337
table->cellAt(1, 0).firstCursorPosition().setBlockFormat(centered);
338
table->cellAt(1, 1).firstCursorPosition().insertText(objNamesVal, m_ItemValueCharFormat);
340
table->cellAt(2, 0).firstCursorPosition().insertText(i18n("Type:"), m_ItemNameCharFormat);
341
table->cellAt(2, 0).firstCursorPosition().setBlockFormat(centered);
342
table->cellAt(2, 1).firstCursorPosition().insertText(objTypeVal, m_ItemValueCharFormat);
344
table->cellAt(3, 0).firstCursorPosition().insertText(i18n("Distance:"), m_ItemNameCharFormat);
345
table->cellAt(3, 0).firstCursorPosition().setBlockFormat(centered);
346
table->cellAt(3, 1).firstCursorPosition().insertText(objDistVal, m_ItemValueCharFormat);
348
table->cellAt(4, 0).firstCursorPosition().insertText(i18n("Size:"), m_ItemNameCharFormat);
349
table->cellAt(4, 0).firstCursorPosition().setBlockFormat(centered);
350
table->cellAt(4, 1).firstCursorPosition().insertText(objSizeVal, m_ItemValueCharFormat);
352
table->cellAt(2, 2).firstCursorPosition().insertText(i18n("Magnitude:"), m_ItemNameCharFormat);
353
table->cellAt(2, 2).firstCursorPosition().setBlockFormat(centered);
354
table->cellAt(2, 3).firstCursorPosition().insertText(objMagVal, m_ItemValueCharFormat);
356
table->cellAt(3, 2).firstCursorPosition().insertText(i18n("B-V index:"), m_ItemNameCharFormat);
357
table->cellAt(3, 2).firstCursorPosition().setBlockFormat(centered);
358
table->cellAt(3, 3).firstCursorPosition().insertText(objBvVal, m_ItemValueCharFormat);
360
table->cellAt(4, 2).firstCursorPosition().insertText(i18n("Illumination:"), m_ItemNameCharFormat);
361
table->cellAt(4, 2).firstCursorPosition().setBlockFormat(centered);
362
table->cellAt(4, 3).firstCursorPosition().insertText(objIllumVal, m_ItemValueCharFormat);
365
void DetailsTable::createAsteroidCometTable(SkyObject *obj)
369
QTextCursor cursor = m_Document->rootFrame()->firstCursorPosition();
371
QString perihelionVal, orbitIdVal, neoVal, diamVal, rotPeriodVal, moidVal;
372
QString orbitClassVal, albedoVal, dimVal, periodVal;
374
// Add specifics data
377
case SkyObject::ASTEROID:
379
KSAsteroid* ast = (KSAsteroid *)obj;
382
perihelionVal = QString::number(ast->getPerihelion()) + " AU";
385
moidVal = ast->getEarthMOID() == 0 ? QString("--") : QString::number(ast->getEarthMOID()) + QString(" AU");
388
orbitIdVal = ast->getOrbitID();
391
orbitClassVal = ast->getOrbitClass();
394
neoVal = ast->isNEO() ? i18n("Yes") : i18n("No");
397
albedoVal = ast->getAlbedo() == 0 ? QString("--") : QString::number(ast->getAlbedo());
400
diamVal = ast->getDiameter() == 0 ? QString("--") : QString::number(ast->getDiameter()) + QString(" km");
403
dimVal = ast->getDimensions().isEmpty() ? QString("--") : ast->getDimensions() + QString(" km");
406
rotPeriodVal = ast->getRotationPeriod() == 0 ? QString("--") : QString::number(ast->getRotationPeriod()) + QString(" h");
409
periodVal = ast->getPeriod() == 0 ? QString("--") : QString::number(ast->getPeriod()) + QString(" y");
414
case SkyObject::COMET:
416
KSComet* com = (KSComet *)obj;
419
perihelionVal = QString::number(com->getPerihelion()) + " AU";
422
moidVal = com->getEarthMOID() == 0 ? QString("--") : QString::number(com->getEarthMOID()) + QString(" AU");
425
orbitIdVal = com->getOrbitID();
428
orbitClassVal = com->getOrbitClass();
431
neoVal = com->isNEO() ? i18n("Yes") : i18n("No");
434
albedoVal = com->getAlbedo() == 0 ? QString("--") : QString::number(com->getAlbedo());
437
diamVal = com->getDiameter() == 0 ? QString("--") : QString::number(com->getDiameter()) + QString(" km");
440
dimVal = com->getDimensions().isEmpty() ? QString("--") : com->getDimensions() + QString(" km");
443
rotPeriodVal = com->getRotationPeriod() == 0 ? QString("--") : QString::number(com->getRotationPeriod()) + QString(" h");
446
periodVal = com->getPeriod() == 0 ? QString("--") : QString::number(com->getPeriod()) + QString(" y");
457
// Set column width constraints
458
QVector<QTextLength> constraints;
459
constraints << QTextLength(QTextLength::PercentageLength, 25)
460
<< QTextLength(QTextLength::PercentageLength, 25)
461
<< QTextLength(QTextLength::PercentageLength, 25)
462
<< QTextLength(QTextLength::PercentageLength, 25);
463
m_TableFormat.setColumnWidthConstraints(constraints);
465
QTextTable *table = cursor.insertTable(6, 4, m_TableFormat);
466
table->mergeCells(0, 0, 1, 4);
467
QTextBlockFormat centered;
468
centered.setAlignment(Qt::AlignCenter);
469
table->cellAt(0, 0).firstCursorPosition().setBlockFormat(centered);
470
table->cellAt(0, 0).firstCursorPosition().insertText(i18n("Asteroid/Comet details"), m_TableTitleCharFormat);
472
table->cellAt(1, 0).firstCursorPosition().insertText(i18n("Perihelion:"), m_ItemNameCharFormat);
473
table->cellAt(1, 0).firstCursorPosition().setBlockFormat(centered);
474
table->cellAt(1, 1).firstCursorPosition().insertText(perihelionVal, m_ItemValueCharFormat);
476
table->cellAt(2, 0).firstCursorPosition().insertText(i18n("Orbit ID:"), m_ItemNameCharFormat);
477
table->cellAt(2, 0).firstCursorPosition().setBlockFormat(centered);
478
table->cellAt(2, 1).firstCursorPosition().insertText(orbitIdVal, m_ItemValueCharFormat);
480
table->cellAt(3, 0).firstCursorPosition().insertText(i18n("NEO:"), m_ItemNameCharFormat);
481
table->cellAt(3, 0).firstCursorPosition().setBlockFormat(centered);
482
table->cellAt(3, 1).firstCursorPosition().insertText(neoVal, m_ItemValueCharFormat);
484
table->cellAt(4, 0).firstCursorPosition().insertText(i18n("Diameter:"), m_ItemNameCharFormat);
485
table->cellAt(4, 0).firstCursorPosition().setBlockFormat(centered);
486
table->cellAt(4, 1).firstCursorPosition().insertText(diamVal, m_ItemValueCharFormat);
488
table->cellAt(5, 0).firstCursorPosition().insertText(i18n("Rotation period:"), m_ItemNameCharFormat);
489
table->cellAt(5, 0).firstCursorPosition().setBlockFormat(centered);
490
table->cellAt(5, 1).firstCursorPosition().insertText(rotPeriodVal, m_ItemValueCharFormat);
492
table->cellAt(1, 2).firstCursorPosition().insertText(i18n("Earth MOID:"), m_ItemNameCharFormat);
493
table->cellAt(1, 2).firstCursorPosition().setBlockFormat(centered);
494
table->cellAt(1, 3).firstCursorPosition().insertText(moidVal, m_ItemValueCharFormat);
496
table->cellAt(2, 2).firstCursorPosition().insertText(i18n("Orbit class:"), m_ItemNameCharFormat);
497
table->cellAt(2, 2).firstCursorPosition().setBlockFormat(centered);
498
table->cellAt(2, 3).firstCursorPosition().insertText(orbitClassVal, m_ItemValueCharFormat);
500
table->cellAt(3, 2).firstCursorPosition().insertText(i18n("Albedo:"), m_ItemNameCharFormat);
501
table->cellAt(3, 2).firstCursorPosition().setBlockFormat(centered);
502
table->cellAt(3, 3).firstCursorPosition().insertText(albedoVal, m_ItemValueCharFormat);
504
table->cellAt(4, 2).firstCursorPosition().insertText(i18n("Dimensions:"), m_ItemNameCharFormat);
505
table->cellAt(4, 2).firstCursorPosition().setBlockFormat(centered);
506
table->cellAt(4, 3).firstCursorPosition().insertText(dimVal, m_ItemValueCharFormat);
508
table->cellAt(5, 2).firstCursorPosition().insertText(i18n("Period:"), m_ItemNameCharFormat);
509
table->cellAt(5, 2).firstCursorPosition().setBlockFormat(centered);
510
table->cellAt(5, 3).firstCursorPosition().insertText(periodVal, m_ItemValueCharFormat);
513
void DetailsTable::createCoordinatesTable(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo)
517
QTextCursor cursor = m_Document->rootFrame()->firstCursorPosition();
519
// Set column width constraints
520
QVector<QTextLength> constraints;
521
constraints << QTextLength(QTextLength::PercentageLength, 25)
522
<< QTextLength(QTextLength::PercentageLength, 25)
523
<< QTextLength(QTextLength::PercentageLength, 25)
524
<< QTextLength(QTextLength::PercentageLength, 25);
525
m_TableFormat.setColumnWidthConstraints(constraints);
527
// Insert table & row containing table name
528
QTextTable *table = cursor.insertTable(4, 4, m_TableFormat);
529
table->mergeCells(0, 0, 1, 4);
530
QTextBlockFormat centered;
531
centered.setAlignment(Qt::AlignCenter);
532
table->cellAt(0, 0).firstCursorPosition().setBlockFormat(centered);
533
table->cellAt(0, 0).firstCursorPosition().insertText(i18n("Coordinates"), m_TableTitleCharFormat);
535
//Coordinates Section:
536
//Don't use KLocale::formatNumber() for the epoch string,
537
//because we don't want a thousands-place separator!
538
QString sEpoch = QString::number(ut.epoch(), 'f', 1);
539
//Replace the decimal point with localized decimal symbol
540
sEpoch.replace('.', KGlobal::locale()->decimalSymbol());
542
table->cellAt(1, 0).firstCursorPosition().insertText(i18n("RA (%1):", sEpoch), m_ItemNameCharFormat);
543
table->cellAt(1, 0).firstCursorPosition().setBlockFormat(centered);
544
table->cellAt(1, 1).firstCursorPosition().insertText(obj->ra().toHMSString(), m_ItemValueCharFormat);
546
table->cellAt(2, 0).firstCursorPosition().insertText(i18n("Dec (%1):", sEpoch), m_ItemNameCharFormat);
547
table->cellAt(2, 0).firstCursorPosition().setBlockFormat(centered);
548
table->cellAt(2, 1).firstCursorPosition().insertText(obj->dec().toDMSString(), m_ItemValueCharFormat);
550
table->cellAt(3, 0).firstCursorPosition().insertText(i18n("Hour angle:"), m_ItemNameCharFormat);
551
table->cellAt(3, 0).firstCursorPosition().setBlockFormat(centered);
552
//Hour Angle can be negative, but dms HMS expressions cannot.
553
//Here's a kludgy workaround:
554
dms lst = geo->GSTtoLST(ut.gst());
555
dms ha(lst.Degrees() - obj->ra().Degrees());
557
if(ha.Hours() > 12.0)
559
ha.setH(24.0 - ha.Hours());
562
table->cellAt(3, 1).firstCursorPosition().insertText(QString("%1%2").arg(sgn).arg(ha.toHMSString()), m_ItemValueCharFormat);
564
table->cellAt(1, 2).firstCursorPosition().insertText(i18n("Azimuth:"), m_ItemNameCharFormat);
565
table->cellAt(1, 2).firstCursorPosition().setBlockFormat(centered);
566
table->cellAt(1, 3).firstCursorPosition().insertText(obj->az().toDMSString(), m_ItemValueCharFormat);
568
table->cellAt(2, 2).firstCursorPosition().insertText(i18n("Altitude:"), m_ItemNameCharFormat);
569
table->cellAt(2, 2).firstCursorPosition().setBlockFormat(centered);
571
if(Options::useAltAz())
578
a = obj->altRefracted();
580
table->cellAt(2, 3).firstCursorPosition().insertText(a.toDMSString(), m_ItemValueCharFormat);
582
table->cellAt(3, 2).firstCursorPosition().insertText(i18n("Airmass:"), m_ItemNameCharFormat);
583
table->cellAt(3, 2).firstCursorPosition().setBlockFormat(centered);
584
//Airmass is approximated as the secant of the zenith distance,
585
//equivalent to 1./sin(Alt). Beware of Inf at Alt=0!
587
if(obj->alt().Degrees() > 0.0)
589
aMassStr = KGlobal::locale()->formatNumber(1./sin(obj->alt().radians() ), 2);
596
table->cellAt(3, 3).firstCursorPosition().insertText(aMassStr, m_ItemValueCharFormat);
598
// Restore the position and other time-dependent parameters
599
obj->recomputeCoords(ut, geo);
602
void DetailsTable::createRSTTAble(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo)
606
QTextCursor cursor = m_Document->rootFrame()->firstCursorPosition();
608
QString rtValue, stValue; // Rise/Set time values
609
QString azRValue, azSValue; // Rise/Set azimuth values
611
//Prepare time/position variables
612
QTime rt = obj->riseSetTime(ut, geo, true); //true = use rise time
613
dms raz = obj->riseSetTimeAz(ut, geo, true); //true = use rise time
615
//If transit time is before rise time, use transit time for tomorrow
616
QTime tt = obj->transitTime(ut, geo);
617
dms talt = obj->transitAltitude(ut, geo);
620
tt = obj->transitTime(ut.addDays(1), geo);
621
talt = obj->transitAltitude(ut.addDays(1), geo);
624
//If set time is before rise time, use set time for tomorrow
625
QTime st = obj->riseSetTime(ut, geo, false); //false = use set time
626
dms saz = obj->riseSetTimeAz(ut, geo, false); //false = use set time
629
st = obj->riseSetTime(ut.addDays(1), geo, false); //false = use set time
630
saz = obj->riseSetTimeAz(ut.addDays( 1 ), geo, false); //false = use set time
635
rtValue = QString().sprintf("%02d:%02d", rt.hour(), rt.minute());
636
stValue = QString().sprintf("%02d:%02d", st.hour(), st.minute());
637
azRValue = raz.toDMSString();
638
azSValue = saz.toDMSString();
643
if(obj->alt().Degrees() > 0.0)
645
rtValue = i18n("Circumpolar");
646
stValue = i18n("Circumpolar");
651
rtValue = i18n("Never rises");
652
stValue = i18n("Never rises");
655
azRValue = i18nc("Not Applicable", "N/A");
656
azSValue = i18nc("Not Applicable", "N/A");
659
// Set column width constraints
660
QVector<QTextLength> constraints;
661
constraints << QTextLength(QTextLength::PercentageLength, 25)
662
<< QTextLength(QTextLength::PercentageLength, 25)
663
<< QTextLength(QTextLength::PercentageLength, 25)
664
<< QTextLength(QTextLength::PercentageLength, 25);
665
m_TableFormat.setColumnWidthConstraints(constraints);
667
// Insert table & row containing table name
668
QTextTable *table = cursor.insertTable(4, 4, m_TableFormat);
669
table->mergeCells(0, 0, 1, 4);
670
QTextBlockFormat centered;
671
centered.setAlignment(Qt::AlignCenter);
672
table->cellAt(0, 0).firstCursorPosition().setBlockFormat(centered);
673
table->cellAt(0, 0).firstCursorPosition().insertText(i18n("Rise/Set/Transit"), m_TableTitleCharFormat);
675
// Insert cell names & values
676
table->cellAt(1, 0).firstCursorPosition().insertText(i18n("Rise time:"), m_ItemNameCharFormat);
677
table->cellAt(1, 0).firstCursorPosition().setBlockFormat(centered);
678
table->cellAt(1, 1).firstCursorPosition().insertText(rtValue, m_ItemValueCharFormat);
680
table->cellAt(2, 0).firstCursorPosition().insertText(i18n("Transit time:"), m_ItemNameCharFormat);
681
table->cellAt(2, 0).firstCursorPosition().setBlockFormat(centered);
682
table->cellAt(2, 1).firstCursorPosition().insertText(QString().sprintf("%02d:%02d", tt.hour(), tt.minute()), m_ItemValueCharFormat);
684
table->cellAt(3, 0).firstCursorPosition().insertText(i18n("Set time:"), m_ItemNameCharFormat);
685
table->cellAt(3, 0).firstCursorPosition().setBlockFormat(centered);
686
table->cellAt(3, 1).firstCursorPosition().insertText(stValue, m_ItemValueCharFormat);
688
table->cellAt(1, 2).firstCursorPosition().insertText(i18n("Azimuth at rise:"), m_ItemNameCharFormat);
689
table->cellAt(1, 2).firstCursorPosition().setBlockFormat(centered);
690
table->cellAt(1, 3).firstCursorPosition().insertText(azRValue, m_ItemValueCharFormat);
692
table->cellAt(2, 2).firstCursorPosition().insertText(i18n("Altitude at transit:"), m_ItemNameCharFormat);
693
table->cellAt(2, 2).firstCursorPosition().setBlockFormat(centered);
694
table->cellAt(2, 3).firstCursorPosition().insertText(talt.toDMSString(), m_ItemValueCharFormat);
696
table->cellAt(3, 2).firstCursorPosition().insertText(i18n("Azimuth at set:"), m_ItemNameCharFormat);
697
table->cellAt(3, 2).firstCursorPosition().setBlockFormat(centered);
698
table->cellAt(3, 3).firstCursorPosition().insertText(azSValue, m_ItemValueCharFormat);
700
// Restore the position and other time-dependent parameters
701
obj->recomputeCoords( ut, geo );
704
void DetailsTable::clearContents()
709
void DetailsTable::setDefaultFormatting()
711
// Set default table format
712
m_TableFormat.setAlignment(Qt::AlignCenter);
713
m_TableFormat.setBorder(4);
714
m_TableFormat.setCellPadding(2);
715
m_TableFormat.setCellSpacing(2);
717
// Set default table title character format
718
m_TableTitleCharFormat.setFont(QFont("Times", 12, QFont::Bold));
719
m_TableTitleCharFormat.setFontCapitalization(QFont::Capitalize);
721
// Set default table item name character format
722
m_ItemNameCharFormat.setFont(QFont("Times", 10, QFont::Bold));
724
// Set default table item value character format
725
m_ItemValueCharFormat.setFont(QFont("Times", 10));