/*************************************************************************** sq_glview.cpp - description ------------------- begin : Thu Nov 29 2007 copyright : (C) 2007 by Baryshev Dmitry email : ksquirrel.iv@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include "sq_glview.h" SQ_GLView * SQ_GLView::m_inst = 0; /***************************************/ SQ_TextSetter::SQ_TextSetter(TQObject *parent) : TQObject(parent) { dest = "---"; } SQ_TextSetter::~SQ_TextSetter() {} void SQ_TextSetter::setText(const TQString &s) { dest = s; emit changed(); } /***************************************/ SQ_GLView::SQ_GLView() : TQObject() { m_inst = this; map.insert("SBDecoded", new SQ_TextSetter(this)); map.insert("SBFrame", new SQ_TextSetter(this)); map.insert("SBLoaded", new SQ_TextSetter(this)); map.insert("SBGLZoom", new SQ_TextSetter(this)); map.insert("SBGLAngle", new SQ_TextSetter(this)); map.insert("SBFile", new SQ_TextSetter(this)); tmp = new SQ_TextSetter(this); SQ_Setters::iterator itEnd = map.end(); for(SQ_Setters::iterator it = map.begin();it != itEnd;++it) connect(it.data(), TQT_SIGNAL(changed()), this, TQT_SLOT(slotChanged())); } SQ_GLView::~SQ_GLView() {} SQ_TextSetter* SQ_GLView::sbarWidget(const TQString &name) { SQ_Setters::iterator it = map.find(name); return (it == map.end() ? tmp : it.data()); } void SQ_GLView::resetStatusBar() { SQ_Setters::iterator itEnd = map.end(); for(SQ_Setters::iterator it = map.begin();it != itEnd;++it) { it.data()->blockSignals(true); it.data()->setText("---"); it.data()->blockSignals(false); } slotChanged(); } void SQ_GLView::slotChanged() { TQString result; static const TQString &line = KGlobal::staticQString(" | "); result.append(map["SBDecoded"]->text()); result.append(line); result.append(map["SBFrame"]->text()); result.append(line); result.append(map["SBLoaded"]->text()); result.append(line); result.append(map["SBGLZoom"]->text()); result.append(line); result.append(map["SBGLAngle"]->text()); result.append(line); result.append(""); result.append(map["SBFile"]->text()); result.append(""); emit message(result); } #include "sq_glview.moc"