QueryWidget::QueryWidget(MongoShell *shell, QWidget *parent) : QWidget(parent), _shell(shell), _viewer(NULL), _isTextChanged(false) { AppRegistry::instance().bus()->subscribe(this, DocumentListLoadedEvent::Type, shell); AppRegistry::instance().bus()->subscribe(this, ScriptExecutedEvent::Type, shell); AppRegistry::instance().bus()->subscribe(this, AutocompleteResponse::Type, shell); _scriptWidget = new ScriptWidget(_shell); VERIFY(connect(_scriptWidget,SIGNAL(textChanged()),this,SLOT(textChange()))); _viewer = new OutputWidget(); _outputLabel = new QLabel(this); _outputLabel->setContentsMargins(0, 5, 0, 0); _outputLabel->setVisible(false); QFrame *line = new QFrame(this); line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Raised); QVBoxLayout *layout = new QVBoxLayout; layout->setSpacing(0); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(_scriptWidget, 0, Qt::AlignTop); layout->addWidget(line); layout->addWidget(_outputLabel, 0, Qt::AlignTop); layout->addWidget(_viewer, 1); setLayout(layout); }
NoteEditor::NoteEditor(QWidget *parent) : QWidget(parent) { id = 0; setMaximumSize(450, 150); int noteEditorWidth = 450; int noteEditorHeight = 200; noteEditText = new QTextEdit; noteEditText->setStyleSheet("border: 2px solid grey"); saveButton = new QPushButton(tr("Save")); saveButton->setToolTip(tr("Save note")); saveButton->setFixedSize(noteEditorWidth / 2, noteEditorHeight / 8); saveButton->setEnabled(false); noteEditorLayout = new QGridLayout; noteEditorLayout->addWidget(noteEditText, 0, 0); noteEditorLayout->addWidget(saveButton, 1, 0, Qt::AlignRight); setLayout(noteEditorLayout); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveNote())); connect(noteEditText, SIGNAL(textChanged()), this, SLOT(textChange())); }
QueryWidget::QueryWidget(MongoShell *shell, WorkAreaTabWidget *tabWidget, ViewMode viewMode, QWidget *parent) : QWidget(parent), _shell(shell), _tabWidget(tabWidget), _app(AppRegistry::instance().app()), _bus(AppRegistry::instance().bus()), _viewer(NULL), _viewMode(viewMode), isTextChanged(false) { setObjectName("queryWidget"); _bus->subscribe(this, DocumentListLoadedEvent::Type, shell); _bus->subscribe(this, ScriptExecutedEvent::Type, shell); _bus->subscribe(this, AutocompleteResponse::Type, shell); qDebug() << "Subscribed to ScriptExecutedEvent"; _scriptWidget = new ScriptWidget(_shell); connect(_scriptWidget,SIGNAL(textChanged()),this,SLOT(textChange())); _scriptWidget->installEventFilter(this); _viewer = new OutputWidget(_viewMode, _shell); _outputLabel = new QLabel(this); _outputLabel->setContentsMargins(0, 5, 0, 0); _outputLabel->setVisible(false); _viewer->installEventFilter(this); QFrame *line = new QFrame(this); line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Raised); QVBoxLayout *layout = new QVBoxLayout; layout->setSpacing(0); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(_scriptWidget, 0, Qt::AlignTop); layout->addWidget(line); layout->addWidget(_outputLabel, 0, Qt::AlignTop); layout->addWidget(_viewer, 1); setLayout(layout); if (shell->isExecutable()) { showProgress(); } }
void playScene01::update(void) { gameNode::update(); //키 조작 keyControl(); //페이즈에 따른 맵 이동 & 캐릭터 이동 phaseMove(_background.phase); //유닛 Y위치에 따른 정렬 std::sort(_vUnit.begin(), _vUnit.end(), compare); //! 아이템 정렬 std::sort(_vItem.begin(), _vItem.end(), icompare); for (int i = 0; i < _vUnit.size(); i++) { if (_vUnit[i]->getKind() == KIND_USER) _unitNum = i; } //유닛 업데이트 for (_viUnit = _vUnit.begin(); _viUnit != _vUnit.end(); ++_viUnit) { (*_viUnit)->update(); (*_viUnit)->setTarget(_vUnit[_unitNum]->getShadowX(), _vUnit[_unitNum]->getShadowY()); } //_unit->update(); if (_background.broken) _background.img = IMAGEMANAGER->findImage("background01_broken"); if (alpha < 255) alpha += 3; if (text) textChange(); //캐릭터 제거 for (_viUnit = _vUnit.begin(); _viUnit != _vUnit.end(); ++_viUnit) { if ((*_viUnit)->getHp() <= 0) { (*_viUnit)->remove(); _unitNum = 0; break; } } for (int i = 0; i < _vUnit.size(); i++) { if (_vUnit[i]->getKind() == KIND_USER) _unitNum = i; if (_vUnit[i]->getRemove() >= 100) { //죽으면 게임오버씬으로 if (_vUnit[i]->getKind()==KIND_USER) SCENEMANAGER->changeScene("gameOver"); //아이템 생성 if (_vUnit[i]->getX()>0 && _vUnit[i]->getX() < WINSIZEX) { item* it = new item; it->init(_vUnit[i]->getShadowX(), _vUnit[i]->getShadowY()); _vItem.push_back(it); } _vUnit.erase(_vUnit.begin() + i); } if (_background.phase == PHASE_02&&_vUnit[i]->getKind() == KIND_BOSS&&_vUnit[i]->getX() > WINSIZEX + 50) { _vUnit.erase(_vUnit.begin() + i); } } //! 아이템 업데이트 && 사라지게 for (_viItem = _vItem.begin(); _viItem != _vItem.end(); ++_viItem) { (*_viItem)->update(); } getItem(); if (_vItem.size() != 0) { for (int i = 0; i < _vItem.size(); i++) { if (_vItem[i]->removeItem()) _vItem.erase(_vItem.begin() + i); break; } } collision(); }