//============================================================== // Конструктор с параметром //============================================================== FormAnimationCoreFrames::FormAnimationCoreFrames(QWidget *parent) : QWidget(parent), ui_(new Ui::FormAnimationCoreFrames) { ui_->setupUi(this); correctSize(); }
void EmoticonSelectorPage::setupFavouriteEmoticons() { FavouriteEmoticonsDialog dlg; connect (&dlg, SIGNAL(doubleClicked(QString)), m_parentSelector, SLOT(slotClicked(QString))); if (dlg.exec() == QDialog::Accepted) { delete this->layout(); delete emotions; setCurrentLayout(); correctSize(); } }
//----------------------------------------------------------------------------- void KMMimePartTree::correctSize( QListViewItem * item ) { if (!item) return; KIO::filesize_t totalSize = 0; QListViewItem * myChild = item->firstChild(); while ( myChild ) { totalSize += static_cast<KMMimePartTreeItem*>(myChild)->origSize(); myChild = myChild->nextSibling(); } if ( totalSize > static_cast<KMMimePartTreeItem*>(item)->origSize() ) item->setText( mSizeColumn, KIO::convertSize(totalSize) ); if ( item->parent() ) correctSize( item->parent() ); }
TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// bool UIEdit::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(TEMPLATE) TOKEN_TABLE(DISABLED) TOKEN_TABLE(VISIBLE) TOKEN_TABLE(BACK) TOKEN_TABLE(IMAGE) TOKEN_TABLE(FONT_SELECTED) TOKEN_TABLE(FONT) TOKEN_TABLE(TEXT) TOKEN_TABLE(X) TOKEN_TABLE(Y) TOKEN_TABLE(WIDTH) TOKEN_TABLE(HEIGHT) TOKEN_TABLE(CURSOR_BLINK_RATE) TOKEN_TABLE(CURSOR) TOKEN_TABLE(FRAME_WIDTH) TOKEN_TABLE(NAME) TOKEN_TABLE(SCRIPT) TOKEN_TABLE(PARENT_NOTIFY) TOKEN_TABLE(MAX_LENGTH) TOKEN_TABLE(EDITOR_PROPERTY) TOKEN_TABLE(EDIT) TOKEN_TABLE(CAPTION) TOKEN_TABLE_END byte *params; int cmd = 2; BaseParser parser; if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_EDIT) { _gameRef->LOG(0, "'EDIT' keyword expected."); return STATUS_FAILED; } buffer = params; } while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_TEMPLATE: if (DID_FAIL(loadFile((char *)params))) { cmd = PARSERR_GENERIC; } break; case TOKEN_NAME: setName((char *)params); break; case TOKEN_BACK: delete _back; _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; _back = NULL; cmd = PARSERR_GENERIC; } break; case TOKEN_IMAGE: delete _image; _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; _image = NULL; cmd = PARSERR_GENERIC; } break; case TOKEN_FONT: if (_font) { _gameRef->_fontStorage->removeFont(_font); } _font = _gameRef->_fontStorage->addFont((char *)params); if (!_font) { cmd = PARSERR_GENERIC; } break; case TOKEN_FONT_SELECTED: if (_fontSelected) { _gameRef->_fontStorage->removeFont(_fontSelected); } _fontSelected = _gameRef->_fontStorage->addFont((char *)params); if (!_fontSelected) { cmd = PARSERR_GENERIC; } break; case TOKEN_TEXT: setText((char *)params); _gameRef->_stringTable->expand(&_text); break; case TOKEN_X: parser.scanStr((char *)params, "%d", &_posX); break; case TOKEN_Y: parser.scanStr((char *)params, "%d", &_posY); break; case TOKEN_WIDTH: parser.scanStr((char *)params, "%d", &_width); break; case TOKEN_HEIGHT: parser.scanStr((char *)params, "%d", &_height); break; case TOKEN_MAX_LENGTH: parser.scanStr((char *)params, "%d", &_maxLength); break; case TOKEN_CAPTION: setCaption((char *)params); break; case TOKEN_CURSOR: delete _cursor; _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = NULL; cmd = PARSERR_GENERIC; } break; case TOKEN_CURSOR_BLINK_RATE: parser.scanStr((char *)params, "%d", &_cursorBlinkRate); break; case TOKEN_FRAME_WIDTH: parser.scanStr((char *)params, "%d", &_frameWidth); break; case TOKEN_SCRIPT: addScript((char *)params); break; case TOKEN_PARENT_NOTIFY: parser.scanStr((char *)params, "%b", &_parentNotify); break; case TOKEN_DISABLED: parser.scanStr((char *)params, "%b", &_disable); break; case TOKEN_VISIBLE: parser.scanStr((char *)params, "%b", &_visible); break; case TOKEN_EDITOR_PROPERTY: parseEditorProperty(params, false); break; } } if (cmd == PARSERR_TOKENNOTFOUND) { _gameRef->LOG(0, "Syntax error in EDIT definition"); return STATUS_FAILED; } if (cmd == PARSERR_GENERIC) { _gameRef->LOG(0, "Error loading EDIT definition"); return STATUS_FAILED; } correctSize(); return STATUS_OK; }
//============================================================== // Задание фигур //============================================================== void FormAnimationCoreFrames::setFigures(QList<const Figure*> figures) { this->figures_ = figures; correctSize(); repaint(); }
TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// bool UIEntity::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(ENTITY_CONTAINER) TOKEN_TABLE(TEMPLATE) TOKEN_TABLE(DISABLED) TOKEN_TABLE(VISIBLE) TOKEN_TABLE(X) TOKEN_TABLE(Y) TOKEN_TABLE(NAME) TOKEN_TABLE(ENTITY) TOKEN_TABLE(SCRIPT) TOKEN_TABLE(EDITOR_PROPERTY) TOKEN_TABLE_END byte *params; int cmd = 2; BaseParser parser; if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_ENTITY_CONTAINER) { _gameRef->LOG(0, "'ENTITY_CONTAINER' keyword expected."); return STATUS_FAILED; } buffer = params; } while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_TEMPLATE: if (DID_FAIL(loadFile((char *)params))) { cmd = PARSERR_GENERIC; } break; case TOKEN_NAME: setName((char *)params); break; case TOKEN_X: parser.scanStr((char *)params, "%d", &_posX); break; case TOKEN_Y: parser.scanStr((char *)params, "%d", &_posY); break; case TOKEN_DISABLED: parser.scanStr((char *)params, "%b", &_disable); break; case TOKEN_VISIBLE: parser.scanStr((char *)params, "%b", &_visible); break; case TOKEN_ENTITY: if (DID_FAIL(setEntity((char *)params))) { cmd = PARSERR_GENERIC; } break; case TOKEN_SCRIPT: addScript((char *)params); break; case TOKEN_EDITOR_PROPERTY: parseEditorProperty(params, false); break; } } if (cmd == PARSERR_TOKENNOTFOUND) { _gameRef->LOG(0, "Syntax error in ENTITY_CONTAINER definition"); return STATUS_FAILED; } if (cmd == PARSERR_GENERIC) { _gameRef->LOG(0, "Error loading ENTITY_CONTAINER definition"); return STATUS_FAILED; } correctSize(); if (_gameRef->_editorMode) { _width = 50; _height = 50; } return STATUS_OK; }
TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// bool UIText::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(STATIC) TOKEN_TABLE(TEMPLATE) TOKEN_TABLE(DISABLED) TOKEN_TABLE(VISIBLE) TOKEN_TABLE(BACK) TOKEN_TABLE(IMAGE) TOKEN_TABLE(FONT) TOKEN_TABLE(TEXT_ALIGN) TOKEN_TABLE(VERTICAL_ALIGN) TOKEN_TABLE(TEXT) TOKEN_TABLE(X) TOKEN_TABLE(Y) TOKEN_TABLE(WIDTH) TOKEN_TABLE(HEIGHT) TOKEN_TABLE(CURSOR) TOKEN_TABLE(NAME) TOKEN_TABLE(SCRIPT) TOKEN_TABLE(CAPTION) TOKEN_TABLE(PARENT_NOTIFY) TOKEN_TABLE(EDITOR_PROPERTY) TOKEN_TABLE_END byte *params; int cmd = 2; BaseParser parser; if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_STATIC) { _gameRef->LOG(0, "'STATIC' keyword expected."); return STATUS_FAILED; } buffer = params; } while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_TEMPLATE: if (DID_FAIL(loadFile((char *)params))) { cmd = PARSERR_GENERIC; } break; case TOKEN_NAME: setName((char *)params); break; case TOKEN_CAPTION: setCaption((char *)params); break; case TOKEN_BACK: delete _back; _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; _back = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_IMAGE: delete _image; _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; _image = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_FONT: if (_font) { _gameRef->_fontStorage->removeFont(_font); } _font = _gameRef->_fontStorage->addFont((char *)params); if (!_font) { cmd = PARSERR_GENERIC; } break; case TOKEN_TEXT: setText((char *)params); _gameRef->expandStringByStringTable(&_text); break; case TOKEN_TEXT_ALIGN: if (scumm_stricmp((char *)params, "left") == 0) { _textAlign = TAL_LEFT; } else if (scumm_stricmp((char *)params, "right") == 0) { _textAlign = TAL_RIGHT; } else { _textAlign = TAL_CENTER; } break; case TOKEN_VERTICAL_ALIGN: if (scumm_stricmp((char *)params, "top") == 0) { _verticalAlign = VAL_TOP; } else if (scumm_stricmp((char *)params, "bottom") == 0) { _verticalAlign = VAL_BOTTOM; } else { _verticalAlign = VAL_CENTER; } break; case TOKEN_X: parser.scanStr((char *)params, "%d", &_posX); break; case TOKEN_Y: parser.scanStr((char *)params, "%d", &_posY); break; case TOKEN_WIDTH: parser.scanStr((char *)params, "%d", &_width); break; case TOKEN_HEIGHT: parser.scanStr((char *)params, "%d", &_height); break; case TOKEN_CURSOR: delete _cursor; _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_SCRIPT: addScript((char *)params); break; case TOKEN_PARENT_NOTIFY: parser.scanStr((char *)params, "%b", &_parentNotify); break; case TOKEN_DISABLED: parser.scanStr((char *)params, "%b", &_disable); break; case TOKEN_VISIBLE: parser.scanStr((char *)params, "%b", &_visible); break; case TOKEN_EDITOR_PROPERTY: parseEditorProperty(params, false); break; } } if (cmd == PARSERR_TOKENNOTFOUND) { _gameRef->LOG(0, "Syntax error in STATIC definition"); return STATUS_FAILED; } if (cmd == PARSERR_GENERIC) { _gameRef->LOG(0, "Error loading STATIC definition"); return STATUS_FAILED; } correctSize(); return STATUS_OK; }
TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// bool UIButton::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(BUTTON) TOKEN_TABLE(TEMPLATE) TOKEN_TABLE(DISABLED) TOKEN_TABLE(VISIBLE) TOKEN_TABLE(FOCUSABLE) TOKEN_TABLE(BACK_HOVER) TOKEN_TABLE(BACK_PRESS) TOKEN_TABLE(BACK_DISABLE) TOKEN_TABLE(BACK_FOCUS) TOKEN_TABLE(BACK) TOKEN_TABLE(CENTER_IMAGE) TOKEN_TABLE(IMAGE_HOVER) TOKEN_TABLE(IMAGE_PRESS) TOKEN_TABLE(IMAGE_DISABLE) TOKEN_TABLE(IMAGE_FOCUS) TOKEN_TABLE(IMAGE) TOKEN_TABLE(FONT_HOVER) TOKEN_TABLE(FONT_PRESS) TOKEN_TABLE(FONT_DISABLE) TOKEN_TABLE(FONT_FOCUS) TOKEN_TABLE(FONT) TOKEN_TABLE(TEXT_ALIGN) TOKEN_TABLE(TEXT) TOKEN_TABLE(X) TOKEN_TABLE(Y) TOKEN_TABLE(WIDTH) TOKEN_TABLE(HEIGHT) TOKEN_TABLE(CURSOR) TOKEN_TABLE(NAME) TOKEN_TABLE(EVENTS) TOKEN_TABLE(SCRIPT) TOKEN_TABLE(CAPTION) TOKEN_TABLE(PARENT_NOTIFY) TOKEN_TABLE(PRESSED) TOKEN_TABLE(PIXEL_PERFECT) TOKEN_TABLE(EDITOR_PROPERTY) TOKEN_TABLE_END byte *params; int cmd = 2; BaseParser parser; if (complete) { if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_BUTTON) { _gameRef->LOG(0, "'BUTTON' keyword expected."); return STATUS_FAILED; } buffer = params; } while (cmd > 0 && (cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) > 0) { switch (cmd) { case TOKEN_TEMPLATE: if (DID_FAIL(loadFile((char *)params))) { cmd = PARSERR_GENERIC; } break; case TOKEN_NAME: setName((char *)params); break; case TOKEN_CAPTION: setCaption((char *)params); break; case TOKEN_BACK: delete _back; _back = new UITiledImage(_gameRef); if (!_back || DID_FAIL(_back->loadFile((char *)params))) { delete _back; _back = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_BACK_HOVER: delete _backHover; _backHover = new UITiledImage(_gameRef); if (!_backHover || DID_FAIL(_backHover->loadFile((char *)params))) { delete _backHover; _backHover = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_BACK_PRESS: delete _backPress; _backPress = new UITiledImage(_gameRef); if (!_backPress || DID_FAIL(_backPress->loadFile((char *)params))) { delete _backPress; _backPress = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_BACK_DISABLE: delete _backDisable; _backDisable = new UITiledImage(_gameRef); if (!_backDisable || DID_FAIL(_backDisable->loadFile((char *)params))) { delete _backDisable; _backDisable = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_BACK_FOCUS: delete _backFocus; _backFocus = new UITiledImage(_gameRef); if (!_backFocus || DID_FAIL(_backFocus->loadFile((char *)params))) { delete _backFocus; _backFocus = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_IMAGE: delete _image; _image = new BaseSprite(_gameRef); if (!_image || DID_FAIL(_image->loadFile((char *)params))) { delete _image; _image = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_IMAGE_HOVER: delete _imageHover; _imageHover = new BaseSprite(_gameRef); if (!_imageHover || DID_FAIL(_imageHover->loadFile((char *)params))) { delete _imageHover; _imageHover = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_IMAGE_PRESS: delete _imagePress; _imagePress = new BaseSprite(_gameRef); if (!_imagePress || DID_FAIL(_imagePress->loadFile((char *)params))) { delete _imagePress; _imagePress = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_IMAGE_DISABLE: delete _imageDisable; _imageDisable = new BaseSprite(_gameRef); if (!_imageDisable || DID_FAIL(_imageDisable->loadFile((char *)params))) { delete _imageDisable; _imageDisable = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_IMAGE_FOCUS: delete _imageFocus; _imageFocus = new BaseSprite(_gameRef); if (!_imageFocus || DID_FAIL(_imageFocus->loadFile((char *)params))) { delete _imageFocus; _imageFocus = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_FONT: if (_font) { _gameRef->_fontStorage->removeFont(_font); } _font = _gameRef->_fontStorage->addFont((char *)params); if (!_font) { cmd = PARSERR_GENERIC; } break; case TOKEN_FONT_HOVER: if (_fontHover) { _gameRef->_fontStorage->removeFont(_fontHover); } _fontHover = _gameRef->_fontStorage->addFont((char *)params); if (!_fontHover) { cmd = PARSERR_GENERIC; } break; case TOKEN_FONT_PRESS: if (_fontPress) { _gameRef->_fontStorage->removeFont(_fontPress); } _fontPress = _gameRef->_fontStorage->addFont((char *)params); if (!_fontPress) { cmd = PARSERR_GENERIC; } break; case TOKEN_FONT_DISABLE: if (_fontDisable) { _gameRef->_fontStorage->removeFont(_fontDisable); } _fontDisable = _gameRef->_fontStorage->addFont((char *)params); if (!_fontDisable) { cmd = PARSERR_GENERIC; } break; case TOKEN_FONT_FOCUS: if (_fontFocus) { _gameRef->_fontStorage->removeFont(_fontFocus); } _fontFocus = _gameRef->_fontStorage->addFont((char *)params); if (!_fontFocus) { cmd = PARSERR_GENERIC; } break; case TOKEN_TEXT: setText((char *)params); _gameRef->_stringTable->expand(&_text); break; case TOKEN_TEXT_ALIGN: if (scumm_stricmp((char *)params, "left") == 0) { _align = TAL_LEFT; } else if (scumm_stricmp((char *)params, "right") == 0) { _align = TAL_RIGHT; } else { _align = TAL_CENTER; } break; case TOKEN_X: parser.scanStr((char *)params, "%d", &_posX); break; case TOKEN_Y: parser.scanStr((char *)params, "%d", &_posY); break; case TOKEN_WIDTH: parser.scanStr((char *)params, "%d", &_width); break; case TOKEN_HEIGHT: parser.scanStr((char *)params, "%d", &_height); break; case TOKEN_CURSOR: delete _cursor; _cursor = new BaseSprite(_gameRef); if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { delete _cursor; _cursor = nullptr; cmd = PARSERR_GENERIC; } break; case TOKEN_SCRIPT: addScript((char *)params); break; case TOKEN_PARENT_NOTIFY: parser.scanStr((char *)params, "%b", &_parentNotify); break; case TOKEN_DISABLED: parser.scanStr((char *)params, "%b", &_disable); break; case TOKEN_VISIBLE: parser.scanStr((char *)params, "%b", &_visible); break; case TOKEN_FOCUSABLE: parser.scanStr((char *)params, "%b", &_canFocus); break; case TOKEN_CENTER_IMAGE: parser.scanStr((char *)params, "%b", &_centerImage); break; case TOKEN_PRESSED: parser.scanStr((char *)params, "%b", &_stayPressed); break; case TOKEN_PIXEL_PERFECT: parser.scanStr((char *)params, "%b", &_pixelPerfect); break; case TOKEN_EDITOR_PROPERTY: parseEditorProperty(params, false); break; } } if (cmd == PARSERR_TOKENNOTFOUND) { _gameRef->LOG(0, "Syntax error in BUTTON definition"); return STATUS_FAILED; } if (cmd == PARSERR_GENERIC) { _gameRef->LOG(0, "Error loading BUTTON definition"); return STATUS_FAILED; } correctSize(); return STATUS_OK; }