KoView::KoView( KoDocument *document, QWidget *parent, const char *name ) : QWidget( parent, name ) { Q_ASSERT( document ); //kdDebug(30003) << "KoView::KoView " << this << endl; d = new KoViewPrivate; d->m_doc = document; KParts::PartBase::setPartObject( this ); setFocusPolicy( StrongFocus ); setMouseTracking( true ); connect( d->m_doc, SIGNAL( childChanged( KoDocumentChild * ) ), this, SLOT( slotChildChanged( KoDocumentChild * ) ) ); connect( d->m_doc, SIGNAL( sigBeginOperation() ), this, SLOT( beginOperation() ) ); connect( d->m_doc, SIGNAL( sigEndOperation() ), this, SLOT( endOperation() ) ); actionCollection()->setWidget( this ); setupGlobalActions(); KActionCollection *coll = actionCollection(); /**** not needed anymore, according to David (Werner) QValueList<KAction*> docActions = document->actionCollection()->actions(); QValueList<KAction*>::ConstIterator it = docActions.begin(); QValueList<KAction*>::ConstIterator end = docActions.end(); for (; it != end; ++it ) coll->insert( *it ); */ KStatusBar * sb = statusBar(); if ( sb ) // No statusbar in e.g. konqueror { coll->setHighlightingEnabled( true ); connect( coll, SIGNAL( actionStatusText( const QString & ) ), this, SLOT( slotActionStatusText( const QString & ) ) ); connect( coll, SIGNAL( clearStatusText() ), this, SLOT( slotClearStatusText() ) ); connect( d->m_doc, SIGNAL( sigStatusBarMessage( const QString& ) ), this, SLOT( slotActionStatusText( const QString& ) ) ); connect( d->m_doc, SIGNAL( sigClearStatusBarMessage() ), this, SLOT( slotClearStatusText() ) ); } d->m_doc->setCurrent(); d->m_scrollTimer = new QTimer( this ); connect (d->m_scrollTimer, SIGNAL( timeout() ), this, SLOT( slotAutoScroll() ) ); }
bool QAction::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: activate(); break; case 1: toggle(); break; case 2: setOn((bool)static_QUType_bool.get(_o+1)); break; case 3: setEnabled((bool)static_QUType_bool.get(_o+1)); break; case 4: setDisabled((bool)static_QUType_bool.get(_o+1)); break; case 5: setVisible((bool)static_QUType_bool.get(_o+1)); break; case 6: internalActivation(); break; case 7: toolButtonToggled((bool)static_QUType_bool.get(_o+1)); break; case 8: objectDestroyed(); break; case 9: menuStatusText((int)static_QUType_int.get(_o+1)); break; case 10: showStatusText((const QString&)static_QUType_QString.get(_o+1)); break; case 11: clearStatusText(); break; default: return QObject::qt_invoke( _id, _o ); } return TRUE; }
int Q3Action::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: activated(); break; case 1: toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 2: activate(); break; case 3: toggle(); break; case 4: setOn((*reinterpret_cast< bool(*)>(_a[1]))); break; case 5: setEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 6: setDisabled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 7: setVisible((*reinterpret_cast< bool(*)>(_a[1]))); break; case 8: internalActivation(); break; case 9: toolButtonToggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 10: objectDestroyed(); break; case 11: menuStatusText((*reinterpret_cast< int(*)>(_a[1]))); break; case 12: showStatusText((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 13: clearStatusText(); break; } _id -= 14; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isToggleAction(); break; case 1: *reinterpret_cast< bool*>(_v) = isOn(); break; case 2: *reinterpret_cast< bool*>(_v) = isEnabled(); break; case 3: *reinterpret_cast< QIcon*>(_v) = iconSet(); break; case 4: *reinterpret_cast< QString*>(_v) = text(); break; case 5: *reinterpret_cast< QString*>(_v) = menuText(); break; case 6: *reinterpret_cast< QString*>(_v) = toolTip(); break; case 7: *reinterpret_cast< QString*>(_v) = statusTip(); break; case 8: *reinterpret_cast< QString*>(_v) = whatsThis(); break; case 9: *reinterpret_cast< QKeySequence*>(_v) = accel(); break; case 10: *reinterpret_cast< bool*>(_v) = isVisible(); break; } _id -= 11; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setToggleAction(*reinterpret_cast< bool*>(_v)); break; case 1: setOn(*reinterpret_cast< bool*>(_v)); break; case 2: setEnabled(*reinterpret_cast< bool*>(_v)); break; case 3: setIconSet(*reinterpret_cast< QIcon*>(_v)); break; case 4: setText(*reinterpret_cast< QString*>(_v)); break; case 5: setMenuText(*reinterpret_cast< QString*>(_v)); break; case 6: setToolTip(*reinterpret_cast< QString*>(_v)); break; case 7: setStatusTip(*reinterpret_cast< QString*>(_v)); break; case 8: setWhatsThis(*reinterpret_cast< QString*>(_v)); break; case 9: setAccel(*reinterpret_cast< QKeySequence*>(_v)); break; case 10: setVisible(*reinterpret_cast< bool*>(_v)); break; } _id -= 11; } else if (_c == QMetaObject::ResetProperty) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 11; } #endif // QT_NO_PROPERTIES return _id; }
void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_control, const CameraOrientation &cam, const PointedThing &pointed_old, float dtime) { v2u32 screensize = RenderingEngine::get_instance()->getWindowSize(); if (m_flags.show_debug) { static float drawtime_avg = 0; drawtime_avg = drawtime_avg * 0.95 + stats.drawtime * 0.05; u16 fps = 1.0 / stats.dtime_jitter.avg; std::ostringstream os(std::ios_base::binary); os << std::fixed << PROJECT_NAME_C " " << g_version_hash << ", FPS: " << fps << std::setprecision(0) << ", drawtime: " << drawtime_avg << "ms" << std::setprecision(1) << ", dtime jitter: " << (stats.dtime_jitter.max_fraction * 100.0) << "%" << std::setprecision(1) << ", view range: " << (draw_control->range_all ? "All" : itos(draw_control->wanted_range)) << std::setprecision(3) << ", RTT: " << client->getRTT() << "s"; setStaticText(m_guitext, utf8_to_wide(os.str()).c_str()); m_guitext->setRelativePosition(core::rect<s32>(5, 5, screensize.X, 5 + g_fontengine->getTextHeight())); } // Finally set the guitext visible depending on the flag m_guitext->setVisible(m_flags.show_debug); if (m_flags.show_debug) { LocalPlayer *player = client->getEnv().getLocalPlayer(); v3f player_position = player->getPosition(); std::ostringstream os(std::ios_base::binary); os << std::setprecision(1) << std::fixed << "pos: (" << (player_position.X / BS) << ", " << (player_position.Y / BS) << ", " << (player_position.Z / BS) << "), yaw: " << (wrapDegrees_0_360(cam.camera_yaw)) << "° " << yawToDirectionString(cam.camera_yaw) << ", seed: " << ((u64)client->getMapSeed()); if (pointed_old.type == POINTEDTHING_NODE) { ClientMap &map = client->getEnv().getClientMap(); const NodeDefManager *nodedef = client->getNodeDefManager(); MapNode n = map.getNodeNoEx(pointed_old.node_undersurface); if (n.getContent() != CONTENT_IGNORE && nodedef->get(n).name != "unknown") { os << ", pointed: " << nodedef->get(n).name << ", param2: " << (u64) n.getParam2(); } } setStaticText(m_guitext2, utf8_to_wide(os.str()).c_str()); m_guitext2->setRelativePosition(core::rect<s32>(5, 5 + g_fontengine->getTextHeight(), screensize.X, 5 + g_fontengine->getTextHeight() * 2 )); } m_guitext2->setVisible(m_flags.show_debug); setStaticText(m_guitext_info, translate_string(m_infotext).c_str()); m_guitext_info->setVisible(m_flags.show_hud && g_menumgr.menuCount() == 0); static const float statustext_time_max = 1.5f; if (!m_statustext.empty()) { m_statustext_time += dtime; if (m_statustext_time >= statustext_time_max) { clearStatusText(); m_statustext_time = 0.0f; } } setStaticText(m_guitext_status, translate_string(m_statustext).c_str()); m_guitext_status->setVisible(!m_statustext.empty()); if (!m_statustext.empty()) { s32 status_width = m_guitext_status->getTextWidth(); s32 status_height = m_guitext_status->getTextHeight(); s32 status_y = screensize.Y - 150; s32 status_x = (screensize.X - status_width) / 2; m_guitext_status->setRelativePosition(core::rect<s32>(status_x , status_y - status_height, status_x + status_width, status_y)); // Fade out video::SColor final_color = m_statustext_initial_color; final_color.setAlpha(0); video::SColor fade_color = m_statustext_initial_color.getInterpolated_quadratic( m_statustext_initial_color, final_color, m_statustext_time / statustext_time_max); m_guitext_status->setOverrideColor(fade_color); m_guitext_status->enableOverrideColor(true); } }