Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] GUI plugin problems

[Solved] GUI plugin problems

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 3.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Techfix
    wrote on last edited by
    #1

    Hi,
    I am trying to develop a plugin system for the OpenRcon Project (http://openrcon.org/). We need to be able to create a dynamic plugin that has a ui in it. I have been following the echo plugin example http://doc.trolltech.com/4.3/tools-echoplugin.html but when i compile it i get this message "expected constructor, destructor or type convention before '(' token ". The code it is referring to is the .CPP file of the plugin where i have the Q_EXPORT_PLUGIN2(orplugin, ORPLUGIN_LIBRARY) macro.

    Can anyway explain why this is happening? Or how do i fix it?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      I think it's something inside your code. But as my mystic orb is not here at the moment, it could help if you show your code. Perhaps then we cann see something...

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Techfix
        wrote on last edited by
        #3

        Interface:
        @/*
        Copyright (C) 2010 The OpenRcon Project.

        This file is part of OpenRcon.

        OpenRcon is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        OpenRcon is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with OpenRcon. If not, see http://www.gnu.org/licenses/.
        /
        #ifndef ORPLUGININTERFACE_H
        #define ORPLUGININTERFACE_H
        //
        #include <QString>
        #include <QIcon>
        #include <QtGlobal>
        /

        • Interface defined for the plugin system of openrcon.
          /
          class orPluginInterface
          {
          public:
          /
          • Plugin Manager checks this first to make sure that the plugin is designed for openrcon.
          • IF plugin returns false OR doesn't exist THEN the plugin is unloaded
            /
            virtual bool isPluginOR();
            /
          • The openrcon toolbar widgets are enabled/disabled based the return value of the following.
          • This allows the developer to specifiy the fields that the plugin uses.
            */
            virtual bool isUserAllowedToSetPortNumber();
            virtual bool isUserAllowedToSetUsername();
            virtual bool isUserAllowedToSetPassword();
            // Allows Plugin Manager to check if plugin is enabled.
            virtual bool isEnabled();
            // Allows Plugin Manager to check if plugin has been (officially) signed by the openrcon.
            virtual bool isSigned();
            // Controls the connection and Enables/Disables the plugin.
            virtual qint32 openConnection(QString hostURI, quint32 portNumber, QString username, QString password);
            virtual qint32 closeConnection();
            virtual qint32 enable();
            virtual qint32 disable();
            // Plugin details:
            virtual QString getName();
            virtual QString getVersion();
            virtual QString getDescription();
            virtual QString getDeveloper();
            virtual QString getDeveloperWebsite();
            virtual QString getDeveloperSupportLink();
            virtual QString getPluginSystemVersion();
            virtual QString getPluginSystemType(); // Defines the type of functionality the plugin extends
            virtual QString getSignature();
            virtual QString getPluginDefaultPortNumber();
            virtual QString getConnectionStatus();
            virtual QIcon getIcon();
            };
            Q_DECLARE_INTERFACE(orPluginInterface, "com.trolltech.Plugin.orPluginInterface/1.0");
            #endif // ORPLUGININTERFACE_H
            @

        orPlugin.h:
        @/*
        Copyright (C) 2010 The OpenRcon Project.

        This file is part of OpenRcon.

        OpenRcon is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        OpenRcon is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with OpenRcon. If not, see http://www.gnu.org/licenses/.
        */
        #ifndef ORPLUGIN_H
        #define ORPLUGIN_H

        #include "orPlugin_global.h"
        #include "orplugininterface.h"

        class ORPLUGINSHARED_EXPORT orPlugin : public QObject, orPluginInterface {
        Q_OBJECT
        Q_INTERFACES(orPluginInterface)
        public:
        bool isPluginOR();

        private:

        };

        #endif // ORPLUGIN_H
        @

        orPlugin.cpp:
        @/*
        Copyright (C) 2010 The OpenRcon Project.

        This file is part of OpenRcon.

        OpenRcon is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        OpenRcon is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with OpenRcon. If not, see http://www.gnu.org/licenses/.
        */
        #include "orplugin.h"
        bool orPlugin::isPluginOR()
        {
        return true;
        }

        Q_EXPORT_PLUGIN2(orplugin, ORPLUGIN_LIBRARY);
        @

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dangelog
          wrote on last edited by
          #4

          Why the methods in the interface aren't pure? And, you're missing a "public" before orPluginInterface in orPlugin.h.

          Software Engineer
          KDAB (UK) Ltd., a KDAB Group company

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Techfix
            wrote on last edited by
            #5

            I was following the echo plugin example. I have added public orPluginInterface to or plugin.h does make a difference and made the functions to pure virtual. But still they same problem. I also have a orPlugin_global.h file

            @#ifndef ORPLUGIN_GLOBAL_H
            #define ORPLUGIN_GLOBAL_H

            #include <QtCore/qglobal.h>

            #if defined(ORPLUGIN_LIBRARY)

            define ORPLUGINSHARED_EXPORT Q_DECL_EXPORT

            #else

            define ORPLUGINSHARED_EXPORT Q_DECL_IMPORT

            #endif

            #endif // ORPLUGIN_GLOBAL_H@

            Does that matter?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              giesbert
              wrote on last edited by
              #6

              Your bug is clear:
              C++ is case sensitive:

              @
              Q_EXPORT_PLUGIN2(orPlugin, ORPLUGIN_LIBRARY);
              @

              orPlugin != orplugin :-)

              Nokia Certified Qt Specialist.
              Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

              1 Reply Last reply
              0
              • T Offline
                T Offline
                Techfix
                wrote on last edited by
                #7

                I didn't notice that, But now i am getting the same problem, and now QT creator expected identifier before numeric constant.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  giesbert
                  wrote on last edited by
                  #8

                  If you look at teh "docs":http://doc.qt.nokia.com/4.7/qtplugin.html#Q_EXPORT_PLUGIN2 you find the second problem:

                  Q_EXPORT_PLUGIN2 ( PluginName, ClassName )

                  Where is your class ORPLUGIN_LIBRARY ?

                  Nokia Certified Qt Specialist.
                  Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    Techfix
                    wrote on last edited by
                    #9

                    Fixed it !!! thanks for your help

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved