Bug 144861 - Add explanatory text to element's icon
Summary: Add explanatory text to element's icon
Status: RESOLVED DUPLICATE of bug 141901
Alias: None
Product: kalzium
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kalzium Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-30 09:36 UTC by Benoît Jacob
Modified: 2008-08-05 20:06 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benoît Jacob 2007-04-30 09:36:39 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Hey Carsten don't remember this IRC discussion :)

[09:24] <bjacob> carsten: IDEA!!
[09:25] <bjacob> couldn't you add for each element a short text explaining the icon? just copy the text from the "icon ideas" page. it would be much more educating than just the icon
[09:25] <carsten> bjacob: took ages to compile the list, believe me :)
[09:25] <bjacob> icon --> good to raise interest. then educate with text :)
[09:25] <carsten> bjacob: That is easy, I'd have to add one txt-file per iconset (one file irght now) and that file is parsed for the tooltip
[09:25] <carsten> 1 blah blah blah
[09:25] <carsten> 2 bulsdf lskdfj laskdfj
[09:26] <bjacob> you could also add in the text the other uses of the element. like you have in the "icon ideas" page
Comment 1 Benoît Jacob 2007-04-30 09:37:26 UTC
I said "don't remember" but I meant "don't forget" or "remember" of course!
Comment 2 Benoît Jacob 2007-04-30 09:42:24 UTC
another idea: in "iconic look" mode, the explanatory text could be shown as a mouseover info-bubble.
Comment 3 cniehaus 2007-04-30 10:20:33 UTC
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
Comment 4 Carsten Niehaus 2008-08-05 20:06:55 UTC
This is basically a dup...

*** This bug has been marked as a duplicate of 141901 ***