| 1 | Index: libs/libmythui/myththemedmenu.cpp |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- libs/libmythui/myththemedmenu.cpp (revision 14491) |
|---|
| 4 | +++ libs/libmythui/myththemedmenu.cpp (working copy) |
|---|
| 5 | @@ -103,6 +103,10 @@ |
|---|
| 6 | void parseButtonDefinition(const QString &dir, QDomElement &element); |
|---|
| 7 | void parseButton(const QString &dir, QDomElement &element); |
|---|
| 8 | |
|---|
| 9 | +//added by Anthony D'Alberto to support back button |
|---|
| 10 | + void parseBackButton(const QString &dir, QDomElement &element); |
|---|
| 11 | +//end of added section |
|---|
| 12 | + |
|---|
| 13 | void parseText(TextAttributes &attributes, QDomElement &element); |
|---|
| 14 | void parseOutline(TextAttributes &attributes, QDomElement &element); |
|---|
| 15 | void parseShadow(TextAttributes &attributes, QDomElement &element); |
|---|
| 16 | @@ -146,6 +150,11 @@ |
|---|
| 17 | MythImage *downarrow; |
|---|
| 18 | QRect downarrowRect; |
|---|
| 19 | |
|---|
| 20 | +//added by Anthony D'Alberto to support back button |
|---|
| 21 | + MythImage *backbutton; |
|---|
| 22 | + QRect backbuttonRect; |
|---|
| 23 | +//end of added section |
|---|
| 24 | + |
|---|
| 25 | QPoint watermarkPos; |
|---|
| 26 | QRect watermarkRect; |
|---|
| 27 | |
|---|
| 28 | @@ -233,6 +242,11 @@ |
|---|
| 29 | MythUIStateType *watermark; |
|---|
| 30 | MythUIImage *uparrow; |
|---|
| 31 | MythUIImage *downarrow; |
|---|
| 32 | + |
|---|
| 33 | +//added by Anthony D'Alberto to support back button |
|---|
| 34 | + MythUIImage *backbutton; |
|---|
| 35 | +//end of added section |
|---|
| 36 | + |
|---|
| 37 | }; |
|---|
| 38 | |
|---|
| 39 | ///////////////////////////////////////////////////////////////////////////// |
|---|
| 40 | @@ -249,6 +263,10 @@ |
|---|
| 41 | downarrow = NULL; |
|---|
| 42 | buttonBackground = NULL; |
|---|
| 43 | |
|---|
| 44 | +//added by Anthony D'Alberto to support back button |
|---|
| 45 | + backbutton = NULL; |
|---|
| 46 | +//end of added section |
|---|
| 47 | + |
|---|
| 48 | loaded = false; |
|---|
| 49 | |
|---|
| 50 | callback = NULL; |
|---|
| 51 | @@ -275,6 +293,10 @@ |
|---|
| 52 | downarrow->DownRef(); |
|---|
| 53 | if (buttonBackground) |
|---|
| 54 | buttonBackground->DownRef(); |
|---|
| 55 | +//added by Anthony D'Alberto to support back button |
|---|
| 56 | + if (backbutton) |
|---|
| 57 | + backbutton->DownRef(); |
|---|
| 58 | +//end of added section |
|---|
| 59 | |
|---|
| 60 | logo = NULL; |
|---|
| 61 | buttonnormal = NULL; |
|---|
| 62 | @@ -282,6 +304,9 @@ |
|---|
| 63 | uparrow = NULL; |
|---|
| 64 | downarrow = NULL; |
|---|
| 65 | buttonBackground = NULL; |
|---|
| 66 | +//added by Anthony D'Alberto to support back button |
|---|
| 67 | + backbutton = NULL; |
|---|
| 68 | +//end of added section |
|---|
| 69 | |
|---|
| 70 | QMap<QString, ButtonIcon>::Iterator it; |
|---|
| 71 | for (it = allButtonIcons.begin(); it != allButtonIcons.end(); ++it) |
|---|
| 72 | @@ -958,11 +983,77 @@ |
|---|
| 73 | } |
|---|
| 74 | else |
|---|
| 75 | { |
|---|
| 76 | - downarrow = MythImage::FromQImage(&pix); |
|---|
| 77 | - downarrowRect = arrowrect; |
|---|
| 78 | + downarrow = MythImage::FromQImage(&pix); |
|---|
| 79 | + downarrowRect = arrowrect; |
|---|
| 80 | } |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | +//added by Anthony D'Alberto to support back button |
|---|
| 84 | +void MythThemedMenuState::parseBackButton(const QString &dir, QDomElement &element) |
|---|
| 85 | +{ |
|---|
| 86 | + QRect backrect; |
|---|
| 87 | + QPoint backpos; |
|---|
| 88 | + QImage *pix = NULL; |
|---|
| 89 | + |
|---|
| 90 | + bool hasimage = false; |
|---|
| 91 | + bool hasposition = false; |
|---|
| 92 | + |
|---|
| 93 | + for (QDomNode child = element.firstChild(); !child.isNull(); |
|---|
| 94 | + child = child.nextSibling()) |
|---|
| 95 | + { |
|---|
| 96 | + QDomElement info = child.toElement(); |
|---|
| 97 | + if (!info.isNull()) |
|---|
| 98 | + { |
|---|
| 99 | + if (info.tagName() == "image") |
|---|
| 100 | + { |
|---|
| 101 | + QString backpath = dir + getFirstText(info); |
|---|
| 102 | + pix = gContext->LoadScaleImage(backpath); |
|---|
| 103 | + if (pix) |
|---|
| 104 | + hasimage = true; |
|---|
| 105 | + } |
|---|
| 106 | + else if (info.tagName() == "position") |
|---|
| 107 | + { |
|---|
| 108 | + backpos = parsePoint(info); |
|---|
| 109 | + hasposition = true; |
|---|
| 110 | + } |
|---|
| 111 | + else |
|---|
| 112 | + { |
|---|
| 113 | + VERBOSE(VB_GENERAL, QString("MythThemedMenuPrivate: Unknown tag %1 " |
|---|
| 114 | + "in back button").arg(info.tagName())); |
|---|
| 115 | + return; |
|---|
| 116 | + } |
|---|
| 117 | + } |
|---|
| 118 | + } |
|---|
| 119 | + |
|---|
| 120 | + if (!hasimage) |
|---|
| 121 | + { |
|---|
| 122 | + VERBOSE(VB_IMPORTANT, "MythThemedMenuPrivate: Missing image tag in back button"); |
|---|
| 123 | + return; |
|---|
| 124 | + } |
|---|
| 125 | + |
|---|
| 126 | + if (!hasposition) |
|---|
| 127 | + { |
|---|
| 128 | + VERBOSE(VB_IMPORTANT, "MythThemedMenuPrivate: Missing position tag in back button"); |
|---|
| 129 | + return; |
|---|
| 130 | + } |
|---|
| 131 | + |
|---|
| 132 | + backrect = QRect(backpos.x(), backpos.y(), pix->width(), |
|---|
| 133 | + pix->height()); |
|---|
| 134 | + |
|---|
| 135 | + backbutton = MythImage::FromQImage(&pix); |
|---|
| 136 | + backbuttonRect = backrect; |
|---|
| 137 | +} |
|---|
| 138 | +//end of added section |
|---|
| 139 | + |
|---|
| 140 | + |
|---|
| 141 | + |
|---|
| 142 | + |
|---|
| 143 | + |
|---|
| 144 | + |
|---|
| 145 | + |
|---|
| 146 | + |
|---|
| 147 | + |
|---|
| 148 | + |
|---|
| 149 | void MythThemedMenuState::parseButton(const QString &dir, QDomElement &element) |
|---|
| 150 | { |
|---|
| 151 | bool hasname = false; |
|---|
| 152 | @@ -1108,6 +1199,10 @@ |
|---|
| 153 | titleText = ""; |
|---|
| 154 | uparrow = NULL; |
|---|
| 155 | downarrow = NULL; |
|---|
| 156 | +//added by Anthony D'Albeto to support back button |
|---|
| 157 | + backbutton = NULL; |
|---|
| 158 | +//end of added section |
|---|
| 159 | + |
|---|
| 160 | watermarkPos = QPoint(0, 0); |
|---|
| 161 | watermarkRect = QRect(0, 0, 0, 0); |
|---|
| 162 | } |
|---|
| 163 | @@ -1183,6 +1278,12 @@ |
|---|
| 164 | { |
|---|
| 165 | parseArrow(dir, e, false); |
|---|
| 166 | } |
|---|
| 167 | +//added by Anthony D'Alberto to support back button |
|---|
| 168 | + else if (e.tagName() == "backbutton") |
|---|
| 169 | + { |
|---|
| 170 | + parseBackButton(dir, e); |
|---|
| 171 | + } |
|---|
| 172 | +//end of added section |
|---|
| 173 | else if (e.tagName() == "font") |
|---|
| 174 | { |
|---|
| 175 | if (parseFonts) |
|---|
| 176 | @@ -1513,6 +1614,17 @@ |
|---|
| 177 | downarrow->SetVisible(false); |
|---|
| 178 | downarrow->SetCanTakeFocus(true); |
|---|
| 179 | |
|---|
| 180 | +//added by Anthony D'Alberto to support back button |
|---|
| 181 | + backbutton = new MythUIImage(parent, "menu back button"); |
|---|
| 182 | + if (m_state->backbutton) |
|---|
| 183 | + { |
|---|
| 184 | + backbutton->SetArea(m_state->backbuttonRect); |
|---|
| 185 | + backbutton->SetImage(m_state->backbutton); |
|---|
| 186 | + } |
|---|
| 187 | + backbutton->SetVisible(true); |
|---|
| 188 | + backbutton->SetCanTakeFocus(true); |
|---|
| 189 | +//end of added section |
|---|
| 190 | + |
|---|
| 191 | checkScrollArrows(); |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | @@ -2035,6 +2147,14 @@ |
|---|
| 195 | QStringList action = "PAGEDOWN"; |
|---|
| 196 | keyHandler(action, false); |
|---|
| 197 | } |
|---|
| 198 | +//added by Anthony D'Alberto to support back button |
|---|
| 199 | + else if (origtype == backbutton) |
|---|
| 200 | + { |
|---|
| 201 | + QStringList action = "ESCAPE"; |
|---|
| 202 | + keyHandler(action, true); |
|---|
| 203 | + return(true); |
|---|
| 204 | + } |
|---|
| 205 | +//end of added section |
|---|
| 206 | else |
|---|
| 207 | { |
|---|
| 208 | if (ThemedButton *button = reinterpret_cast<ThemedButton*>(origtype)) |
|---|
| 209 | Index: libs/libmyth/uilistbtntype.h |
|---|
| 210 | =================================================================== |
|---|
| 211 | --- libs/libmyth/uilistbtntype.h (revision 14491) |
|---|
| 212 | +++ libs/libmyth/uilistbtntype.h (working copy) |
|---|
| 213 | @@ -27,6 +27,10 @@ |
|---|
| 214 | class UIListBtnType; |
|---|
| 215 | class UIListBtnTypeItem; |
|---|
| 216 | |
|---|
| 217 | +//added by Anthony D'Alberto to support the mouse press |
|---|
| 218 | +enum MouseMove{ListMoveLeft=1, ListMoveRight=2, ClickCheck=4, ListMoveUp=8, ListMoveDown=16, ListPageUp=32, ListPageDown=64}; |
|---|
| 219 | +//end of added section |
|---|
| 220 | + |
|---|
| 221 | class MPUBLIC UIListGenericTree : public GenericTree |
|---|
| 222 | { |
|---|
| 223 | public: |
|---|
| 224 | @@ -120,10 +124,18 @@ |
|---|
| 225 | void itemSelected(UIListTreeType *parent, UIListGenericTree *item); |
|---|
| 226 | void itemEntered(UIListTreeType *parent, UIListGenericTree *item); |
|---|
| 227 | |
|---|
| 228 | +//Added by Anthony D'Alberto to support mouse presses |
|---|
| 229 | +void itemClicked(int iMsg); |
|---|
| 230 | +//end of added section |
|---|
| 231 | + |
|---|
| 232 | public slots: |
|---|
| 233 | bool takeFocus(); |
|---|
| 234 | void looseFocus(); |
|---|
| 235 | - |
|---|
| 236 | + |
|---|
| 237 | +//Added by Anthony D'Alberto to support mouse press |
|---|
| 238 | + int mousePressHandler(QMouseEvent *e); |
|---|
| 239 | +//end of added section |
|---|
| 240 | + |
|---|
| 241 | private: |
|---|
| 242 | void FillLevelFromTree(UIListGenericTree *item, UIListBtnType *list); |
|---|
| 243 | void ClearLevel(UIListBtnType *list); |
|---|
| 244 | @@ -220,6 +232,10 @@ |
|---|
| 245 | bool takeFocus(); |
|---|
| 246 | void looseFocus(); |
|---|
| 247 | |
|---|
| 248 | +//added by Anthony D'Alberto to support mouse press |
|---|
| 249 | + int mousePressHandler(QMouseEvent *e); |
|---|
| 250 | +//end if added section |
|---|
| 251 | + |
|---|
| 252 | private: |
|---|
| 253 | void Init(); |
|---|
| 254 | void LoadPixmap(QPixmap& pix, const QString& fileName); |
|---|
| 255 | @@ -292,6 +308,10 @@ |
|---|
| 256 | signals: |
|---|
| 257 | |
|---|
| 258 | void itemSelected(UIListBtnTypeItem* item); |
|---|
| 259 | +//Added by Anthony D'Alberto to support the mouse press |
|---|
| 260 | + void itemClicked(UIListBtnTypeItem *item); |
|---|
| 261 | +//end of added section |
|---|
| 262 | + |
|---|
| 263 | }; |
|---|
| 264 | |
|---|
| 265 | class MPUBLIC UIListBtnTypeItem |
|---|
| 266 | @@ -337,7 +357,11 @@ |
|---|
| 267 | bool moveUpDown(bool flag); |
|---|
| 268 | |
|---|
| 269 | void paint(QPainter *p, fontProp *font, int x, int y, bool active_on); |
|---|
| 270 | - |
|---|
| 271 | + |
|---|
| 272 | +//added by Anthony D'Alberto to support mouse presses |
|---|
| 273 | + int MouseClicked(int x, int y); |
|---|
| 274 | +//end of added section |
|---|
| 275 | + |
|---|
| 276 | protected: |
|---|
| 277 | void CalcDimensions(void); |
|---|
| 278 | |
|---|
| 279 | Index: libs/libmyth/mythdialogs.cpp |
|---|
| 280 | =================================================================== |
|---|
| 281 | --- libs/libmyth/mythdialogs.cpp (revision 14491) |
|---|
| 282 | +++ libs/libmyth/mythdialogs.cpp (working copy) |
|---|
| 283 | @@ -215,6 +215,7 @@ |
|---|
| 284 | } |
|---|
| 285 | } |
|---|
| 286 | |
|---|
| 287 | + |
|---|
| 288 | MythPopupBox::MythPopupBox(MythMainWindow *parent, const char *name) |
|---|
| 289 | : MythDialog(parent, name, false) |
|---|
| 290 | { |
|---|
| 291 | @@ -560,6 +561,7 @@ |
|---|
| 292 | popup.addLabel(message, Medium, true); |
|---|
| 293 | |
|---|
| 294 | MythRemoteLineEdit* textEdit = new MythRemoteLineEdit(&popup, "chooseEdit"); |
|---|
| 295 | + |
|---|
| 296 | textEdit->setText(text); |
|---|
| 297 | popup.addWidget(textEdit); |
|---|
| 298 | |
|---|
| 299 | @@ -1091,7 +1093,7 @@ |
|---|
| 300 | // |
|---|
| 301 | // Debugging |
|---|
| 302 | // |
|---|
| 303 | - /* |
|---|
| 304 | +/* |
|---|
| 305 | cout << "A container called \"" << looper->GetName() |
|---|
| 306 | << "\" said its area is " |
|---|
| 307 | << container_area.left() |
|---|
| 308 | @@ -1102,7 +1104,7 @@ |
|---|
| 309 | << "," |
|---|
| 310 | << container_area.top() + container_area.height() |
|---|
| 311 | << endl; |
|---|
| 312 | - */ |
|---|
| 313 | +*/ |
|---|
| 314 | |
|---|
| 315 | QPixmap container_picture(container_area.size()); |
|---|
| 316 | QPainter offscreen_painter(&container_picture); |
|---|
| 317 | @@ -1115,7 +1117,7 @@ |
|---|
| 318 | |
|---|
| 319 | for (int i = 0; i <= looper->getLayers(); i++) |
|---|
| 320 | { |
|---|
| 321 | - looper->Draw(&offscreen_painter, i, context); |
|---|
| 322 | + looper->Draw(&offscreen_painter, i, context); |
|---|
| 323 | } |
|---|
| 324 | |
|---|
| 325 | // |
|---|
| 326 | @@ -1355,6 +1357,132 @@ |
|---|
| 327 | widget_with_current_focus->takeFocus(); |
|---|
| 328 | } |
|---|
| 329 | |
|---|
| 330 | +//added by Anthony D'Alberto to support back button...and mouse presses |
|---|
| 331 | +void MythThemedDialog::mouseReleaseEvent(QMouseEvent *e) |
|---|
| 332 | +{ |
|---|
| 333 | + if(e->button() == QMouseEvent::RightButton) |
|---|
| 334 | + { |
|---|
| 335 | + e->accept(); |
|---|
| 336 | + reject(); |
|---|
| 337 | + return; |
|---|
| 338 | + } |
|---|
| 339 | + else if(e->button() == QMouseEvent::LeftButton) |
|---|
| 340 | + { |
|---|
| 341 | + int x=e->x(); |
|---|
| 342 | + int y=e->y(); |
|---|
| 343 | + //qDebug("MythThemedDialog::mouseReleaseEvent %d %d", x, y); |
|---|
| 344 | + |
|---|
| 345 | + UIType *type = widget_with_current_focus; |
|---|
| 346 | + |
|---|
| 347 | + if(type) |
|---|
| 348 | + { |
|---|
| 349 | + QRect rc = type->getScreenArea(); |
|---|
| 350 | + if(rc.contains(x,y)) |
|---|
| 351 | + { |
|---|
| 352 | + qDebug("Release target %p %s %d %d \n", |
|---|
| 353 | + type, |
|---|
| 354 | + type->getName().local8Bit().data(), |
|---|
| 355 | + rc.x(), |
|---|
| 356 | + rc.y()); |
|---|
| 357 | + |
|---|
| 358 | + type->mousePressHandler(e); |
|---|
| 359 | + e->accept(); |
|---|
| 360 | + return; |
|---|
| 361 | + } |
|---|
| 362 | + }else |
|---|
| 363 | + { |
|---|
| 364 | + printf("Widget not defined\n"); |
|---|
| 365 | + //qDebug("Widget not defined"); |
|---|
| 366 | + } |
|---|
| 367 | + } |
|---|
| 368 | + MythDialog::mouseReleaseEvent(e); |
|---|
| 369 | +} |
|---|
| 370 | + |
|---|
| 371 | + |
|---|
| 372 | +void MythThemedDialog::mousePressEvent(QMouseEvent *e) |
|---|
| 373 | +{ |
|---|
| 374 | + //if a non left button was sent, ignore it |
|---|
| 375 | + if(e->button() != QMouseEvent::LeftButton) |
|---|
| 376 | + { |
|---|
| 377 | + //MythDialog::mouseReleaseEvent(e); |
|---|
| 378 | + return; |
|---|
| 379 | + } |
|---|
| 380 | + |
|---|
| 381 | + //get the x and y position |
|---|
| 382 | + int x=e->x(); |
|---|
| 383 | + int y=e->y(); |
|---|
| 384 | + |
|---|
| 385 | + //now increment through the layers... |
|---|
| 386 | + |
|---|
| 387 | + //loop through all the containers |
|---|
| 388 | + //containers at the end are drawn on top, so I should start |
|---|
| 389 | + //with the end and decrement instead of increment. |
|---|
| 390 | + QPtrListIterator<LayerSet> an_it(my_containers); |
|---|
| 391 | + LayerSet *looper; |
|---|
| 392 | + |
|---|
| 393 | + for(looper = an_it.toLast();(looper = an_it.current()) != 0; --an_it) |
|---|
| 394 | + { |
|---|
| 395 | + QRect container_area = looper->GetAreaRect(); |
|---|
| 396 | + |
|---|
| 397 | + //printf("Container %s\n", looper->GetName().ascii()); |
|---|
| 398 | + |
|---|
| 399 | + if(container_area.isValid() && |
|---|
| 400 | + container_area.contains(x,y) && |
|---|
| 401 | + looper->GetName().lower() != "background") |
|---|
| 402 | + { |
|---|
| 403 | + //loop over UI types within each container |
|---|
| 404 | + vector<UIType *> *all_ui_type_objects = looper->getAllTypes(); |
|---|
| 405 | + vector<UIType *>::iterator i=all_ui_type_objects->begin(); |
|---|
| 406 | + |
|---|
| 407 | + for(; i!=all_ui_type_objects->end();i++) |
|---|
| 408 | + { |
|---|
| 409 | + |
|---|
| 410 | + UIType *type = (*i); |
|---|
| 411 | + QRect rc = type->getScreenArea(); |
|---|
| 412 | + |
|---|
| 413 | + //if the UI element is under the mouse |
|---|
| 414 | + if(rc.contains(x,y)) |
|---|
| 415 | + { |
|---|
| 416 | + /* |
|---|
| 417 | + printf("target %p %s %d %d\n", |
|---|
| 418 | + type, |
|---|
| 419 | + type->getName().local8Bit().data(), |
|---|
| 420 | + rc.x(), |
|---|
| 421 | + rc.y()); |
|---|
| 422 | + */ |
|---|
| 423 | + |
|---|
| 424 | + if(type->canTakeFocus()) |
|---|
| 425 | + { |
|---|
| 426 | + if(widget_with_current_focus) |
|---|
| 427 | + { |
|---|
| 428 | + widget_with_current_focus->looseFocus(); |
|---|
| 429 | + } |
|---|
| 430 | + widget_with_current_focus=type; |
|---|
| 431 | + widget_with_current_focus->takeFocus(); |
|---|
| 432 | + |
|---|
| 433 | + e->accept(); |
|---|
| 434 | + return; |
|---|
| 435 | + } |
|---|
| 436 | + else |
|---|
| 437 | + { |
|---|
| 438 | + //if the item cannot take focus, we should |
|---|
| 439 | + //not have a mouse press event |
|---|
| 440 | + //qDebug("Cannot Take Focus"); |
|---|
| 441 | + cout << "Cannot take focus" << endl; |
|---|
| 442 | + } |
|---|
| 443 | + |
|---|
| 444 | + //e->accept(); |
|---|
| 445 | + //return; |
|---|
| 446 | + } |
|---|
| 447 | + } |
|---|
| 448 | + } |
|---|
| 449 | + } |
|---|
| 450 | + |
|---|
| 451 | + MythDialog::mousePressEvent(e); |
|---|
| 452 | +} |
|---|
| 453 | + |
|---|
| 454 | +//end of added section |
|---|
| 455 | + |
|---|
| 456 | UIManagedTreeListType* MythThemedDialog::getUIManagedTreeListType(const QString &name) |
|---|
| 457 | { |
|---|
| 458 | QPtrListIterator<LayerSet> an_it(my_containers); |
|---|
| 459 | @@ -1785,7 +1913,7 @@ |
|---|
| 460 | QStringList actions; |
|---|
| 461 | if (gContext->GetMainWindow()->TranslateKeyPress("qt", e, actions)) |
|---|
| 462 | { |
|---|
| 463 | - for (unsigned int i = 0; i < actions.size() && !handled; i++) |
|---|
| 464 | + for (unsigned int i = 0; i < actions.size() && !handled; i++) |
|---|
| 465 | { |
|---|
| 466 | QString action = actions[i]; |
|---|
| 467 | if (action == "ESCAPE") |
|---|
| 468 | Index: libs/libmyth/mythwidgets.cpp |
|---|
| 469 | =================================================================== |
|---|
| 470 | --- libs/libmyth/mythwidgets.cpp (revision 14491) |
|---|
| 471 | +++ libs/libmyth/mythwidgets.cpp (working copy) |
|---|
| 472 | @@ -530,6 +530,10 @@ |
|---|
| 473 | |
|---|
| 474 | connect(cycle_timer, SIGNAL(timeout()), this, SLOT(endCycle())); |
|---|
| 475 | |
|---|
| 476 | +//Added by Anthony D'Alberto to support mouse press |
|---|
| 477 | + connect(this, SIGNAL(clicked(int, int)), this, SLOT(LineClicked(int, int))); |
|---|
| 478 | +//end of added section |
|---|
| 479 | + |
|---|
| 480 | popup = NULL; |
|---|
| 481 | popupPosition = VK_POSBELOWEDIT; |
|---|
| 482 | } |
|---|
| 483 | @@ -736,7 +740,7 @@ |
|---|
| 484 | { |
|---|
| 485 | bool handled = false; |
|---|
| 486 | QStringList actions; |
|---|
| 487 | - |
|---|
| 488 | + |
|---|
| 489 | if ((!popup || !popup->isShown()) && |
|---|
| 490 | gContext->GetMainWindow()->TranslateKeyPress("qt", e, actions, false)) |
|---|
| 491 | { |
|---|
| 492 | @@ -769,6 +773,7 @@ |
|---|
| 493 | { |
|---|
| 494 | if (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1) |
|---|
| 495 | { |
|---|
| 496 | + printf("UseVirtualKeyboard\n"); |
|---|
| 497 | popup = new VirtualKeyboard(gContext->GetMainWindow(), this); |
|---|
| 498 | gContext->GetMainWindow()->detach(popup); |
|---|
| 499 | popup->exec(); |
|---|
| 500 | @@ -1003,6 +1008,20 @@ |
|---|
| 501 | emit textChanged(this->text()); |
|---|
| 502 | } |
|---|
| 503 | |
|---|
| 504 | +//Added by Anthony D'Alberto to support mouse press |
|---|
| 505 | +void MythRemoteLineEdit::LineClicked(int para, int pos) |
|---|
| 506 | +{ |
|---|
| 507 | + //now I need to show the keyboard... |
|---|
| 508 | + popup = new VirtualKeyboard(gContext->GetMainWindow(), this); |
|---|
| 509 | + gContext->GetMainWindow()->detach(popup); |
|---|
| 510 | + popup->exec(); |
|---|
| 511 | + delete popup; |
|---|
| 512 | + popup = NULL; |
|---|
| 513 | + |
|---|
| 514 | + |
|---|
| 515 | +} |
|---|
| 516 | +//end of added section |
|---|
| 517 | + |
|---|
| 518 | void MythTable::keyPressEvent(QKeyEvent *e) |
|---|
| 519 | { |
|---|
| 520 | if (isEditing() && item(currEditRow(), currEditCol()) && |
|---|
| 521 | Index: libs/libmyth/uilistbtntype.cpp |
|---|
| 522 | =================================================================== |
|---|
| 523 | --- libs/libmyth/uilistbtntype.cpp (revision 14491) |
|---|
| 524 | +++ libs/libmyth/uilistbtntype.cpp (working copy) |
|---|
| 525 | @@ -853,6 +853,85 @@ |
|---|
| 526 | UIType::looseFocus(); |
|---|
| 527 | } |
|---|
| 528 | |
|---|
| 529 | +//added by Anthony D'Alberto to support mouse press |
|---|
| 530 | +int UIListTreeType::mousePressHandler(QMouseEvent *e) |
|---|
| 531 | +{ |
|---|
| 532 | + int iReturnValue = -1; |
|---|
| 533 | + QRect rect; |
|---|
| 534 | + QRect arearect; |
|---|
| 535 | + |
|---|
| 536 | + if(currentlevel != NULL) |
|---|
| 537 | + { |
|---|
| 538 | + //get screen area where widget resides |
|---|
| 539 | + arearect = currentlevel->getScreenArea(); |
|---|
| 540 | + printf("Screen Area x: %i, y: %i\n", arearect.x(), arearect.y()); |
|---|
| 541 | + |
|---|
| 542 | + arearect = currentlevel->GetArea(); |
|---|
| 543 | + printf("Area x: %i, y: %i\n", arearect.x(), arearect.y()); |
|---|
| 544 | + |
|---|
| 545 | + int iDrawOffset = currentlevel->GetDrawOffset(); |
|---|
| 546 | + |
|---|
| 547 | + //now create a new rectangle, adjusting for the offset |
|---|
| 548 | + rect.setRect(arearect.x() + iDrawOffset + screen_area.x(), |
|---|
| 549 | + arearect.y() + screen_area.y(), |
|---|
| 550 | + arearect.width(), |
|---|
| 551 | + arearect.height() ); |
|---|
| 552 | + |
|---|
| 553 | + if(rect.contains(e->x(), e->y())) |
|---|
| 554 | + { |
|---|
| 555 | + //define a new point with the screen offset taken out |
|---|
| 556 | + //to get relative position in widget |
|---|
| 557 | + QPoint pt(e->x() - rect.x(), e->y() - rect.y()); |
|---|
| 558 | + |
|---|
| 559 | + //now define a new event with our new point |
|---|
| 560 | + QMouseEvent NewEvent(QEvent::MouseButtonPress, |
|---|
| 561 | + pt, |
|---|
| 562 | + e->button(), |
|---|
| 563 | + e->state()); |
|---|
| 564 | + iReturnValue = currentlevel->mousePressHandler(&NewEvent); |
|---|
| 565 | + SetCurrentPosition(); |
|---|
| 566 | + RedrawCurrent(); |
|---|
| 567 | + |
|---|
| 568 | + if((iReturnValue & ListMoveRight) == ListMoveRight) |
|---|
| 569 | + { |
|---|
| 570 | + MoveRight(true); |
|---|
| 571 | + } |
|---|
| 572 | + |
|---|
| 573 | + if((iReturnValue & ListPageDown) == ListPageDown) |
|---|
| 574 | + { |
|---|
| 575 | + MoveDown(MovePage); |
|---|
| 576 | + } |
|---|
| 577 | + |
|---|
| 578 | + if((iReturnValue & ListPageUp) == ListPageUp) |
|---|
| 579 | + { |
|---|
| 580 | + MoveUp(MovePage); |
|---|
| 581 | + } |
|---|
| 582 | + |
|---|
| 583 | + emit itemClicked(iReturnValue); |
|---|
| 584 | + } |
|---|
| 585 | + else |
|---|
| 586 | + { |
|---|
| 587 | + //if the Y position is good, and we are just not |
|---|
| 588 | + //in on the X, we are probably going back a menu |
|---|
| 589 | + if(e->y() >= rect.y() && e->y() <= rect.y() + rect.height()) |
|---|
| 590 | + { |
|---|
| 591 | + MoveLeft(true); |
|---|
| 592 | + }else |
|---|
| 593 | + { |
|---|
| 594 | + //indicate we did not handle this case |
|---|
| 595 | + iReturnValue = -1; |
|---|
| 596 | + } |
|---|
| 597 | + } |
|---|
| 598 | + } |
|---|
| 599 | + else |
|---|
| 600 | + { |
|---|
| 601 | + iReturnValue = -2; |
|---|
| 602 | + } |
|---|
| 603 | + |
|---|
| 604 | + return(iReturnValue); |
|---|
| 605 | +} |
|---|
| 606 | +//end of added section |
|---|
| 607 | + |
|---|
| 608 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 609 | |
|---|
| 610 | UIListBtnType::UIListBtnType(const QString& name, const QRect& area, |
|---|
| 611 | @@ -1920,6 +1999,89 @@ |
|---|
| 612 | UIType::looseFocus(); |
|---|
| 613 | } |
|---|
| 614 | |
|---|
| 615 | +//added by Anthony D'Alberto to support mouse press |
|---|
| 616 | +int UIListBtnType::mousePressHandler(QMouseEvent *e) |
|---|
| 617 | +{ |
|---|
| 618 | + int mousepos; |
|---|
| 619 | + int iReturnValue = -1; |
|---|
| 620 | + |
|---|
| 621 | + QPoint pt(e->x() - screen_area.x(),e->y() - screen_area.y()); |
|---|
| 622 | + QMouseEvent NewEvent(QEvent::MouseButtonPress, |
|---|
| 623 | + pt, |
|---|
| 624 | + e->button(), |
|---|
| 625 | + e->state()); |
|---|
| 626 | + |
|---|
| 627 | + if(m_arrowsRect.contains(NewEvent.x(), NewEvent.y())) |
|---|
| 628 | + { |
|---|
| 629 | + iReturnValue = 0; |
|---|
| 630 | + if( ((NewEvent.x() - m_arrowsRect.x()) <= m_upArrowRegPix.width()) && |
|---|
| 631 | + m_showUpArrow == true) |
|---|
| 632 | + { |
|---|
| 633 | + MoveUp(MovePage); |
|---|
| 634 | + //iReturnValue = ListPageUp; |
|---|
| 635 | + iReturnValue = 0; |
|---|
| 636 | + } |
|---|
| 637 | + else if( (NewEvent.x()-m_arrowsRect.x() >= m_upArrowRegPix.width() + |
|---|
| 638 | + m_itemMargin) && |
|---|
| 639 | + m_showDnArrow == true) |
|---|
| 640 | + { |
|---|
| 641 | + MoveDown(MovePage); |
|---|
| 642 | + //iReturnValue = ListPageDown; |
|---|
| 643 | + iReturnValue = 0; |
|---|
| 644 | + } |
|---|
| 645 | + } |
|---|
| 646 | + else |
|---|
| 647 | + { |
|---|
| 648 | + //the x and y positions were already adjusted by previous |
|---|
| 649 | + //ListType |
|---|
| 650 | + //now attempt to calculate which item the mouse is over |
|---|
| 651 | + |
|---|
| 652 | + mousepos = (NewEvent.y() / (m_itemHeight + m_itemSpacing)) + |
|---|
| 653 | + m_topPosition; |
|---|
| 654 | + |
|---|
| 655 | + //if I am within the number of items |
|---|
| 656 | + if(mousepos < m_itemCount) |
|---|
| 657 | + { |
|---|
| 658 | + //if the mouse pos is greater then the current selection |
|---|
| 659 | + if(mousepos > m_selPosition) |
|---|
| 660 | + { |
|---|
| 661 | + //increment to the pressed position |
|---|
| 662 | + for(int i=0;i<mousepos - m_selPosition;i++) |
|---|
| 663 | + ++(*m_selIterator); |
|---|
| 664 | + } |
|---|
| 665 | + else if(mousepos < m_selPosition) //mouse pos is less than current |
|---|
| 666 | + { |
|---|
| 667 | + //decrement to the pressed position |
|---|
| 668 | + for(int i=0;i<m_selPosition - mousepos;i++) |
|---|
| 669 | + --(*m_selIterator); |
|---|
| 670 | + } |
|---|
| 671 | + |
|---|
| 672 | + //I've moved the current position, make sure it is valide |
|---|
| 673 | + if(m_selIterator->current()) |
|---|
| 674 | + { //if it is valid, set it as m_selItem |
|---|
| 675 | + m_selItem = m_selIterator->current(); |
|---|
| 676 | + } |
|---|
| 677 | + |
|---|
| 678 | + m_selPosition = mousepos; |
|---|
| 679 | + } |
|---|
| 680 | + |
|---|
| 681 | + mousepos -= m_topPosition; |
|---|
| 682 | + //checks to see if we've clicked a part of the listbtntypeitem |
|---|
| 683 | + //if no check box or arrow has been pressed, it returns 0. |
|---|
| 684 | + //only do this if the mouse is in the list, so the return value works. |
|---|
| 685 | + iReturnValue = m_selItem->MouseClicked(NewEvent.x(), |
|---|
| 686 | + NewEvent.y() - (mousepos * (m_itemHeight+m_itemSpacing))); |
|---|
| 687 | + |
|---|
| 688 | + emit itemClicked(m_selItem); |
|---|
| 689 | + } |
|---|
| 690 | + |
|---|
| 691 | + |
|---|
| 692 | + refresh(); |
|---|
| 693 | + |
|---|
| 694 | + return(iReturnValue); |
|---|
| 695 | +} |
|---|
| 696 | +//end of added section |
|---|
| 697 | + |
|---|
| 698 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 699 | |
|---|
| 700 | UIListBtnTypeItem::UIListBtnTypeItem(UIListBtnType* lbtype, const QString& text, |
|---|
| 701 | @@ -2155,3 +2317,29 @@ |
|---|
| 702 | p->drawText(tr, Qt::AlignLeft|Qt::AlignVCenter, text); |
|---|
| 703 | } |
|---|
| 704 | |
|---|
| 705 | +//added by Anthony D'Alberto to support mouse press |
|---|
| 706 | +int UIListBtnTypeItem::MouseClicked(int x, int y) |
|---|
| 707 | +{ |
|---|
| 708 | + int iReturnValue = 0; |
|---|
| 709 | + QRect NewArrowRect(m_arrowRect.x() - 50, |
|---|
| 710 | + m_arrowRect.y() - 50, |
|---|
| 711 | + m_arrowRect.width() + 100, |
|---|
| 712 | + m_arrowRect.height() + 100); |
|---|
| 713 | + |
|---|
| 714 | + QRect NewCheckRect(m_checkRect.x() - 50, |
|---|
| 715 | + m_checkRect.y() - 50, |
|---|
| 716 | + m_checkRect.width() + 100, |
|---|
| 717 | + m_checkRect.height() + 100); |
|---|
| 718 | + |
|---|
| 719 | + if(NewArrowRect.contains(x,y)) |
|---|
| 720 | + iReturnValue |= ListMoveRight; |
|---|
| 721 | + |
|---|
| 722 | + if(NewCheckRect.contains(x,y)) |
|---|
| 723 | + iReturnValue |= ClickCheck; |
|---|
| 724 | + |
|---|
| 725 | + return(iReturnValue); |
|---|
| 726 | +} |
|---|
| 727 | + |
|---|
| 728 | +//end of added section |
|---|
| 729 | + |
|---|
| 730 | + |
|---|
| 731 | Index: libs/libmyth/uitypes.cpp |
|---|
| 732 | =================================================================== |
|---|
| 733 | --- libs/libmyth/uitypes.cpp (revision 14491) |
|---|
| 734 | +++ libs/libmyth/uitypes.cpp (working copy) |
|---|
| 735 | @@ -3362,6 +3362,15 @@ |
|---|
| 736 | rightArrowOffset.setX(0); |
|---|
| 737 | rightArrowOffset.setY(0); |
|---|
| 738 | incSearch = ""; |
|---|
| 739 | + |
|---|
| 740 | +//added by Anhtony D'Alberto to support mouse presses |
|---|
| 741 | + iMapUsed = -1; |
|---|
| 742 | + x_map_location = 0; |
|---|
| 743 | + y_map_location = 0; |
|---|
| 744 | + boHasChildren = false; |
|---|
| 745 | + boHasParent = false; |
|---|
| 746 | +//end of added section |
|---|
| 747 | + |
|---|
| 748 | } |
|---|
| 749 | |
|---|
| 750 | UIManagedTreeListType::~UIManagedTreeListType() |
|---|
| 751 | @@ -3438,6 +3447,11 @@ |
|---|
| 752 | return; |
|---|
| 753 | } |
|---|
| 754 | |
|---|
| 755 | +//added by Anthony D'Alberto to support mouse press |
|---|
| 756 | +//initialize this each time the screen is drawn |
|---|
| 757 | + boHasChildren = false; |
|---|
| 758 | + boHasParent = false; |
|---|
| 759 | +//end of added section |
|---|
| 760 | // |
|---|
| 761 | // Put something on the LCD device (if one exists) |
|---|
| 762 | // |
|---|
| 763 | @@ -3561,7 +3575,6 @@ |
|---|
| 764 | int x_location = bin_corners[i].left(); |
|---|
| 765 | int y_location = bin_corners[i].top() + (bin_corners[i].height() / 2) |
|---|
| 766 | + (QFontMetrics(tmpfont->face).height() / 2); |
|---|
| 767 | - |
|---|
| 768 | if (!show_whole_tree) |
|---|
| 769 | { |
|---|
| 770 | x_location = area.left(); |
|---|
| 771 | @@ -3662,17 +3675,37 @@ |
|---|
| 772 | p->drawPixmap(x_location + selectPoint.x(), y_location - QFontMetrics(tmpfont->face).height() + QFontMetrics(tmpfont->face).descent() + selectPoint.y(), (*highlight_map[i])); |
|---|
| 773 | //p->drawPixmap(x_location, y_location - QFontMetrics(tmpfont->face).height() + QFontMetrics(tmpfont->face).descent(), (*highlight_map[i])); |
|---|
| 774 | |
|---|
| 775 | +//added by Anthony D'Alberto to support mouse presses |
|---|
| 776 | + x_map_location = x_location + selectPoint.x() + screen_area.left(); |
|---|
| 777 | + |
|---|
| 778 | + y_map_location = y_location - QFontMetrics(tmpfont->face).height() + |
|---|
| 779 | + QFontMetrics(tmpfont->face).descent() + selectPoint.y() + |
|---|
| 780 | + screen_area.top(); |
|---|
| 781 | + |
|---|
| 782 | + iMapUsed = i; |
|---|
| 783 | + |
|---|
| 784 | +//end of added section |
|---|
| 785 | + |
|---|
| 786 | // |
|---|
| 787 | // Left or right arrows |
|---|
| 788 | // |
|---|
| 789 | if (i == bins && hotspot_node->childCount() > 0) |
|---|
| 790 | { |
|---|
| 791 | +//added by Anthony D'Alberto to support mouse press |
|---|
| 792 | +//see if there is a child node |
|---|
| 793 | + boHasChildren = true; |
|---|
| 794 | +//end of added section |
|---|
| 795 | + |
|---|
| 796 | p->drawPixmap(x_location + (*highlight_map[i]).width() - right_arrow_image.width() + rightArrowOffset.x(), |
|---|
| 797 | y_location + rightArrowOffset.y() - QFontMetrics(tmpfont->face).height() + right_arrow_image.height() / 2, |
|---|
| 798 | right_arrow_image); |
|---|
| 799 | } |
|---|
| 800 | if (i == 1 && hotspot_node->getParent()->getParent()) |
|---|
| 801 | { |
|---|
| 802 | +//added by Anthony D'Alberto to support mouse press |
|---|
| 803 | +//see if there is a parent node |
|---|
| 804 | + boHasParent = true; |
|---|
| 805 | +//end of added section |
|---|
| 806 | p->drawPixmap(x_location + leftArrowOffset.x(), |
|---|
| 807 | y_location + leftArrowOffset.y() - QFontMetrics(tmpfont->face).height() + left_arrow_image.height() / 2, |
|---|
| 808 | left_arrow_image); |
|---|
| 809 | @@ -3681,6 +3714,16 @@ |
|---|
| 810 | else |
|---|
| 811 | { |
|---|
| 812 | p->drawPixmap(x_location + selectPoint.x(), y_location - QFontMetrics(tmpfont->face).height() + QFontMetrics(tmpfont->face).descent() + selectPoint.y(), (*highlight_map[0])); |
|---|
| 813 | + |
|---|
| 814 | +//added by Anthony D'Alberto to support mouse presses |
|---|
| 815 | + x_map_location = x_location + selectPoint.x() + screen_area.left(); |
|---|
| 816 | + y_map_location = y_location - QFontMetrics(tmpfont->face).height() + |
|---|
| 817 | + QFontMetrics(tmpfont->face).descent() + selectPoint.y() + |
|---|
| 818 | + screen_area.top(); |
|---|
| 819 | + |
|---|
| 820 | + iMapUsed = 0; |
|---|
| 821 | +//end of added section |
|---|
| 822 | + |
|---|
| 823 | } |
|---|
| 824 | } |
|---|
| 825 | |
|---|
| 826 | @@ -4758,6 +4801,7 @@ |
|---|
| 827 | QRect r = (*it); |
|---|
| 828 | r.moveBy(m_parent->GetAreaRect().left(), |
|---|
| 829 | m_parent->GetAreaRect().top()); |
|---|
| 830 | + |
|---|
| 831 | ++i; |
|---|
| 832 | screen_corners[i] = r; |
|---|
| 833 | } |
|---|
| 834 | @@ -4765,6 +4809,141 @@ |
|---|
| 835 | screen_area = m_parent->GetAreaRect(); |
|---|
| 836 | } |
|---|
| 837 | |
|---|
| 838 | +//added by Anthony D'Alberto to support mouse presses |
|---|
| 839 | + |
|---|
| 840 | +int UIManagedTreeListType::mousePressHandler(QMouseEvent *e) |
|---|
| 841 | +{ |
|---|
| 842 | + int iReturnValue = -1; |
|---|
| 843 | + |
|---|
| 844 | + //printf("X: %i - Y: %i\n", e->x(), e->y()); |
|---|
| 845 | + |
|---|
| 846 | + //see if we are inside the control// |
|---|
| 847 | + if(screen_area.contains(e->x(), e->y())) |
|---|
| 848 | + { |
|---|
| 849 | + |
|---|
| 850 | + |
|---|
| 851 | + QRect BinRect(bin_corners[active_bin].left(), |
|---|
| 852 | + bin_corners[active_bin].top() + |
|---|
| 853 | + screen_corners[active_bin].top(), |
|---|
| 854 | + bin_corners[active_bin].right(), |
|---|
| 855 | + bin_corners[active_bin].bottom() - |
|---|
| 856 | + screen_corners[active_bin].top()); |
|---|
| 857 | + |
|---|
| 858 | + |
|---|
| 859 | + //if I'm inside the active bin |
|---|
| 860 | + if(BinRect.contains(e->x(), e->y())) |
|---|
| 861 | + { |
|---|
| 862 | + //if I'm in the active bin, I might want out |
|---|
| 863 | + //this is identified by going over the next bin's |
|---|
| 864 | + //left edge. Bins can overlap. Therefore... |
|---|
| 865 | + |
|---|
| 866 | + //check to see if there is another higher bin |
|---|
| 867 | + if( ((active_bin +1) <= bins) && |
|---|
| 868 | + (e->x() >= bin_corners[active_bin+1].left()) ) |
|---|
| 869 | + { |
|---|
| 870 | + pushDown(); |
|---|
| 871 | + } |
|---|
| 872 | + |
|---|
| 873 | + //get the height of the selection rectangle |
|---|
| 874 | + //to try to figure out how many items to move |
|---|
| 875 | + int iItemHeight = highlight_map[iMapUsed]->height(); |
|---|
| 876 | + |
|---|
| 877 | + int iItems; |
|---|
| 878 | + |
|---|
| 879 | + //create a temp rectangle the size of the selection map |
|---|
| 880 | + QRect tmpRect(x_map_location, |
|---|
| 881 | + y_map_location, |
|---|
| 882 | + highlight_map[iMapUsed]->width(), |
|---|
| 883 | + highlight_map[iMapUsed]->height()); |
|---|
| 884 | + |
|---|
| 885 | + //if I'm not in the rectangle |
|---|
| 886 | + if(!tmpRect.contains(e->x(), e->y())) |
|---|
| 887 | + { |
|---|
| 888 | + //if I'm above the rectangle |
|---|
| 889 | + if(e->y() < tmpRect.top()) |
|---|
| 890 | + { |
|---|
| 891 | + iItems = (tmpRect.top() - e->y()) / (iItemHeight) + 1; |
|---|
| 892 | + |
|---|
| 893 | + //now move the number of items |
|---|
| 894 | + for(int i=0;i<iItems;i++) |
|---|
| 895 | + { |
|---|
| 896 | + moveUp(false); |
|---|
| 897 | + } |
|---|
| 898 | + } |
|---|
| 899 | + |
|---|
| 900 | + //now check for being below the rectangle |
|---|
| 901 | + if(e->y() > tmpRect.bottom()) |
|---|
| 902 | + { |
|---|
| 903 | + iItems = (e->y() - tmpRect.bottom()) / (iItemHeight) + 1; |
|---|
| 904 | + |
|---|
| 905 | + //now move the number of items |
|---|
| 906 | + for(int i=0;i<iItems;i++) |
|---|
| 907 | + { |
|---|
| 908 | + moveDown(false); |
|---|
| 909 | + } |
|---|
| 910 | + } |
|---|
| 911 | + }else |
|---|
| 912 | + { |
|---|
| 913 | + //I'm in the selection rectangle |
|---|
| 914 | + //but first, check for a next higher bin |
|---|
| 915 | + //if I'm near the edge of the rectangle, |
|---|
| 916 | + //go to the next higher bin |
|---|
| 917 | + |
|---|
| 918 | + //if I've drawn the right hand arrow |
|---|
| 919 | + if(boHasChildren == true) |
|---|
| 920 | + { |
|---|
| 921 | + //if I've clicked within 25% of the right edge |
|---|
| 922 | + if(e->x() >= (0.85 * (x_map_location + highlight_map[iMapUsed]->width())) ) |
|---|
| 923 | + { |
|---|
| 924 | + pushDown(); |
|---|
| 925 | + }else |
|---|
| 926 | + { |
|---|
| 927 | + select(); |
|---|
| 928 | + } |
|---|
| 929 | + }else if(boHasParent == true) //if there is a left arrow |
|---|
| 930 | + { |
|---|
| 931 | + if(e->x() <= (x_map_location + (0.15 * highlight_map[iMapUsed]->width()))) |
|---|
| 932 | + { |
|---|
| 933 | + popUp(); |
|---|
| 934 | + }else |
|---|
| 935 | + { |
|---|
| 936 | + select(); |
|---|
| 937 | + } |
|---|
| 938 | + |
|---|
| 939 | + }else |
|---|
| 940 | + { |
|---|
| 941 | + select(); |
|---|
| 942 | + } |
|---|
| 943 | + } |
|---|
| 944 | + |
|---|
| 945 | + iReturnValue = 0; |
|---|
| 946 | + }else //I'm not inside the active bin |
|---|
| 947 | + { |
|---|
| 948 | + |
|---|
| 949 | + //I'm to the left of the active bin |
|---|
| 950 | + if(e->x() < BinRect.left()) |
|---|
| 951 | + { |
|---|
| 952 | + popUp(); |
|---|
| 953 | + iReturnValue = 0; |
|---|
| 954 | + } |
|---|
| 955 | + |
|---|
| 956 | + //I'm to the right of the active bin |
|---|
| 957 | + if(e->x() > BinRect.right()) |
|---|
| 958 | + { |
|---|
| 959 | + pushDown(); |
|---|
| 960 | + iReturnValue = 0; |
|---|
| 961 | + } |
|---|
| 962 | + } |
|---|
| 963 | + |
|---|
| 964 | + refresh(); |
|---|
| 965 | + |
|---|
| 966 | + } |
|---|
| 967 | + |
|---|
| 968 | + return(iReturnValue); |
|---|
| 969 | +} |
|---|
| 970 | + |
|---|
| 971 | +//end of added section |
|---|
| 972 | + |
|---|
| 973 | // ******************************************************************** |
|---|
| 974 | |
|---|
| 975 | UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed) |
|---|
| 976 | @@ -4882,6 +5061,14 @@ |
|---|
| 977 | screen_area = QRect(x, y, width, height); |
|---|
| 978 | } |
|---|
| 979 | |
|---|
| 980 | +//Added by Anthony D'Alberto to support the mouse press handler |
|---|
| 981 | +int UIPushButtonType::mousePressHandler(QMouseEvent *e) |
|---|
| 982 | +{ |
|---|
| 983 | + push(); |
|---|
| 984 | + return(0); |
|---|
| 985 | +} |
|---|
| 986 | +//end of added section |
|---|
| 987 | + |
|---|
| 988 | // ******************************************************************** |
|---|
| 989 | |
|---|
| 990 | UITextButtonType::UITextButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed) |
|---|
| 991 | @@ -4999,6 +5186,12 @@ |
|---|
| 992 | screen_area = QRect(x, y, width, height); |
|---|
| 993 | } |
|---|
| 994 | |
|---|
| 995 | +//Added by Anthony D'Alberto to support mouse press |
|---|
| 996 | +int UITextButtonType::mousePressHandler(QMouseEvent *e) |
|---|
| 997 | +{ |
|---|
| 998 | + push(); |
|---|
| 999 | + return(0); |
|---|
| 1000 | +} |
|---|
| 1001 | // ******************************************************************** |
|---|
| 1002 | |
|---|
| 1003 | UICheckBoxType::UICheckBoxType(const QString &name, |
|---|
| 1004 | @@ -5111,7 +5304,13 @@ |
|---|
| 1005 | checked = checked_or_not; |
|---|
| 1006 | refresh(); |
|---|
| 1007 | } |
|---|
| 1008 | - |
|---|
| 1009 | +//Added by Anhtony D'Alberto to support mouse presses |
|---|
| 1010 | +int UICheckBoxType::mousePressHandler(QMouseEvent *e) |
|---|
| 1011 | +{ |
|---|
| 1012 | + push(); |
|---|
| 1013 | + return(0); |
|---|
| 1014 | +} |
|---|
| 1015 | +//end of added section |
|---|
| 1016 | // ******************************************************************** |
|---|
| 1017 | |
|---|
| 1018 | UISelectorType::UISelectorType(const QString &name, |
|---|
| 1019 | @@ -5277,6 +5476,13 @@ |
|---|
| 1020 | my_data.clear(); |
|---|
| 1021 | } |
|---|
| 1022 | |
|---|
| 1023 | +//Added by Anhtony D'Alberto to support mouse presses |
|---|
| 1024 | +int UISelectorType::mousePressHandler(QMouseEvent *e) |
|---|
| 1025 | +{ |
|---|
| 1026 | + push(true); |
|---|
| 1027 | + return(0); |
|---|
| 1028 | +} |
|---|
| 1029 | +//end of added section |
|---|
| 1030 | // ******************************************************************** |
|---|
| 1031 | |
|---|
| 1032 | UIBlackHoleType::UIBlackHoleType(const QString &name) |
|---|
| 1033 | @@ -5558,6 +5764,13 @@ |
|---|
| 1034 | } |
|---|
| 1035 | } |
|---|
| 1036 | |
|---|
| 1037 | +//Added by Anthony D'Alberto to support mouse press |
|---|
| 1038 | +int UIKeyType::mousePressHandler(QMouseEvent *e) |
|---|
| 1039 | +{ |
|---|
| 1040 | + push(); |
|---|
| 1041 | + return(0); |
|---|
| 1042 | +} |
|---|
| 1043 | +//end of added section |
|---|
| 1044 | // ******************************************************************** |
|---|
| 1045 | |
|---|
| 1046 | const int numcomps = 95; |
|---|
| 1047 | Index: libs/libmyth/uitypes.h |
|---|
| 1048 | =================================================================== |
|---|
| 1049 | --- libs/libmyth/uitypes.h (revision 14491) |
|---|
| 1050 | +++ libs/libmyth/uitypes.h (working copy) |
|---|
| 1051 | @@ -125,7 +125,15 @@ |
|---|
| 1052 | virtual void hide(); |
|---|
| 1053 | virtual bool toggleShow(); |
|---|
| 1054 | |
|---|
| 1055 | +//added by Anthony D'Alberto to support mouse presses in UITypes |
|---|
| 1056 | +//this is done by making calling the handler function in |
|---|
| 1057 | +//the event handler. |
|---|
| 1058 | +//for some reason, the uipushbutton already has this. |
|---|
| 1059 | |
|---|
| 1060 | +//this is the default handler, do nothing |
|---|
| 1061 | + virtual int mousePressHandler(QMouseEvent *e){return (-1);} |
|---|
| 1062 | +//end of added section |
|---|
| 1063 | + |
|---|
| 1064 | signals: |
|---|
| 1065 | |
|---|
| 1066 | // |
|---|
| 1067 | @@ -1113,6 +1121,10 @@ |
|---|
| 1068 | bool incSearchStart(); |
|---|
| 1069 | bool incSearchNext(); |
|---|
| 1070 | |
|---|
| 1071 | +//added by Anthony D'Alberto to support mouse press in Managed List |
|---|
| 1072 | + int mousePressHandler(QMouseEvent *e); |
|---|
| 1073 | +//end of added section |
|---|
| 1074 | + |
|---|
| 1075 | signals: |
|---|
| 1076 | |
|---|
| 1077 | void nodeSelected(int, IntVector*); // emit int and attributes when user selects a node |
|---|
| 1078 | @@ -1159,6 +1171,15 @@ |
|---|
| 1079 | QPoint rightArrowOffset; |
|---|
| 1080 | QString incSearch; |
|---|
| 1081 | bool bIncSearchContains; |
|---|
| 1082 | + |
|---|
| 1083 | +//added by Anthony D'Alberto to support mouse presses in List box |
|---|
| 1084 | + |
|---|
| 1085 | + int iMapUsed; |
|---|
| 1086 | + int x_map_location; |
|---|
| 1087 | + int y_map_location; |
|---|
| 1088 | + bool boHasChildren; |
|---|
| 1089 | + bool boHasParent; |
|---|
| 1090 | +//end of added section |
|---|
| 1091 | }; |
|---|
| 1092 | |
|---|
| 1093 | class MPUBLIC UIPushButtonType : public UIType |
|---|
| 1094 | @@ -1180,6 +1201,10 @@ |
|---|
| 1095 | virtual void unPush(); |
|---|
| 1096 | virtual void activate(){push();} |
|---|
| 1097 | |
|---|
| 1098 | +//Added by Anhtony D'Alberto to support mouse presses |
|---|
| 1099 | + virtual int mousePressHandler(QMouseEvent *e); |
|---|
| 1100 | +//end of added section |
|---|
| 1101 | + |
|---|
| 1102 | signals: |
|---|
| 1103 | |
|---|
| 1104 | void pushed(); |
|---|
| 1105 | @@ -1217,6 +1242,10 @@ |
|---|
| 1106 | void unPush(); |
|---|
| 1107 | void activate(){push();} |
|---|
| 1108 | |
|---|
| 1109 | +//Added by Anthony D'Alberto to support the mouse press |
|---|
| 1110 | + int mousePressHandler(QMouseEvent *e); |
|---|
| 1111 | +//end of added section |
|---|
| 1112 | + |
|---|
| 1113 | signals: |
|---|
| 1114 | |
|---|
| 1115 | void pushed(); |
|---|
| 1116 | @@ -1264,6 +1293,10 @@ |
|---|
| 1117 | void toggle(){push();} |
|---|
| 1118 | void activate(){push();} |
|---|
| 1119 | |
|---|
| 1120 | +//Added by Anhtony D'Alberto to support mouse presses |
|---|
| 1121 | + virtual int mousePressHandler(QMouseEvent *e); |
|---|
| 1122 | +//end of added section |
|---|
| 1123 | + |
|---|
| 1124 | signals: |
|---|
| 1125 | |
|---|
| 1126 | void pushed(bool state); |
|---|
| 1127 | @@ -1335,6 +1368,10 @@ |
|---|
| 1128 | void setToItem(int which_item); |
|---|
| 1129 | void setToItem(const QString &which_item); |
|---|
| 1130 | |
|---|
| 1131 | +//Added by Anhtony D'Alberto to support mouse presses |
|---|
| 1132 | + virtual int mousePressHandler(QMouseEvent *e); |
|---|
| 1133 | +//end of added section |
|---|
| 1134 | + |
|---|
| 1135 | signals: |
|---|
| 1136 | |
|---|
| 1137 | void pushed(int); |
|---|
| 1138 | @@ -1420,6 +1457,10 @@ |
|---|
| 1139 | void unPush(); |
|---|
| 1140 | void activate(){push();} |
|---|
| 1141 | |
|---|
| 1142 | +//Added by Anhtony D'Alberto to support mouse presses |
|---|
| 1143 | + int mousePressHandler(QMouseEvent *e); |
|---|
| 1144 | +//end of added section |
|---|
| 1145 | + |
|---|
| 1146 | signals: |
|---|
| 1147 | void pushed(); |
|---|
| 1148 | |
|---|
| 1149 | @@ -1458,6 +1499,7 @@ |
|---|
| 1150 | |
|---|
| 1151 | bool m_bPushed; |
|---|
| 1152 | QTimer m_pushTimer; |
|---|
| 1153 | + |
|---|
| 1154 | }; |
|---|
| 1155 | |
|---|
| 1156 | class MPUBLIC UIKeyboardType : public UIType |
|---|
| 1157 | @@ -1526,6 +1568,7 @@ |
|---|
| 1158 | |
|---|
| 1159 | LayerSet *m_container; |
|---|
| 1160 | KeyList m_keyList; |
|---|
| 1161 | + |
|---|
| 1162 | }; |
|---|
| 1163 | |
|---|
| 1164 | #endif |
|---|
| 1165 | Index: libs/libmyth/mythdialogs.h |
|---|
| 1166 | =================================================================== |
|---|
| 1167 | --- libs/libmyth/mythdialogs.h (revision 14491) |
|---|
| 1168 | +++ libs/libmyth/mythdialogs.h (working copy) |
|---|
| 1169 | @@ -107,6 +107,7 @@ |
|---|
| 1170 | bool in_loop; |
|---|
| 1171 | |
|---|
| 1172 | QFont defaultBigFont, defaultMediumFont, defaultSmallFont; |
|---|
| 1173 | + |
|---|
| 1174 | }; |
|---|
| 1175 | |
|---|
| 1176 | class MPUBLIC MythPopupBox : public MythDialog |
|---|
| 1177 | @@ -170,6 +171,7 @@ |
|---|
| 1178 | QColor popupForegroundColor; |
|---|
| 1179 | int hpadding, wpadding; |
|---|
| 1180 | bool arrowAccel; |
|---|
| 1181 | + |
|---|
| 1182 | }; |
|---|
| 1183 | |
|---|
| 1184 | /** The MythTV progress bar dialog. |
|---|
| 1185 | @@ -337,6 +339,11 @@ |
|---|
| 1186 | QPixmap my_background; |
|---|
| 1187 | QPixmap my_foreground; |
|---|
| 1188 | |
|---|
| 1189 | +//added by Anthony D'Alberto to support back button |
|---|
| 1190 | + virtual void mousePressEvent(QMouseEvent *e); |
|---|
| 1191 | + virtual void mouseReleaseEvent(QMouseEvent *e); |
|---|
| 1192 | +//end of added section |
|---|
| 1193 | + |
|---|
| 1194 | private: |
|---|
| 1195 | |
|---|
| 1196 | void ReallyUpdateForeground(const QRect &); |
|---|
| 1197 | Index: libs/libmyth/mythwidgets.h |
|---|
| 1198 | =================================================================== |
|---|
| 1199 | --- libs/libmyth/mythwidgets.h (revision 14491) |
|---|
| 1200 | +++ libs/libmyth/mythwidgets.h (working copy) |
|---|
| 1201 | @@ -207,7 +207,12 @@ |
|---|
| 1202 | public slots: |
|---|
| 1203 | |
|---|
| 1204 | virtual void setText(const QString& text); |
|---|
| 1205 | - |
|---|
| 1206 | + |
|---|
| 1207 | +//Added by Anthony D'Alberto to support mouse press |
|---|
| 1208 | + void LineClicked(int para, int pos); |
|---|
| 1209 | +//end of added section |
|---|
| 1210 | + |
|---|
| 1211 | + |
|---|
| 1212 | protected: |
|---|
| 1213 | |
|---|
| 1214 | virtual void focusInEvent(QFocusEvent *e); |
|---|