[Kalzium] [Bug 144861] Add explanatory text to element's icon
cniehaus at gmx.de
cniehaus at gmx.de
Mon Apr 30 10:20:37 CEST 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=144861
------- Additional Comments From cniehaus gmx de 2007-04-30 10:20 -------
SVN commit 659420 by cniehaus:
Now the information is displayed by a kDebug() and I only added
crap-information to iconinformation.txt. Jarle, perhaps you and me can
fill up the time when we find time.
CCBUG:144861
M +1 -0 data/iconsets/school/CMakeLists.txt
A data/iconsets/school/iconinformation.txt
M +35 -10 src/kalzium.cpp
M +4 -2 src/kalzium.h
--- trunk/KDE/kdeedu/kalzium/data/iconsets/school/CMakeLists.txt #659419:659420
@ -2,4 +2,5 @
7.svg 11.svg 13.svg 18.svg 26.svg 2.svg 33.svg 35.svg 3.svg 49.svg 54.svg 56.svg 6.svg 74.svg 81.svg 8.svg
12.svg 16.svg 19.svg 27.svg 30.svg 34.svg 39.svg 47.svg 51.svg 55.svg 5.svg 60.svg 72.svg 79.svg 85.svg 9.svg
83.svg 62.svg 20.svg 52.svg 52.svg 57.svg
+ iconinformation.txt
DESTINATION ${DATA_INSTALL_DIR}/kalzium/data/iconsets/school )
--- trunk/KDE/kdeedu/kalzium/src/kalzium.cpp #659419:659420
@ -113,17 +113,17 @
helperSV->setFrameShape( QFrame::NoFrame );
fakelay->addWidget( helperSV );
- m_legendWidget = new LegendWidget( this );
- connect( m_PeriodicTableView, SIGNAL(ModeChanged( KalziumPainter::MODE) ),
- m_legendWidget, SLOT(setMode(KalziumPainter::MODE) ) );
- connect( m_PeriodicTableView, SIGNAL(TableTypeChanged( KalziumTableType* ) ),
- m_legendWidget, SLOT( setTableType( KalziumTableType * ) ) );
- connect( m_PeriodicTableView, SIGNAL( SchemeChanged( KalziumSchemeType * ) ),
- m_legendWidget, SLOT( setScheme( KalziumSchemeType * ) ) );
+ m_legendWidget = new LegendWidget( this );
+ connect( m_PeriodicTableView, SIGNAL(ModeChanged( KalziumPainter::MODE) ),
+ m_legendWidget, SLOT(setMode(KalziumPainter::MODE) ) );
+ connect( m_PeriodicTableView, SIGNAL(TableTypeChanged( KalziumTableType* ) ),
+ m_legendWidget, SLOT( setTableType( KalziumTableType * ) ) );
+ connect( m_PeriodicTableView, SIGNAL( SchemeChanged( KalziumSchemeType * ) ),
+ m_legendWidget, SLOT( setScheme( KalziumSchemeType * ) ) );
- m_TableInfoWidget = new TableInfoWidget( this );
- connect( m_PeriodicTableView, SIGNAL(TableTypeChanged( KalziumTableType* ) ),
- m_TableInfoWidget, SLOT( setTableType( KalziumTableType * ) ) );
+ m_TableInfoWidget = new TableInfoWidget( this );
+ connect( m_PeriodicTableView, SIGNAL(TableTypeChanged( KalziumTableType* ) ),
+ m_TableInfoWidget, SLOT( setTableType( KalziumTableType * ) ) );
m_infoDialog = 0;
m_toolboxCurrent = 0;
@ -562,6 +562,8 @
void Kalzium::elementHover( int num )
{
+ extractIconicInformationAboutElement( num );
+
Element *e = KalziumDataObject::instance()->element( num );
statusBar()->changeItem( i18nc( "For example: \"Carbon (6), Mass: 12.0107 u\"", "%1 (%2), Mass: %3 u" ,
e->dataAsString( ChemicalDataObject::name ) ,
@ -570,7 +572,30 @
m_detailWidget->setBackgroundColor( m_PeriodicTableView->brushForElement( num ).color() );
}
+
+void Kalzium::extractIconicInformationAboutElement( int elementNumber )
+{
+ QString setname = "school";
+ QString pathname = KGlobal::dirs()->findResourceDir( "appdata", "data/iconsets/" ) + "data/iconsets/";
+ QString filename = pathname + setname + '/' + "iconinformation.txt";
+ QFile file(filename);
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ return;
+
+ QString infoline;
+
+ QTextStream in(&file);
+ while (!in.atEnd()) {
+ QString tmp = in.readLine();
+ if( tmp.startsWith( QString::number( elementNumber ) ) )
+ infoline = tmp;
+ }
+
+ QString realText = infoline.remove( QRegExp("\\d+ ") );
+ kDebug() << "the final text: " << realText << endl;
+}
+
void Kalzium::openInformationDialog( int number )
{
if (m_infoDialog)
--- trunk/KDE/kdeedu/kalzium/src/kalzium.h #659419:659420
@ -61,8 +61,8 @
private:
DetailedInfoDlg *m_infoDialog;
- LegendWidget *m_legendWidget;
- TableInfoWidget *m_TableInfoWidget;
+ LegendWidget *m_legendWidget;
+ TableInfoWidget *m_TableInfoWidget;
/**
* this pointer points to the PeriodicTableView.
@ -78,6 +78,8 @
*initialize the sidebars
*/
void setupSidebars();
+
+ void extractIconicInformationAboutElement( int elementNumber );
/**
* all KActions Kalzium uses
More information about the Kalzium
mailing list