Permalink
Browse files

Remove depreacted/unused remoteedit widget.

  • Loading branch information...
1 parent 201c180 commit 864bc7745c226b10d2fe03c8b635abdae3e39545 @stuartm stuartm committed Aug 16, 2011
@@ -9,7 +9,6 @@ using namespace std;
#include <QDir>
#include <QLayout>
#include <QRegExp>
-#include <QImageReader>
#include <QLabel>
#include <QPixmap>
#include <QKeyEvent>
@@ -1593,11 +1592,6 @@ UITextType* MythThemedDialog::getUITextType(const QString &name)
return GetUIType<UITextType>(this, name);
}
-UIRemoteEditType* MythThemedDialog::getUIRemoteEditType(const QString &name)
-{
- return GetUIType<UIRemoteEditType>(this, name);
-}
-
UIPushButtonType* MythThemedDialog::getUIPushButtonType(const QString &name)
{
return GetUIType<UIPushButtonType>(this, name);
@@ -21,7 +21,6 @@ class UIManagedTreeListType;
class UITextType;
class UIPushButtonType;
class UITextButtonType;
-class UIRemoteEditType;
class UIRepeatedImageType;
class UICheckBoxType;
class UISelectorType;
@@ -370,7 +369,6 @@ class MPUBLIC MythThemedDialog : public MythDialog
UITextType *getUITextType(const QString &name);
UIPushButtonType *getUIPushButtonType(const QString &name);
UITextButtonType *getUITextButtonType(const QString &name);
- UIRemoteEditType *getUIRemoteEditType(const QString &name);
UIRepeatedImageType *getUIRepeatedImageType(const QString &name);
UICheckBoxType *getUICheckBoxType(const QString &name);
UISelectorType *getUISelectorType(const QString &name);
@@ -1219,173 +1219,6 @@ void UITextType::calculateScreenArea()
// ******************************************************************
-UIRemoteEditType::UIRemoteEditType(const QString &name, fontProp *font,
- const QString &text, int dorder,
- QRect displayrect)
- : UIType(name)
-{
- m_font = font;
- m_text = text;
- m_displaysize = displayrect;
- m_order = dorder;
- edit = NULL;
- takes_focus = true;
-}
-
-void UIRemoteEditType::createEdit(MythThemedDialog* parent)
-{
- m_parentDialog = parent;
- edit = new MythRemoteLineEdit(parent);
-
- edit->setFocusPolicy( Qt::NoFocus );
- edit->setText(m_text);
- edit->setCurrentFont(m_font->face);
- edit->setMinimumHeight(getScreenArea().height());
- edit->setMaximumHeight(getScreenArea().height());
- edit->setGeometry(getScreenArea());
- edit->setCharacterColors(m_unselected, m_selected, m_special);
-
- connect(edit, SIGNAL(tryingToLooseFocus(bool)),
- this, SLOT(takeFocusAwayFromEditor(bool)));
- connect(edit, SIGNAL(textChanged(QString)),
- this, SLOT(editorChanged(QString)));
-
- edit->show();
-}
-
-UIRemoteEditType::~UIRemoteEditType()
-{
- if (edit)
- {
- edit->hide();
- edit->deleteLater();
- edit = NULL;
- }
-}
-
-void UIRemoteEditType::setText(const QString text)
-{
- m_text = text;
- if (edit)
- edit->setText(text);
- //refresh();
-}
-
-QString UIRemoteEditType::getText()
-{
- if (edit)
- return edit->text();
- else
- return QString::null;
-}
-
-void UIRemoteEditType::setFont(fontProp *font)
-{
- m_font = font;
- if (edit)
- edit->setCurrentFont(font->face);
-}
-
-void UIRemoteEditType::setCharacterColors(QColor unselected, QColor selected,
- QColor special)
-{
- m_unselected = unselected;
- m_selected = selected;
- m_special = special;
-
- if (edit)
- edit->setCharacterColors(unselected, selected, special);
-}
-
-void UIRemoteEditType::show(void)
-{
- if (edit)
- edit->show();
-
- UIType::show();
-}
-
-void UIRemoteEditType::hide(void)
-{
- if (edit)
- edit->hide();
-
- UIType::hide();
-}
-
-void UIRemoteEditType::Draw(QPainter *dr, int drawlayer, int context)
-{
- if (hidden)
- {
- if (edit && edit->isVisible())
- edit->hide();
-
- return;
- }
-
- if (m_context == context || m_context == -1)
- {
- if (drawlayer == m_order)
- {
- if (edit && !edit->isVisible())
- edit->show();
-
- dr = dr;
- }
- }
- else
- {
- // not in this context so hide the edit
- if (edit && edit->isVisible())
- edit->hide();
- }
-}
-
-void UIRemoteEditType::calculateScreenArea()
-{
- QRect r = m_displaysize;
- r.translate(m_parent->GetAreaRect().left(), m_parent->GetAreaRect().top());
- screen_area = r;
-}
-
-void UIRemoteEditType::takeFocusAwayFromEditor(bool up_or_down)
-{
- if (m_parentDialog)
- m_parentDialog->nextPrevWidgetFocus(up_or_down);
-
- looseFocus();
-}
-
-bool UIRemoteEditType::takeFocus()
-{
- if (edit)
- {
- QTextCursor tmp = edit->textCursor();
- tmp.movePosition(QTextCursor::End);
- edit->setTextCursor(tmp);
- edit->setFocus();
- }
-
- return UIType::takeFocus();
-}
-
-void UIRemoteEditType::looseFocus()
-{
- if (edit)
- {
- edit->clearFocus();
- }
-
- UIType::looseFocus();
-}
-
-void UIRemoteEditType::editorChanged(QString value)
-{
- emit textChanged(value);
-}
-
-// ******************************************************************
-
UIStatusBarType::UIStatusBarType(QString &name, QPoint loc, int dorder)
: UIType(name)
{
@@ -388,49 +388,6 @@ class MPUBLIC UITextType : public UIType
};
-class MPUBLIC UIRemoteEditType : public UIType
-{
- Q_OBJECT
-
- public:
-
- UIRemoteEditType(const QString &name, fontProp *font, const QString &text,
- int dorder, QRect displayrect);
- ~UIRemoteEditType();
-
- void createEdit(MythThemedDialog* parent);
- QWidget *getEdit(void) { return (QWidget*) edit; };
- void Draw(QPainter *, int drawlayer, int context);
- void setArea(QRect area){m_displaysize = area;}
- void setText(const QString some_text);
- QString getText();
- void setFont(fontProp *font);
- void setCharacterColors(QColor unselected, QColor selected, QColor special);
- void calculateScreenArea();
-
- public slots:
- void takeFocusAwayFromEditor(bool up_or_down);
- void editorChanged(QString value);
- virtual bool takeFocus();
- virtual void looseFocus();
- virtual void show();
- virtual void hide();
-
- signals:
- void textChanged(QString value);
-
- private:
- MythRemoteLineEdit *edit;
- QRect m_displaysize;
- QString m_text;
- fontProp *m_font;
- QColor m_unselected;
- QColor m_selected;
- QColor m_special;
-
- MythThemedDialog* m_parentDialog;
-};
-
class MPUBLIC UIStatusBarType : public UIType
{
public:
@@ -742,10 +742,6 @@ void XMLParse::parseContainer(QDomElement &element, QString &newname, int &conte
{
parseTextArea(container, info);
}
- else if (info.tagName() == "remoteedit")
- {
- parseRemoteEdit(container, info);
- }
else if (info.tagName() == "statusbar")
{
parseStatusBar(container, info);
@@ -954,125 +950,6 @@ void XMLParse::parseTextArea(LayerSet *container, QDomElement &element)
container->AddType(text);
}
-void XMLParse::parseRemoteEdit(LayerSet *container, QDomElement &element)
-{
- int context = -1;
- QRect area = QRect(0, 0, 0, 0);
- QString font = "";
- QString value = "";
- int draworder = 0;
- QColor selectedColor = QColor(0, 255, 255);
- QColor unselectedColor = QColor(100, 100, 100);
- QColor specialColor = QColor(255, 0, 0);
-
- QString name = element.attribute("name", "");
- if (name.isNull() || name.isEmpty())
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC + "RemoteEdit needs a name");
- return;
- }
-
- QString layerNum = element.attribute("draworder", "");
- if (layerNum.isNull() || layerNum.isEmpty())
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC + "RemoteEdit needs a draworder");
- return;
- }
- draworder = layerNum.toInt();
-
- for (QDomNode child = element.firstChild(); !child.isNull();
- child = child.nextSibling())
- {
- QDomElement info = child.toElement();
- if (!info.isNull())
- {
- if (info.tagName() == "context")
- {
- context = getFirstText(info).toInt();
- }
- else if (info.tagName() == "area")
- {
- area = parseRect(getFirstText(info));
- normalizeRect(area);
- }
- else if (info.tagName() == "font")
- {
- font = getFirstText(info);
- }
- else if (info.tagName() == "value")
- {
- if ((value.isNull() || value.isEmpty()) &&
- info.attribute("lang","").isEmpty())
- {
- value = qApp->translate("ThemeUI",
- getFirstText(info).toUtf8(),
- NULL,
- QCoreApplication::UnicodeUTF8);
- }
- else if (info.attribute("lang","").toLower() ==
- gCoreContext->GetLanguageAndVariant())
- {
- value = getFirstText(info);
- }
- else if (info.attribute("lang","").toLower() ==
- gCoreContext->GetLanguage())
- {
- value = getFirstText(info);
- }
- }
- else if (info.tagName() == "charcolors")
- {
- QString selected = "";
- QString unselected = "";
- QString special = "";
- selected = info.attribute("selected");
- unselected = info.attribute("unselected");
- special = info.attribute("special");
-
- if (!selected.isEmpty())
- selectedColor = createColor(selected);
-
- if (!unselected.isEmpty())
- unselectedColor = createColor(unselected);
-
- if (!special.isEmpty())
- specialColor = createColor(special);
- }
-
- else
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC +
- QString("Unknown tag '%1' in RemoteEdit")
- .arg(info.tagName()));
- return;
- }
- }
- }
-
- fontProp *testfont = GetFont(font);
- if (!testfont)
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC +
- QString("Unknown font '%1' in RemoteEdit '%2'")
- .arg(font).arg(name));
- return;
- }
-
- UIRemoteEditType *edit = new UIRemoteEditType(name, testfont, value, draworder, area);
- edit->SetScreen(wmult, hmult);
- if (context != -1)
- {
- edit->SetContext(context);
- }
- if (value.size())
- edit->setText(value);
-
- edit->SetParent(container);
- edit->setCharacterColors(unselectedColor, selectedColor, specialColor);
- edit->calculateScreenArea();
- container->AddType(edit);
-}
-
void XMLParse::parseListArea(LayerSet *container, QDomElement &element)
{
int context = -1;
Oops, something went wrong.

0 comments on commit 864bc77

Please sign in to comment.