summaryrefslogtreecommitdiffstats
path: root/src/ksquirrelpart/sq_glview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ksquirrelpart/sq_glview.cpp')
-rw-r--r--src/ksquirrelpart/sq_glview.cpp114
1 files changed, 114 insertions, 0 deletions
diff --git a/src/ksquirrelpart/sq_glview.cpp b/src/ksquirrelpart/sq_glview.cpp
new file mode 100644
index 0000000..8fb909a
--- /dev/null
+++ b/src/ksquirrelpart/sq_glview.cpp
@@ -0,0 +1,114 @@
+/***************************************************************************
+ 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 <tdeglobal.h>
+
+#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(), TQ_SIGNAL(changed()), this, TQ_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 = TDEGlobal::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("<b>");
+ result.append(map["SBFile"]->text());
+ result.append("</b>");
+
+ emit message(result);
+}
+
+#include "sq_glview.moc"