Molybden API
Loading...
Searching...
No Matches
molybden::App Class Referenceabstract

Provides access to Molybden app. More...

#include <app.hpp>

Public Member Functions

virtual const AppOptionsoptions ()=0
 Returns the app options.
 
virtual bool isProduction ()=0
 Indicates whether the app is running in the production or development mode.
 
virtual std::string baseUrl ()=0
 Returns the base URL of the resource that represents app user interface.
 
virtual std::string name ()=0
 Returns the current application name.
 
virtual std::string version ()=0
 Returns the current application version.
 
virtual std::string copyright ()=0
 Returns the current application copyright.
 
virtual std::string description ()=0
 Returns the current application description.
 
virtual std::string getPath (PathKey key)=0
 Returns absolute path to the directory specified by the given key or an empty string if there's no such path for the given key.
 
virtual void restart ()=0
 Restarts this application.
 
virtual void quit ()=0
 Terminates this app instance.
 
virtual std::shared_ptr< Desktopdesktop ()=0
 Returns the desktop instance that provides functionality related to the desktop environment.
 
virtual std::shared_ptr< Dockdock ()=0
 Returns an object that allows working with the application icon in the Dock on macOS.
 
virtual void checkForUpdate (std::string source, CheckForUpdateCallback callback)=0
 Checks for an available update.
 
virtual std::shared_ptr< Profileprofile ()=0
 Returns the default app profile.
 
virtual std::shared_ptr< Profileprofile (const std::string &name)=0
 Returns the profile with the given name if it exists.
 
virtual std::vector< std::shared_ptr< Profile > > profiles ()=0
 Returns the list of the profiles in this app including the default profile.
 
virtual void deleteProfile (std::shared_ptr< Profile > profile)=0
 Deletes the given profile from the list of available profiles, closes all browsers associated with it, releases all allocated resources and files in the user data directory.
 
virtual std::vector< std::shared_ptr< Tray > > trays ()=0
 Returns the list of the available (non-destroyed) application trays.
 
virtual std::shared_ptr< Clipboardclipboard ()=0
 Returns an object that allows working with the system clipboard.
 
virtual void setMainMenu (std::shared_ptr< Menu > menu)=0
 Sets the given menu as the application menu on macOS.
 
virtual void setTheme (AppTheme theme)=0
 Sets the given theme to the app.
 
virtual AppTheme theme ()=0
 Returns the application theme.
 
virtual std::shared_ptr< GlobalShortcutsglobalShortcuts ()=0
 Returns an object that allows registering global shortcuts.
 

Static Public Member Functions

static void init (const std::function< void(std::shared_ptr< App > app)> &callback)
 Initializes this application and creates an application instance.
 
static void init (const AppOptions &options, const std::function< void(std::shared_ptr< App > app)> &callback)
 Initializes this application and creates an application instance with the given options.
 

Detailed Description

Provides access to Molybden app.

Member Function Documentation

◆ checkForUpdate()

virtual void molybden::App::checkForUpdate ( std::string  source,
CheckForUpdateCallback  callback 
)
pure virtual

Checks for an available update.

On macOS, the application can be updated only once per session. It means that if the update has been successfully installed via AppUpdate::install() the next check for update will fail with a request to restart the application. There is no way to skip an installed version.

Parameters
sourcea web server with files for application updates.
callbacka callback that is invoked when the check for an update finished.

◆ copyright()

virtual std::string molybden::App::copyright ( )
pure virtual

Returns the current application copyright.

The application copyright is taken from the molybden.conf.json file.

◆ deleteProfile()

virtual void molybden::App::deleteProfile ( std::shared_ptr< Profile profile)
pure virtual

Deletes the given profile from the list of available profiles, closes all browsers associated with it, releases all allocated resources and files in the user data directory.

When the profile is deleted, the cache files and preferences of the associated browsers are lost.

Does nothing if the given profile is already deleted or it is the default profile. The default profile cannot be deleted.

Parameters
profileprofile to delete.

◆ description()

virtual std::string molybden::App::description ( )
pure virtual

Returns the current application description.

The application description is taken from the molybden.conf.json file.

◆ dock()

virtual std::shared_ptr< Dock > molybden::App::dock ( )
pure virtual

Returns an object that allows working with the application icon in the Dock on macOS.

On other platforms, returns a valid object, but each method of the object will do nothing.

◆ name()

virtual std::string molybden::App::name ( )
pure virtual

Returns the current application name.

The application name is taken from the molybden.conf.json file.

◆ profile() [1/2]

virtual std::shared_ptr< Profile > molybden::App::profile ( )
pure virtual

Returns the default app profile.

The type of the default profile is configured via the AppOptions::enable_incognito property. If it is true, then the default profile will be an incognito profile, otherwise a regular profile.

◆ profile() [2/2]

virtual std::shared_ptr< Profile > molybden::App::profile ( const std::string &  name)
pure virtual

Returns the profile with the given name if it exists.

Parameters
namethe profile name.

◆ quit()

virtual void molybden::App::quit ( )
pure virtual

Terminates this app instance.

Closes all browser instances and releases the allocated resources.

◆ restart()

virtual void molybden::App::restart ( )
pure virtual

Restarts this application.

The new application instance will use the same working directory and the command line arguments as the current one.

◆ setTheme()

virtual void molybden::App::setTheme ( AppTheme  theme)
pure virtual

Sets the given theme to the app.

On macOS, the dark mode theme was introduced in 10.14 Mojave, so setting dark mode in 10.13 and lower changes only the web theme, the UI theme stays always light.

◆ theme()

virtual AppTheme molybden::App::theme ( )
pure virtual

Returns the application theme.

By default, the app theme is set to AppTheme::kSystem.

◆ version()

virtual std::string molybden::App::version ( )
pure virtual

Returns the current application version.

The application version is taken from the molybden.conf.json file. The returned string follows the major.minor.patch format.


The documentation for this class was generated from the following file: