// // ClientKitApi.h // #ifndef ClientKitApi_h #define ClientKitApi_h #include <QObject> #include <QVariant> #include <QStringList> #include <QMap> #include "KCommon.h" class MainWindow; class QString; class Connection { public: QString port; QString user; QString client; QString charset; bool isEmpty() {return port.isEmpty() || user.isEmpty();} void clear() {port = QString(); user = QString(); client = QString(); charset = QString();} }; class ClientKitApi : public QObject { Q_OBJECT public: ClientKitApi (QObject* /*parent*/, MainWindow* mainWindow, QString myJSPointerName); virtual ~ClientKitApi() {} // These define the API as seen by the JS Q_INVOKABLE QString getPort() {return mConnection.port;} // Should decide if is this is supposed to read from the clientapi or just the cached values Q_INVOKABLE QString getUser() {return mConnection.user;} // Because we always set this right before we run a command, the cached values are accurate Q_INVOKABLE QString getClient() {return mConnection.client;} // Could be changed to be more like other derived APIs Q_INVOKABLE QString getCharset() {return mConnection.charset;} Q_INVOKABLE void setPort(const QString& p) {updateConnection(p, "", "");} // move the update logic into the connection class Q_INVOKABLE void setUser(const QString& u) {updateConnection("", u, "");} Q_INVOKABLE void setClient(const QString& c) {updateConnection("", "", c);} Q_INVOKABLE void setCharset(const QString& cs) {mConnection.charset = cs;} Q_INVOKABLE void setInput(const QString& inputForm) {mInputForm = inputForm;} Q_INVOKABLE QVariant run(const QString& command); // Run a command on a Perforce server from JavaScript Q_INVOKABLE QVariant run(const QVariantList& cmdTokens); Q_INVOKABLE QVariant run(const QString& command, const QVariantList& args); // perhaps (command, args, form, callback) // and (command, args, callback) Q_INVOKABLE QString createP4(const QString& p4PointerName); // Create a new P4 object in the JavaScript // file/dir i/o api Q_INVOKABLE QVariant readFile(const QString& fname); Q_INVOKABLE bool createFile(const QString& filename, const QString& fileContents); Q_INVOKABLE QString getConfig(); Q_INVOKABLE QVariant currentDir(); Q_INVOKABLE QVariant applicationPath(); Q_INVOKABLE QVariant ls(const QString& dirname); Q_INVOKABLE QVariant ls(const QString& dirname, bool fileInfo); Q_INVOKABLE QString startProcess(const QString& program, const QStringList& arguments); // container specific api, query and control the frame of the container Q_INVOKABLE QVariant getWindowSize(); Q_INVOKABLE void setWindowSize(const int& x, const int& y); Q_INVOKABLE void setWindowStyle(const QString& styleName); Q_INVOKABLE QString getWindowStyle(); Q_INVOKABLE QStringList getWindowStyles(); Q_INVOKABLE void setWindowTitle(const QString & windowTitle); // misc Q_INVOKABLE bool openUrlInBrowser(QString str); // This is useful for opening, e.g., a help page (opens in system default browser) Q_INVOKABLE QVariant getSystemLocale(); Q_INVOKABLE QString getApiVersion() { return ".1"; } // pre-alpha // not part of ClientKitApi exposed to JavaScript Connection connection() {return mConnection;} void setConnection(Connection con) {mConnection = con;} QString inputData(); QStringList* errorList() {return &mErrorList;} private: MainWindow* mMainWindow; Connection mConnection; // port, user, client QStringList mP4PointersList; QString mInputForm; // used for commands with -i QStringList mErrorList; // todo: Should change to a QVariantList? QString mMyJSPointerName; bool updateConnection(QString p, QString u, QString c); // returns true if any changes made }; #endif // ClientKitApi_h
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 8102 | David George | clean up | ||
#4 | 8101 | David George |
beginning of _massive_ re-factoring your current build settings will fail create a new project from newly added .pro file (but change its p4api paths to match your old one) look for updated README as soon as Dave agrees that changes are _indeed_ for the best (Changes by Jaimen) |
||
#3 | 8100 | David George | Added deleteP4, so that mainwindow's deleteClientKitApi is invocable with JavaScript. | ||
#2 | 8086 | David George | A slew of changes initially done on the internal Perforce server, including async and native file/folder launching. | ||
#1 | 8083 | David George |
Merging //guest/james_creasy/ClientKit/... to //guest/david_george/ClientKit/... This merge also includes changes grabbed from the internal Perforce depot. |
||
//guest/james_creasy/ClientKit/ClientKitApi.h | |||||
#1 | 8060 | james_creasy | Client Kit for Perforce |