Permalink
Browse files

Remove depreacted/unused selector widget.

  • Loading branch information...
stuartm committed Aug 16, 2011
1 parent 9fe585d commit 0ed7f2cb075573da32b2d3765632505d1d43f6d6
@@ -1613,11 +1613,6 @@ UICheckBoxType* MythThemedDialog::getUICheckBoxType(const QString &name)
return GetUIType<UICheckBoxType>(this, name);
}
-UISelectorType* MythThemedDialog::getUISelectorType(const QString &name)
-{
- return GetUIType<UISelectorType>(this, name);
-}
-
UIBlackHoleType* MythThemedDialog::getUIBlackHoleType(const QString &name)
{
return GetUIType<UIBlackHoleType>(this, name);
@@ -23,7 +23,6 @@ class UIPushButtonType;
class UITextButtonType;
class UIRepeatedImageType;
class UICheckBoxType;
-class UISelectorType;
class UIBlackHoleType;
class UIImageType;
class UIStatusBarType;
@@ -371,7 +370,6 @@ class MPUBLIC MythThemedDialog : public MythDialog
UITextButtonType *getUITextButtonType(const QString &name);
UIRepeatedImageType *getUIRepeatedImageType(const QString &name);
UICheckBoxType *getUICheckBoxType(const QString &name);
- UISelectorType *getUISelectorType(const QString &name);
UIBlackHoleType *getUIBlackHoleType(const QString &name);
UIImageType *getUIImageType(const QString &name);
UIStatusBarType *getUIStatusBarType(const QString &name);
@@ -3230,165 +3230,6 @@ void UICheckBoxType::setState(bool checked_or_not)
// ********************************************************************
-UISelectorType::UISelectorType(const QString &name, QPixmap on, QPixmap off,
- QPixmap pushed, QRect area)
- : UIPushButtonType(name, on, off, pushed)
-{
- m_area = area;
- current_data = NULL;
-}
-
-void UISelectorType::Draw(QPainter *p, int drawlayer, int context)
-{
- if (hidden)
- return;
-
- if (context != m_context)
- {
- if (m_context != -1)
- {
- return;
- }
- }
-
- if (drawlayer != m_order)
- {
- // not my turn
- return;
- }
-
- if (currently_pushed)
- {
- p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap);
- }
- else
- {
- if (has_focus)
- {
- p->drawPixmap(m_displaypos.x(), m_displaypos.y(), on_pixmap);
- }
- else
- {
- p->drawPixmap(m_displaypos.x(), m_displaypos.y(), off_pixmap);
- }
- }
- if (current_data)
- {
- p->setFont(m_font->face);
- p->setBrush(m_font->color);
- p->setPen(QPen(m_font->color, (int)(2 * m_wmult)));
- p->drawText(m_displaypos.x() + on_pixmap.width() + 4,
- m_displaypos.y() + 4, // HACK!!!
- m_area.right(),
- m_area.bottom(),
- Qt::AlignLeft,
- current_data->getString());
- }
-}
-
-void UISelectorType::calculateScreenArea()
-{
- QRect r = m_area;
- r.translate(m_parent->GetAreaRect().left(), m_parent->GetAreaRect().top());
- screen_area = r;
-}
-
-void UISelectorType::addItem(int an_int, const QString &a_string)
-{
- IntStringPair *new_data = new IntStringPair(an_int, a_string);
- my_data.append(new_data);
- if (!current_data)
- {
- current_data = new_data;
- }
-}
-
-void UISelectorType::setToItem(int which_item)
-{
- for(uint i = 0; i < (uint)my_data.size(); i++)
- {
- if (my_data[i]->getInt() == which_item)
- {
- current_data = my_data[i];
- refresh();
- }
- }
-}
-
-void UISelectorType::setToItem(const QString &which_item)
-{
- for (uint i = 0; i < (uint)my_data.size(); i++)
- {
- if (my_data[i]->getString() == which_item)
- {
- current_data = my_data[i];
- refresh();
- }
- }
-}
-
-QString UISelectorType::getCurrentString()
-{
- if (current_data)
- return current_data->getString();
- else
- return "";
-}
-
-int UISelectorType::getCurrentInt()
-{
- if (current_data)
- return current_data->getInt();
- else
- return -1;
-}
-
-
-void UISelectorType::push(bool up_or_down)
-{
- if (currently_pushed)
- {
- return;
- }
- currently_pushed = true;
- push_timer.setSingleShot(true);
- push_timer.start(300);
-
- if (current_data)
- {
- int cur_indx = my_data.indexOf(current_data);
- int next_indx = (up_or_down) ? cur_indx + 1 : cur_indx - 1;
-
- if (next_indx >= my_data.size())
- current_data = my_data.empty() ? NULL : my_data.front();
- else if (next_indx < 0)
- current_data = my_data.empty() ? NULL : my_data.back();
- else
- current_data = my_data[next_indx];
-
- if (current_data)
- emit pushed(current_data->getInt());
- }
- refresh();
-}
-
-void UISelectorType::unPush()
-{
- currently_pushed = false;
- refresh();
-}
-
-UISelectorType::~UISelectorType()
-{
- while (!my_data.empty())
- {
- delete my_data.back();
- my_data.pop_back();
- }
-}
-
-// ********************************************************************
-
UIBlackHoleType::UIBlackHoleType(const QString &name)
: UIType(name)
{
@@ -680,75 +680,6 @@ class MPUBLIC UICheckBoxType : public UIType
QString label;
};
-class IntStringPair
-{
- // Minuscule class for holding data
- // in a UISelectorType (below)
-
- public:
-
- IntStringPair(int an_int, const QString a_string){my_int = an_int; my_string = a_string;}
-
- void setString(const QString &a_string){my_string = a_string;}
- void setInt(int an_int){my_int = an_int;}
- QString getString(){return my_string;}
- int getInt(){return my_int;}
-
-
- private:
-
- int my_int;
- QString my_string;
-
-};
-
-
-class MPUBLIC UISelectorType : public UIPushButtonType
-{
- Q_OBJECT
-
- //
- // A theme-able "thingy" (that's the
- // official term) that can hold a list
- // of strings and emit an int and/or
- // the string when the user selects
- // from among them.
- //
-
- public:
-
- UISelectorType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed, QRect area);
- ~UISelectorType();
-
- void Draw(QPainter *, int drawlayer, int context);
- void calculateScreenArea();
- void addItem(int an_int, const QString &a_string);
- void setFont(fontProp *font) { m_font = font; }
- QString getCurrentString();
- int getCurrentInt();
-
- public slots:
-
- void push(bool up_or_down);
- void unPush();
- void activate(){push(true);}
- void cleanOut(){current_data = NULL; my_data.clear();}
- void setToItem(int which_item);
- void setToItem(const QString &which_item);
-
- signals:
-
- void pushed(int);
-
- private:
-
- QRect m_area;
- fontProp *m_font;
- QList<IntStringPair*> my_data;
- IntStringPair *current_data;
-
-};
-
class MPUBLIC UIBlackHoleType : public UIType
{
Q_OBJECT
Oops, something went wrong.

0 comments on commit 0ed7f2c

Please sign in to comment.