Hey guys,<div><br></div><div>I think I am doing a stupid C++ mistake here: I get the follwing error:</div><div><br></div><div>mediacontainment.cpp:76: undefined reference to 'MediaCenter::MediaCenter::State::MediaCenterState(QState*)</div>
<div><br></div><div>The last line of this mail causes the error.</div><div><br></div><div><br></div><div>Here is mediacenterstate.h</div><div><br></div><div><div>#ifndef MEDIACENTERSTATE_H</div><div>#define MEDIACENTERSTATE_H</div>
<div><br></div><div>#include "libs/mediacenter/mediacenter.h"</div><div>#include "libs/mediacenter/mediacenter_export.h"</div><div><br></div><div>#include <QtCore/qabstractstate.h></div><div>#include <QGraphicsWidget></div>
<div><br></div><div>#include <Plasma/IconWidget></div><div><br></div><div>namespace MediaCenter {</div><div> </div><div>enum State {</div><div> PictureMode,</div><div> MusicMode,</div><div> VideoMode,</div>
<div> Home</div><div>};</div><div><br></div><div>enum MainSubComponent {</div><div> JumpToVideoState,</div><div> JumpToMusicState,</div><div> JumpToPictureState,</div><div> JumpToHome,</div><div> ToggleControlBarAutohide,</div>
<div> ToggleInfoBarAutohide</div><div>};</div><div> </div><div>class MEDIACENTER_EXPORT MediaCenterState : public QAbstractState</div><div>{</div><div> Q_OBJECT</div><div>public:</div><div> MediaCenterState(QState *parent = 0);</div>
<div> virtual ~MediaCenterState();</div><div><br></div><div> QGraphicsWidget *subComponent(MainSubComponent c);</div><div><br></div><div>protected:</div><div> void onExit(QEvent* event);</div><div> void onEntry(QEvent* event);</div>
<div><br></div><div> Plasma::IconWidget *m_jumpToHome;</div><div>};</div><div><br></div><div>} //namespace MediaCenter</div><div>#endif // MEDIACENTERSTATE_H</div><div><br><div class="gmail_quote">here is mediacenterstate.cpp</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><div class="gmail_quote">#include "mediacenterstate.h"</div><div class="gmail_quote"><br></div><div class="gmail_quote">using namespace MediaCenter;</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">MediaCenterState::MediaCenterState (QState *parent) : QAbstractState(parent),</div><div class="gmail_quote"> m_jumpToHome(new Plasma::IconWidget())</div><div class="gmail_quote">
{</div><div class="gmail_quote">}</div><div class="gmail_quote"><br></div><div class="gmail_quote">MediaCenterState::~MediaCenterState()</div><div class="gmail_quote">{</div><div class="gmail_quote">}</div><div class="gmail_quote">
<br></div><div class="gmail_quote">void MediaCenterState::onExit(QEvent *event)</div><div class="gmail_quote">{</div><div class="gmail_quote"> Q_UNUSED(event);</div><div class="gmail_quote">}</div><div class="gmail_quote">
<br></div><div class="gmail_quote">void MediaCenterState::onEntry(QEvent *event)</div><div class="gmail_quote">{</div><div class="gmail_quote"> Q_UNUSED(event);</div><div class="gmail_quote">}</div><div class="gmail_quote">
<br></div><div class="gmail_quote">QGraphicsWidget *MediaCenterState::subComponent(MediaCenter::MainSubComponent c)</div><div class="gmail_quote">{</div><div class="gmail_quote"> if (c == MediaCenter::JumpToHome) {</div>
<div class="gmail_quote"> m_jumpToHome->setIcon("User-Folder");</div><div class="gmail_quote"> return m_jumpToHome;</div><div class="gmail_quote"> }</div><div class="gmail_quote">}</div><div>
<br></div><div><br></div><div>here is mediacontainment.h</div><div><br></div><div><div>#ifndef MEDIACONTAINMENT_H</div><div>#define MEDIACONTAINMENT_H</div><div><br></div><div>#include "mediacenter/mediacenter.h"</div>
<div>#include "states/mediacenterstate.h"</div><div><br></div><div>#include <Plasma/Containment></div><div>#include <QList></div><div><br></div><div>class QAction;</div><div>class QPointF;</div><div>
namespace MediaCenter {</div><div> class Browser;</div><div> class PlaybackControl;</div><div> class Playlist;</div><div> class Player;</div><div> class PictureState;</div><div> class VideoState;</div><div>
}</div><div><br></div><div>class MediaLayout;</div><div><br></div><div>class MediaContainment : public Plasma::Containment</div><div>{</div><div> Q_OBJECT</div><div>public:</div><div> MediaContainment(QObject *parent, const QVariantList &args);</div>
<div> ~MediaContainment();</div><div><br></div><div> QList<QAction*> contextualActions();</div><div><br></div><div> MediaCenter::State currentState();</div><div> void setCurrentState(MediaCenter::State);</div>
<div><br></div><div> QList<QGraphicsWidget*> currentMainComponents();</div><div> void addCurrentMainComponent(QGraphicsWidget*);</div><div><br></div><div> QList<QGraphicsWidget*> currentSubComponents();</div>
<div> void addCurrentSubComponent(QGraphicsWidget*);</div><div><br></div><div>protected:</div><div> void constraintsEvent(Plasma::Constraints constraints);</div><div><br></div><div>private slots:</div><div> void slotAppletAdded(Plasma::Applet *applet, const QPointF &pos);</div>
<div> void slotAppletRemoved(Plasma::Applet *applet);</div><div> void switchState(MediaCenter::State);</div><div><br></div><div> void switchToPictureState();</div><div> void switchToVideoState();</div><div> void switchToMusicState();</div>
<div><br></div><div>private:</div><div> MediaCenter::Browser *m_browser;</div><div> MediaCenter::PlaybackControl *m_control;</div><div> MediaCenter::Playlist *m_playlist;</div><div> MediaCenter::Player *m_player;</div>
<div><br></div><div> MediaCenter::State m_currentState;</div><div> MediaCenter::State m_previousState;</div><div><br></div><div> MediaCenter::MediaCenterState *m_mediaCenterState;</div><div> MediaCenter::VideoState *m_videoState;</div>
<div> MediaCenter::PictureState *m_pictureState;</div><div><br></div><div> QList<QGraphicsWidget*> m_currentMainComponents;</div><div> QList<QGraphicsWidget*> m_currentSubComponents;</div><div><br></div>
<div> bool m_musicIsPlaying;</div><div><br></div><div> MediaLayout *m_layout;</div><div><br></div><div> void addMediaApplet(Plasma::Applet *);</div><div><br></div><div> void initControls();</div><div> void connectControls(MediaCenter::State);</div>
<div><br></div><div> //we need these to give full control to the containment and avoid cycling signals with the controller</div><div> //the controller's buttons are connected to these</div><div> void controlBarToPictureState();</div>
<div> void controlBarToVideoState();</div><div> void controlBarToMusicState();</div><div><br></div><div> void startStateMachine();</div><div>};</div><div><br></div><div><br></div><div>and here the relevant part of mediacontainment.cpp</div>
<div><br></div><div><div>#include "mediacontainment.h"</div><div>#include "medianotificationwidget.h"</div><div>#include "medialayout.h"</div><div>#include "mediatoolbox.h"</div><div>
<br></div><div>#include <mediacenter/browser.h></div><div>#include <mediacenter/playbackcontrol.h></div><div>#include <mediacenter/playlist.h></div><div>#include <mediacenter/player.h></div><div><br>
</div><div>#include <states/videostate.h></div><div>#include <states/picturestate.h></div><div><br></div><div>// Qt</div><div>#include <QAction></div><div>#include <QStateMachine></div><div><br></div>
<div>// KDE</div><div>#include <KDebug></div><div>#include <KNotification></div><div>#include <KLocale></div><div><br></div><div>static const int BROWSER_WIDTH = 300;</div><div>static const int BROWSER_HEIGHT = 100;</div>
<div><br></div><div><br></div><div>K_EXPORT_PLASMA_APPLET(mediacontainment, MediaContainment)</div><div><br></div><div>MediaContainment::MediaContainment(QObject *parent, const QVariantList &args) : Plasma::Containment(parent, args),</div>
<div>m_browser(0),</div><div>m_control(0),</div><div>m_playlist(0),</div><div>m_player(0),</div><div>m_pictureState(0),</div><div>m_currentState(MediaCenter::PictureMode),</div><div>m_previousState(MediaCenter::PictureMode),</div>
<div>m_musicIsPlaying(false),</div><div>m_layout(new MediaLayout(this))</div><div>{</div><div> setContainmentType(Plasma::Containment::CustomContainment);</div><div> setHasConfigurationInterface(true);</div><div> setAcceptHoverEvents(true);</div>
<div> setToolBox(new MediaToolBox(this));</div><div><br></div><div> connect (toolBox(), SIGNAL(toggled()), m_layout, SLOT(toggleShowAllMediaApplets()));</div><div>}</div><div><br></div><div>MediaContainment::~MediaContainment()</div>
<div>{}</div><div><br></div><div>void MediaContainment::startStateMachine()</div><div>{</div><div> //Prepare StateMachine</div><div> QStateMachine machine; //this is not a pointer</div><div><br></div><div> //Set up all possible states</div>
<div> m_mediaCenterState = new MediaCenter::MediaCenterState(); //these are pointers</div></div></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div class="h5"><br>
</div></div></blockquote></div><br></div></div>