Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove depreacted/unused imagegrid widget.

  • Loading branch information...
commit 201c180336c98ef6a365c309930d37f585b2e2d4 1 parent 3926cbc
@stuartm stuartm authored
View
15 mythtv/libs/libmyth/mythdialogs.cpp
@@ -47,7 +47,7 @@ MythDialog::MythDialog(MythMainWindow *parent, const char *name, bool setsize)
setObjectName(name);
if (!parent)
{
- LOG(VB_GENERAL, LOG_ALERT,
+ LOG(VB_GENERAL, LOG_ALERT,
"Trying to create a dialog without a parent.");
return;
}
@@ -119,7 +119,7 @@ void MythDialog::setResult(DialogCode r)
if ((r < kDialogCodeRejected) ||
((kDialogCodeAccepted < r) && (r < kDialogCodeListStart)))
{
- LOG(VB_GENERAL, LOG_ALERT,
+ LOG(VB_GENERAL, LOG_ALERT,
QString("MythDialog::setResult(%1) "
"called with invalid DialogCode").arg(r));
}
@@ -167,7 +167,7 @@ DialogCode MythDialog::exec(void)
{
if (in_loop)
{
- LOG(VB_GENERAL, LOG_ALERT,
+ LOG(VB_GENERAL, LOG_ALERT,
"MythDialog::exec: Recursive call detected.");
return kDialogCodeRejected;
}
@@ -1213,7 +1213,7 @@ void MythThemedDialog::parseContainer(QDomElement &element)
theme->parseContainer(element, name, a_context, area);
if (name.length() < 1)
{
- LOG(VB_GENERAL, LOG_ALERT,
+ LOG(VB_GENERAL, LOG_ALERT,
"Failed to parse a container. Ignoring.");
return;
}
@@ -1369,7 +1369,7 @@ void MythThemedDialog::UpdateForegroundRect(const QRect &inv_rect)
// Debugging
//
#if 0
- LOG(VB_GENERAL, LOG_DEBUG,
+ LOG(VB_GENERAL, LOG_DEBUG,
QString("A container called \"%1\" said its "
"area is %2,%3 to %4,%5")
.arg(looper->GetName())
@@ -1654,11 +1654,6 @@ UIKeyboardType *MythThemedDialog::getUIKeyboardType(const QString &name)
return GetUIType<UIKeyboardType>(this, name);
}
-UIImageGridType* MythThemedDialog::getUIImageGridType(const QString &name)
-{
- return GetUIType<UIImageGridType>(this, name);
-}
-
LayerSet *MythThemedDialog::getContainer(const QString &name)
{
QList<LayerSet*>::iterator an_it = my_containers.begin();
View
2  mythtv/libs/libmyth/mythdialogs.h
@@ -27,7 +27,6 @@ class UICheckBoxType;
class UISelectorType;
class UIBlackHoleType;
class UIImageType;
-class UIImageGridType;
class UIStatusBarType;
class UIListBtnType;
class UIListTreeType;
@@ -376,7 +375,6 @@ class MPUBLIC MythThemedDialog : public MythDialog
UICheckBoxType *getUICheckBoxType(const QString &name);
UISelectorType *getUISelectorType(const QString &name);
UIBlackHoleType *getUIBlackHoleType(const QString &name);
- UIImageGridType *getUIImageGridType(const QString &name);
UIImageType *getUIImageType(const QString &name);
UIStatusBarType *getUIStatusBarType(const QString &name);
UIListBtnType *getUIListBtnType(const QString &name);
View
579 mythtv/libs/libmyth/uitypes.cpp
@@ -774,7 +774,7 @@ void UIImageType::LoadImage()
}
if (m_debug)
- LOG(VB_GENERAL, LOG_DEBUG,
+ LOG(VB_GENERAL, LOG_DEBUG,
QString(" -Filename: %1").arg(file));
if (m_hmult == 1 && m_wmult == 1 && m_force_x == -1 && m_force_y == -1)
@@ -1084,582 +1084,7 @@ void UIRepeatedImageType::refresh()
}
}
-// **************************************************************
-
-UIImageGridType::UIImageGridType(const QString &name, int order)
- : UIType(name)
-{
- m_name = name;
- m_order = order;
-
- activeFont = inactiveFont = selectedFont = NULL;
- window = NULL;
- defaultPixmap = normalPixmap = selectedPixmap = highlightedPixmap = NULL;
-
- topRow = rowCount = columnCount = itemCount = currentItem =
- borderWidth = padding = cellWidth = cellHeight =
- lastRow = lastColumn = curColumn = curRow = 0;
-
- textPos = UIImageGridType::textPosBottom;
- textHeight = 20;
- cutdown = true;
- setJustification((Qt::AlignLeft | Qt::AlignVCenter));
- allowFocus(true);
- showCheck = false;
- showSelected = false;
-
- allData = new QList<ImageGridItem*>;
-}
-
-UIImageGridType::~UIImageGridType(void)
-{
- if (normalPixmap)
- delete normalPixmap;
- if (highlightedPixmap)
- delete highlightedPixmap;
- if (selectedPixmap)
- delete selectedPixmap;
- if (defaultPixmap)
- delete defaultPixmap;
-
- if (checkNonPixmap)
- delete checkNonPixmap;
- if (checkHalfPixmap)
- delete checkHalfPixmap;
- if (checkFullPixmap)
- delete checkFullPixmap;
-
- if (upArrowRegPixmap)
- delete upArrowRegPixmap;
- if (upArrowActPixmap)
- delete upArrowActPixmap;
- if (dnArrowRegPixmap)
- delete dnArrowRegPixmap;
- if (upArrowActPixmap)
- delete dnArrowActPixmap;
-
- reset();
- delete allData;
-}
-
-void UIImageGridType::reset(void)
-{
- while (!allData->empty())
- {
- delete allData->back();
- allData->pop_back();
- }
- topRow = itemCount = currentItem = lastRow =
- lastColumn = curColumn = curRow = 0;
-}
-
-void UIImageGridType::setCurrentPos(int pos)
-{
- if (pos < 0 || pos > (int) allData->size() - 1)
- return;
-
- currentItem = pos;
-
- // make sure the selected item is visible
- if ((currentItem < topRow * columnCount) ||
- (currentItem >= (topRow + rowCount) * columnCount))
- {
- topRow = std::max(std::min(currentItem / columnCount,
- lastRow - rowCount + 1), 0);
- curRow = topRow;
- }
-
- curColumn = currentItem % columnCount;
- refresh();
-}
-
-void UIImageGridType::setCurrentPos(QString value)
-{
- for (uint i = 0; i < (uint)allData->size(); i++)
- {
- if ((*allData)[i]->text == value)
- {
- setCurrentPos(i);
- return;
- }
- }
-}
-
-ImageGridItem *UIImageGridType::getCurrentItem(void)
-{
- return getItemAt(currentItem);
-}
-
-ImageGridItem *UIImageGridType::getItemAt(int pos)
-{
- if (pos < 0 || pos > (int) allData->size() - 1)
- return NULL;
-
- return (*allData)[pos];
-}
-
-void UIImageGridType::appendItem(ImageGridItem *item)
-{
- allData->append(item);
- itemCount = allData->size();
-}
-
-void UIImageGridType::updateItem(ImageGridItem *item)
-{
- updateItem(allData->indexOf(item), item);
-}
-
-void UIImageGridType::updateItem(int itemNo, ImageGridItem *item)
-{
- if (itemNo < 0 || itemNo > (int) allData->size() - 1)
- return;
-
- ImageGridItem *gridItem = (*allData)[itemNo];
-
- if (gridItem)
- {
- gridItem = item;
- }
-
- // if this item is visible update the imagegrid
- if ((itemNo >= topRow * columnCount) &&
- (itemNo < (topRow + rowCount) * columnCount))
- refresh();
-}
-
-void UIImageGridType::removeItem(ImageGridItem *item)
-{
- removeItem(allData->indexOf(item));
-}
-
-void UIImageGridType::removeItem(int itemNo)
-{
- if (itemNo < 0 || itemNo > (int) allData->size() - 1)
- return;
-
- delete (*allData)[itemNo];
- allData->removeAt(itemNo);
-
- itemCount--;
- lastRow = std::max((int) ceilf((float) itemCount/columnCount) - 1, 0);
- lastColumn = std::max(itemCount - lastRow * columnCount - 1, 0);
-
- // make sure the selected item is still visible
- if (topRow + rowCount > lastRow)
- topRow = std::max(std::min(currentItem / columnCount,
- lastRow - rowCount + 1), 0);
-
- if (curRow > lastRow)
- curRow = topRow;
-
- refresh();
-}
-
-void UIImageGridType::setJustification(int jst)
-{
- justification = jst;
- multilineText = (justification & Qt::TextWordWrap) > 0;
-}
-
-bool UIImageGridType::handleKeyPress(QString action)
-{
- if (!has_focus)
- return false;
-
- if (action == "LEFT")
- {
- if (curRow == 0 && curColumn == 0)
- return true;
-
- curColumn--;
- if (curColumn < 0)
- {
- curColumn = columnCount - 1;
- curRow--;
- if (curRow < topRow)
- topRow = curRow;
- }
- }
- else if (action == "RIGHT")
- {
- if ((curRow * columnCount + curColumn) >= itemCount - 1)
- return true;
- curColumn++;
- if (curColumn >= columnCount)
- {
- curColumn = 0;
- curRow++;
- if (curRow >= topRow + rowCount)
- topRow++;
- }
- }
- else if (action == "UP")
- {
- if (curRow == 0)
- {
- curRow = lastRow;
- curColumn = std::min(curColumn, lastColumn);
- topRow = std::max(curRow - rowCount + 1,0);
- }
- else
- {
- curRow--;
- if (curRow < topRow)
- topRow = curRow;
- }
- }
- else if (action == "DOWN")
- {
- if (curRow == lastRow)
- {
- curRow = 0;
- topRow = 0;
- }
- else
- {
- curRow++;
-
- if (curRow == lastRow)
- curColumn = std::min(curColumn, lastColumn);
-
- if (curRow >= topRow + rowCount)
- topRow++;
- }
- }
- else if (action == "PAGEUP")
- {
- if (curRow == 0)
- return true;
- else
- curRow = std::max(curRow - rowCount, 0);
-
- topRow = curRow;
- }
- else if (action == "PAGEDOWN")
- {
- if (curRow == lastRow)
- return true;
- else
- curRow += rowCount;
-
- if (curRow >= lastRow)
- {
- curRow = lastRow;
- curColumn = std::min(curColumn, lastColumn);
- }
-
- topRow = std::max(curRow - rowCount + 1,0);
- }
- else if (action == "SELECT" && showSelected)
- {
- ImageGridItem *item = NULL;
- if (currentItem < (*allData).size())
- item = (*allData)[currentItem];
- if (item)
- item->selected = !item->selected;
- }
- else
- return false;
-
-
- currentItem = curRow * columnCount + curColumn;
-
- showUpArrow = (topRow != 0);
- showDnArrow = (topRow + rowCount <= lastRow);
-
- refresh();
-
- if (currentItem < (*allData).size())
- emit itemChanged((*allData)[currentItem]);
-
- return true;
-}
-
-void UIImageGridType::Draw(QPainter *p, int drawlayer, int context)
-{
- if (hidden)
- return;
-
- if ((m_context != context && m_context != -1) || drawlayer != m_order)
- return;
-
- // redraw the complete view rectangle
- QRect pr = displayRect;
-
- if (m_debug)
- {
- p->setPen(Qt::red);
- p->drawRect(QRect(displayRect.x(), displayRect.y(),
- displayRect.width(), displayRect.height()));
- }
-
- int curPos = topRow * columnCount;
-
- for (int y = 0; y < rowCount; y++)
- {
- int ypos = displayRect.y() + y * (padding + cellHeight);
-
- for (int x = 0; x < columnCount; x++)
- {
- if (curPos >= itemCount)
- continue;
-
- int xpos = displayRect.x() + x * (padding + cellWidth);
- drawCell(p, curPos, xpos, ypos);
-
- curPos++;
- }
- }
-
- if (showScrollArrows)
- {
- if (showUpArrow)
- p->drawPixmap(displayRect.x(),
- displayRect.bottom() - upArrowActPixmap->height(),
- *upArrowActPixmap);
- else
- p->drawPixmap(displayRect.x(),
- displayRect.bottom() - upArrowRegPixmap->height(),
- *upArrowRegPixmap);
- if (showDnArrow)
- p->drawPixmap(displayRect.x() + upArrowRegPixmap->width() +
- (int)(5 * m_wmult),
- displayRect.bottom() - dnArrowActPixmap->height(),
- *dnArrowActPixmap);
- else
- p->drawPixmap(displayRect.x() + upArrowRegPixmap->width() +
- (int)(5 * m_wmult),
- displayRect.bottom() - dnArrowRegPixmap->height(),
- *dnArrowRegPixmap);
- }
-}
-
-void UIImageGridType::drawCell(QPainter *p, int curPos, int xpos, int ypos)
-{
- QRect r(xpos, ypos, cellWidth, cellHeight);
-
- if (curPos == currentItem)
- {
- // highlighted
- if (m_debug)
- p->setPen(Qt::yellow);
- if (highlightedPixmap)
- p->drawPixmap(xpos, ypos, *highlightedPixmap);
- }
- else
- {
- if (m_debug)
- p->setPen(Qt::green);
- if (normalPixmap)
- p->drawPixmap(xpos, ypos, *normalPixmap);
- }
-
- // draw item image
- QPixmap *pixmap = NULL;
- QString filename = "";
- ImageGridItem *item = NULL;
-
- if (curPos < (*allData).size())
- item = (*allData)[curPos];
-
- // use pixmap stored in item
- if (item)
- pixmap = item->pixmap;
-
- // use default pixmap if non found
- if (!pixmap)
- pixmap = defaultPixmap;
-
- if (pixmap && !pixmap->isNull())
- p->drawPixmap(xpos + imageRect.x() +
- ( (imageRect.width() - pixmap->width()) / 2 ),
- ypos + imageRect.y() +
- ( (imageRect.height() - pixmap->height()) / 2 ),
- *pixmap, 0, 0, -1, -1);
-
- if (m_debug)
- {
- p->setBrush(Qt::NoBrush);
- p->drawRect(r);
- }
-
- // draw text area
- drawText(p, curPos, xpos, ypos);
-}
-
-void UIImageGridType::drawText(QPainter *p, int curPos, int xpos, int ypos)
-{
- QRect textRect(xpos, ypos, cellWidth, textHeight);
- if (textPos == UIImageGridType::textPosBottom)
- textRect.moveTop(ypos + cellHeight - textHeight);
-
- if (m_debug)
- {
- p->setBrush(Qt::NoBrush);
- p->setPen(Qt::blue);
- p->drawRect(textRect);
- }
-
- QString msg = "Invalid Item!!";
- ImageGridItem * item = NULL;
-
- if (curPos < (*allData).size())
- item = (*allData)[curPos];
-
- if (item)
- {
- msg = item->text;
-
- if (showCheck)
- {
- QRect cr(checkRect);
- cr.translate(textRect.x(), textRect.y());
- if (item->selected)
- p->drawPixmap(cr, *checkFullPixmap);
- else
- p->drawPixmap(cr, *checkNonPixmap);
-
- textRect.setX(textRect.x() + cr.width() + (int)(5 * m_wmult));
- }
- }
-
- if (m_debug)
- {
- p->setBrush(Qt::NoBrush);
- p->setPen(Qt::blue);
- p->drawRect(textRect);
- }
-
- fontProp *font = has_focus ? activeFont : inactiveFont;
-
- if (item && item->selected && showSelected)
- font = selectedFont;
-
- if (cutdown)
- msg = cutDown(msg, &font->face, multilineText,
- textRect.width(), textRect.height());
-
- p->setFont(font->face);
-
- if (font->shadowOffset.x() != 0 || font->shadowOffset.y() != 0)
- {
- p->setBrush(font->dropColor);
- p->setPen(QPen(font->dropColor, (int)(2 * m_wmult)));
- p->drawText(textRect.left() + font->shadowOffset.x(),
- textRect.top() + font->shadowOffset.y(),
- textRect.width(), textRect.height(), justification, msg);
- }
-
- p->setBrush(font->color);
- p->setPen(QPen(font->color, (int)(2 * m_wmult)));
- p->drawText(textRect, justification, msg);
-}
-
-void UIImageGridType::recalculateLayout(void)
-{
- loadImages();
-
- int arrowHeight = 0;
- if (showScrollArrows)
- arrowHeight = upArrowRegPixmap->height() + (int)(5 * m_hmult);
-
- cellWidth = (displayRect.width() - (padding * (columnCount -1))) /
- columnCount;
- cellHeight = (displayRect.height() - arrowHeight -
- (padding * (rowCount -1))) / rowCount;
- lastRow = std::max((int) ceilf((float) itemCount/columnCount) - 1, 0);
- lastColumn = std::max(itemCount - lastRow * columnCount - 1, 0);
-
-
- // calc image item bounding rect
- int yoffset = 0;
- int bw = cellWidth;
- int bh = cellHeight - textHeight;
- int sw = (int) (7 * m_wmult);
- int sh = (int) (7 * m_hmult);
-
- imageRect.setX(sw);
- imageRect.setY(sh + yoffset);
- imageRect.setWidth((int) (bw - 2 * sw));
- imageRect.setHeight((int) (bh - 2 * sw));
-
- // centre check pixmap in text area
- int cw = checkFullPixmap->width();
- int ch = checkFullPixmap->height();
- checkRect = QRect(0, (textHeight - ch) / 2, cw, ch);
-
- loadCellImages();
-}
-
-QPixmap *UIImageGridType::createScaledPixmap(QString filename,
- int width, int height,
- Qt::AspectRatioMode mode)
-{
- QPixmap *pixmap = NULL;
-
- if (filename != "")
- {
- QImage *img = GetMythUI()->LoadScaleImage(filename);
- if (!img)
- {
- LOG(VB_GENERAL, LOG_ERR, "Failed to load image" + filename);
- return NULL;
- }
- else
- {
- img->scaled(width, height, mode, Qt::SmoothTransformation);
- pixmap = new QPixmap(QPixmap::fromImage(*img));
- delete img;
- }
- }
-
- return pixmap;
-}
-
-void UIImageGridType::loadImages(void)
-{
- MythUIHelper *ui = GetMythUI();
- checkNonPixmap = ui->LoadScalePixmap("lb-check-empty.png");
- checkHalfPixmap = ui->LoadScalePixmap("lb-check-half.png");
- checkFullPixmap = ui->LoadScalePixmap("lb-check-full.png");
- upArrowRegPixmap = ui->LoadScalePixmap("lb-uparrow-reg.png");
- upArrowActPixmap = ui->LoadScalePixmap("lb-uparrow-sel.png");
- dnArrowRegPixmap = ui->LoadScalePixmap("lb-dnarrow-reg.png");
- dnArrowActPixmap = ui->LoadScalePixmap("lb-dnarrow-sel.png");
-}
-
-void UIImageGridType::loadCellImages(void)
-{
- int imgHeight = cellHeight - textHeight;
- int imgWidth = cellWidth;
- int sw = (int) (7 * m_wmult);
- int sh = (int) (7 * m_hmult);
-
- normalPixmap = createScaledPixmap(normalImage, imgWidth, imgHeight,
- Qt::IgnoreAspectRatio);
- highlightedPixmap = createScaledPixmap(highlightedImage, imgWidth,
- imgHeight, Qt::IgnoreAspectRatio);
- selectedPixmap = createScaledPixmap(selectedImage, imgWidth, imgHeight,
- Qt::IgnoreAspectRatio);
- defaultPixmap = createScaledPixmap(defaultImage, imgWidth - 2 * sw,
- imgHeight - 2 * sh,
- Qt::KeepAspectRatio);
-}
-
-void UIImageGridType::calculateScreenArea(void)
-{
- QRect r = displayRect;
- r.translate(m_parent->GetAreaRect().left(), m_parent->GetAreaRect().top());
- screen_area = r;
-}
-
-QSize UIImageGridType::getImageItemSize(void)
-{
- return QSize(imageRect.width(), imageRect.height());
-}
-
-// ******************************************************************
UITextType::UITextType(const QString &name, fontProp *font,
const QString &text, int dorder, QRect displayrect,
@@ -2778,7 +2203,7 @@ void UIManagedTreeListType::assignTreeData(GenericTree *a_tree)
}
else
{
- LOG(VB_GENERAL, LOG_ERR,
+ LOG(VB_GENERAL, LOG_ERR,
"somebody just assigned me to assign tree data, "
"but they gave me no data");
}
View
167 mythtv/libs/libmyth/uitypes.h
@@ -152,173 +152,6 @@ class MPUBLIC UIType : public QObject
bool hidden; // Is this "widget" seen or hidden ?
};
-class ImageGridItem
-{
- public:
- ImageGridItem(const QString &text, QPixmap *pixmap, bool selected, void *data)
- {
- this->text = text;
- this->pixmap = pixmap;
- this->selected = selected;
- this->data = data;
- }
-
- ImageGridItem(const ImageGridItem &o)
- {
- text = o.text;
- pixmap = o.pixmap;
- selected = o.selected;
- data = o.data;
- }
-
- ~ImageGridItem(void)
- {
- if (pixmap)
- {
- delete pixmap;
- pixmap = NULL;
- }
- }
-
- ImageGridItem& operator=(ImageGridItem *rhs)
- {
- text = rhs->text;
- pixmap = rhs->pixmap;
- selected = rhs->selected;
- data = rhs->data;
- return *this;
- }
-
- QString text;
- QPixmap *pixmap;
- bool selected;
- void *data;
-};
-
-class MPUBLIC UIImageGridType : public UIType
-{
- Q_OBJECT
-
- public:
-
- UIImageGridType(const QString &name, int order);
- ~UIImageGridType(void);
-
- void setColumnCount(int count) { columnCount = count; }
- void setRowCount(int count) { rowCount = count; }
- void setItemCount(int count) { itemCount = count; }
- void setBorderWidth(int width){ borderWidth = width; }
- void setPadding(int value){ padding = value; }
- void setArea(QRect area){ displayRect = area; }
- void appendItem(ImageGridItem *item);
- void updateItem(int itemNo, ImageGridItem *item);
- void updateItem(ImageGridItem *item);
- void removeItem(int itemNo);
- void removeItem(ImageGridItem *item);
- void reset(void);
- void setJustification(int jst);
- void setCutDown(bool state) { cutdown = state; }
- void setActiveFont(fontProp *font) { this->activeFont = font; }
- void setInactiveFont(fontProp *font) { this->inactiveFont = font; }
- void setSelectedFont(fontProp *font) { this->selectedFont = font; }
- void setWindow(MythDialog *win) { window = win; }
- void setNormalImage(QString filename) { normalImage = filename; }
- void setSelectedImage(QString filename) { selectedImage = filename; }
- void setHighlightedImage(QString filename) { highlightedImage = filename; }
- void setDefaultImage(QString filename) { defaultImage = filename; }
- void setShowChecks(bool value) { showCheck = value; }
- void setShowScrollArrows(bool value) { showScrollArrows = value; }
- void setShowSelected(bool value) { showSelected = value; }
-
- QSize getImageItemSize();
- void setCurrentPos(int pos);
- void setCurrentPos(QString value);
- int getCurrentPos() { return currentItem; }
- ImageGridItem *getCurrentItem(void);
- ImageGridItem *getItemAt(int pos);
- ImageGridItem *getTopItem(void) { return getItemAt(topRow * columnCount); }
- int getItemCount(void) { return itemCount; }
- int getVisibleCount(void) { return columnCount * rowCount; }
- int getTopItemPos(void) { return topRow * columnCount; }
-
- void calculateScreenArea();
-
- enum textPosition
- {
- textPosTop,
- textPosBottom,
- };
- void setTextPosition(textPosition position) { textPos = position; }
- void setTextHeight(int height) { textHeight = height; }
-
- void recalculateLayout(void);
-
- void Draw(QPainter *p, int drawlayer, int context);
- bool handleKeyPress(QString action);
-
-
- signals:
- void itemChanged(ImageGridItem *item);
- void selectionChanged(ImageGridItem *item);
-
- private:
- void drawCell(QPainter *p, int curPos, int xpos, int ypos);
- void drawText(QPainter *p, int curPos, int xpos, int ypos);
- void loadImages(void);
- void loadCellImages(void);
- QPixmap *createScaledPixmap(QString filename, int width, int height,
- Qt::AspectRatioMode mode);
- MythDialog *window;
- int rowCount;
- int columnCount;
- int itemCount;
- int currentItem;
- int borderWidth;
- int padding;
- int cellWidth;
- int cellHeight;
- int topRow;
- int lastRow;
- int lastColumn;
- int curColumn;
- int curRow;
-
- QRect displayRect; // bounding rect of all imagegrid
- QRect imageRect; // bounding rect of image item relative to cell rect
- QRect checkRect; // bounding rect of check pixmap
-
- textPosition textPos;
- int textHeight;
- int justification;
- bool multilineText;
- fontProp *activeFont, *inactiveFont, *selectedFont;
- bool cutdown;
- bool showCheck;
- bool showScrollArrows;
- bool showSelected;
- bool showUpArrow;
- bool showDnArrow;
- QString normalImage;
- QString highlightedImage;
- QString selectedImage;
- QString defaultImage;
-
- QPixmap *normalPixmap;
- QPixmap *highlightedPixmap;
- QPixmap *selectedPixmap;
- QPixmap *defaultPixmap;
-
- QPixmap *checkNonPixmap;
- QPixmap *checkHalfPixmap;
- QPixmap *checkFullPixmap;
-
- QPixmap *upArrowRegPixmap;
- QPixmap *upArrowActPixmap;
- QPixmap *dnArrowRegPixmap;
- QPixmap *dnArrowActPixmap;
-
- QList<ImageGridItem*> *allData;
-};
class MPUBLIC UIListType : public UIType
{
View
253 mythtv/libs/libmyth/xmlparse.cpp
@@ -72,7 +72,7 @@ bool XMLParse::doLoadTheme(QDomElement &ele, QString winName, QString themeFile)
if (!f.open(QIODevice::ReadOnly))
{
#if 0
- LOG(VB_GENERAL, LOG_ERR, "XMLParse::LoadTheme(): Can't open: " +
+ LOG(VB_GENERAL, LOG_ERR, "XMLParse::LoadTheme(): Can't open: " +
themeFile);
#endif
return false;
@@ -634,251 +634,6 @@ bool XMLParse::parseDefaultCategoryColors(QMap<QString, QString> &catColors)
return true;
}
-void XMLParse::parseImageGrid(LayerSet *container, QDomElement &element)
-{
- int context = -1;
- QString align = "";
- QString activeFont = "";
- QString inactiveFont = "";
- QString selectedFont = "";
- QString color = "";
- QString textposition = "bottom";
- QRect area;
- int textheight = 0;
- int rowcount = 3;
- int columncount = 3;
- int padding = 10;
- bool cutdown = true;
- bool multiline = false;
- bool showChecks = false;
- bool showSelected = false;
- bool showScrollArrows = false;
- QString defaultImage = "";
- QString normalImage = "";
- QString selectedImage = "";
- QString highlightedImage = "";
-
- QString name = element.attribute("name", "");
- if (name.isNull() || name.isEmpty())
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC + "Image Grid needs a name");
- return;
- }
-
- QString order = element.attribute("draworder", "");
- if (order.isNull() || order.isEmpty())
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC + "Image Grid needs an order");
- return;
- }
-
- 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() == "activefont")
- {
- activeFont = getFirstText(info);
- }
- else if (info.tagName() == "inactivefont")
- {
- inactiveFont = getFirstText(info);
- }
-
- else if (info.tagName() == "selectedfont")
- {
- selectedFont = getFirstText(info);
- }
- else if (info.tagName() == "area")
- {
- area = parseRect(getFirstText(info));
- normalizeRect(area);
- }
- else if (info.tagName() == "columncount")
- {
- columncount = getFirstText(info).toInt();
- }
- else if (info.tagName() == "rowcount")
- {
- rowcount = getFirstText(info).toInt();
- }
- else if (info.tagName() == "padding")
- {
- padding = getFirstText(info).toInt();
- }
- else if (info.tagName() == "align")
- {
- align = getFirstText(info);
- }
- else if (info.tagName() == "cutdown")
- {
- if (getFirstText(info).toLower() == "no")
- cutdown = false;
- }
- else if (info.tagName() == "showchecks")
- {
- if (getFirstText(info).toLower() == "yes")
- showChecks = true;
- }
- else if (info.tagName() == "showselected")
- {
- if (getFirstText(info).toLower() == "yes")
- showSelected = true;
- }
- else if (info.tagName() == "showscrollarrows")
- {
- if (getFirstText(info).toLower() == "yes")
- showScrollArrows = true;
- }
- else if (info.tagName() == "textheight")
- {
- textheight = getFirstText(info).toInt();
- }
- else if (info.tagName() == "textposition")
- {
- textposition = getFirstText(info);
- }
- else if (info.tagName() == "multiline")
- {
- if (getFirstText(info).toLower() == "yes")
- multiline = true;
- }
- else if (info.tagName() == "image")
- {
- QString imgname = "";
- QString file = "";
-
- imgname = info.attribute("function", "");
- if (imgname.isNull() || imgname.isEmpty())
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC +
- "Image in a image grid needs a function");
- return;
- }
-
- file = info.attribute("filename", "");
- if (file.isNull() || file.isEmpty())
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC +
- "Image in a image grid needs a filename");
- return;
- }
-
- if (imgname.toLower() == "normal")
- {
- normalImage = file;
- }
-
- if (imgname.toLower() == "selected")
- {
- selectedImage = file;
- }
-
- if (imgname.toLower() == "highlighted")
- {
- highlightedImage = file;
- }
-
- if (imgname.toLower() == "default")
- {
- defaultImage = file;
- }
- }
- else
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC +
- QString("Unknown tag '%1' in image grid")
- .arg(info.tagName()));
- return;
- }
- }
- }
- fontProp *activeProp = GetFont(activeFont);
- if (!activeProp)
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC +
- QString("Unknown active font: '%1' in image grid: '%2'")
- .arg(activeFont).arg(name));
- return;
- }
-
- fontProp *selectedProp = GetFont(selectedFont);
- if (!selectedProp)
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC +
- QString("Unknown selected font: '%1' in image grid: '%2'")
- .arg(selectedFont).arg(name));
- return;
- }
-
- fontProp *inactiveProp = GetFont(inactiveFont);
- if (!inactiveProp)
- {
- LOG(VB_GENERAL, LOG_WARNING, LOC +
- QString("Unknown inactive font: '%1' in image grid: '%2'")
- .arg(inactiveFont).arg(name));
- return;
- }
-
- UIImageGridType *grid = new UIImageGridType(name, order.toInt());
- grid->SetScreen(wmult, hmult);
- grid->setActiveFont(activeProp);
- grid->setSelectedFont(selectedProp);
- grid->setInactiveFont(inactiveProp);
- grid->setCutDown(cutdown);
- grid->setShowChecks(showChecks);
- grid->setShowSelected(showSelected);
- grid->setShowScrollArrows(showScrollArrows);
- grid->setArea(area);
- grid->setTextHeight(textheight);
- grid->setPadding(padding);
- grid->setRowCount(rowcount);
- grid->setColumnCount(columncount);
- grid->setDefaultImage(defaultImage);
- grid->setNormalImage(normalImage);
- grid->setSelectedImage(selectedImage);
- grid->setHighlightedImage(highlightedImage);
-
- int jst = Qt::AlignLeft | Qt::AlignTop;
- if (multiline == true)
- jst = Qt::TextWordWrap;
-
- if (align.size())
- {
- if (align.toLower() == "center")
- grid->setJustification(Qt::AlignCenter | jst);
- else if (align.toLower() == "right")
- grid->setJustification(Qt::AlignRight | jst);
- else if (align.toLower() == "allcenter")
- grid->setJustification(Qt::AlignHCenter | Qt::AlignVCenter | jst);
- else if (align.toLower() == "vcenter")
- grid->setJustification(Qt::AlignVCenter | jst);
- else if (align.toLower() == "hcenter")
- grid->setJustification(Qt::AlignHCenter | jst);
- }
- else
- grid->setJustification(jst);
-
- if (textposition == "top")
- grid->setTextPosition(UIImageGridType::textPosTop);
- else
- grid->setTextPosition(UIImageGridType::textPosBottom);
-
- if (context != -1)
- {
- grid->SetContext(context);
- }
- container->AddType(grid);
- grid->calculateScreenArea();
- grid->recalculateLayout();
-}
-
fontProp *XMLParse::GetFont(const QString &text, bool checkGlobal)
{
fontProp *ret;
@@ -1029,10 +784,6 @@ void XMLParse::parseContainer(QDomElement &element, QString &newname, int &conte
{
parseKeyboard(container, info);
}
- else if (info.tagName() == "imagegrid")
- {
- parseImageGrid(container, info);
- }
else
{
LOG(VB_GENERAL, LOG_ERR, LOC +
@@ -1478,7 +1229,7 @@ void XMLParse::parseListArea(LayerSet *container, QDomElement &element)
imgfile = info.attribute("filename", "");
if (imgfile.isNull() || imgfile.isEmpty())
{
- LOG(VB_GENERAL, LOG_WARNING, LOC +
+ LOG(VB_GENERAL, LOG_WARNING, LOC +
"Image needs a filename");
return;
}
View
1  mythtv/libs/libmyth/xmlparse.h
@@ -30,7 +30,6 @@ class MPUBLIC XMLParse
void parseContainer(QDomElement &, QString &, int &, QRect &);
void parseListArea(LayerSet *, QDomElement &);
bool parseDefaultCategoryColors(QMap<QString, QString> &catColors);
- void parseImageGrid(LayerSet *, QDomElement &);
void parseManagedTreeList(LayerSet *, QDomElement &);
void parseTextArea(LayerSet *, QDomElement &);
void parseRemoteEdit(LayerSet *, QDomElement &);
Please sign in to comment.
Something went wrong with that request. Please try again.