This library contains platform-dependent code for cross-platform development. It provides a unified interface for working with different operating systems and platforms.
- Cross-Platform Support: Works with Android, iOS, macOS, Linux, and Windows
- Billing Interface: Unified interface for in-app purchases across platforms
- Platform Tools: Platform-specific utilities for system operations
- Modular Design: Easy to extend and integrate with other QuasarApp libraries
- Android - Full support with billing integration
- iOS - Full support with billing integration
- macOS - Full support for desktop applications
- Linux - Desktop platform support
- Windows - Desktop platform support
The library follows the interface-implementation pattern:
-
IBilling- Base interface for in-app purchasesgetItem(itemID)- Request purchase of an itemisSupported()- Check if billing is available on current platforminit()- Initialize the billing systemsigPurchaseReceived()- Signal emitted when purchase is completed
-
IPlatformTools- Base interface for platform-specific utilitiessetScreenDim(enable)- Enable/disable screen dimminggetAccessToWriteInStorage()- Request write access to external storagegetAccessToReadInStorage()- Request read access to external storage
AndroidPlatformTools- Android-specific implementationIOSPlatformTools- iOS-specific implementationOSXPlatformTools- macOS-specific implementationLinuxDesktopPlatfomTools- Linux desktop implementationWindowsDesktopPlatformTool- Windows desktop implementation
#include "qaplatforms.h"
// Initialize the platforms library
Platforms::init();
// Get version
QString version = Platforms::version();#include "qaplatforms.h"
#include <QObject>
class MyBilling : public Platforms::IBilling {
Q_OBJECT
public:
void init() override {
// Platform-specific initialization
}
void getItem(const QString &itemID) override {
// Request item purchase
}
bool isSupported() override {
return true;
}
};
// Get billing instance
auto billing = Platforms::IBilling::instance();
if (billing && billing->isSupported()) {
billing->getItem("item_id");
connect(billing, &Platforms::IBilling::sigPurchaseReceived,
[](const Platforms::Purchase &purchase) {
// Handle purchase
});
}#include "qaplatforms.h"
auto tools = Platforms::IPlatformTools::instance();
if (tools) {
tools->setScreenDim(true);
if (tools->getAccessToWriteInStorage()) {
// Can write to storage
}
if (tools->getAccessToReadInStorage()) {
// Can read from storage
}
}The library uses CMake for building. See the parent repository for build instructions.
mkdir build && cd build
cmake ..
makeThis library is distributed under the GPLv3 software license. See the LICENSE file for details.
Contributions are welcome! Please read our contributing guide before submitting pull requests.
For support and questions, please open an issue on the QuasarApp GitHub organization.