mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-23 19:22:35 +01:00
Add decrease of widget counter when the user presses close in the widget
This commit is contained in:
parent
bfd7a839de
commit
f1dd2ce33b
@ -84,6 +84,7 @@ App::App()
|
||||
m_profileListModel = make_shared<ProfileListModel>(m_globalVariables);
|
||||
m_sdkConnector = make_shared<SDKConnector>();
|
||||
m_settings = make_shared<Settings>(m_globalVariables);
|
||||
|
||||
// Only create tracker if user did not disallow!
|
||||
if (m_settings->anonymousTelemetry()) {
|
||||
m_telemetry = make_shared<GAnalytics>("UA-152830367-3");
|
||||
@ -95,6 +96,7 @@ App::App()
|
||||
|
||||
m_create = make_unique<Create>(m_globalVariables);
|
||||
m_screenPlayManager = make_unique<ScreenPlayManager>(m_globalVariables, m_monitorListModel, m_sdkConnector, m_telemetry);
|
||||
QObject::connect(m_sdkConnector.get(), &SDKConnector::requestDecreaseWidgetCount, m_screenPlayManager.get(), &ScreenPlayManager::decreaseActiveWidgetsCounter);
|
||||
|
||||
// When the installed storage path changed
|
||||
QObject::connect(m_settings.get(), &Settings::resetInstalledListmodel, m_installedListModel.get(), &InstalledListModel::reset);
|
||||
|
@ -54,33 +54,6 @@ public:
|
||||
return m_activeWidgetsCounter;
|
||||
}
|
||||
|
||||
void increaseActiveWidgetsCounter()
|
||||
{
|
||||
m_activeWidgetsCounter++;
|
||||
emit activeWidgetsCounterChanged(m_activeWidgetsCounter);
|
||||
}
|
||||
|
||||
void decreaseActivewidgetsCounter()
|
||||
{
|
||||
m_activeWidgetsCounter--;
|
||||
emit activeWidgetsCounterChanged(m_activeWidgetsCounter);
|
||||
}
|
||||
|
||||
void increaseActiveWallpaperCounter()
|
||||
{
|
||||
m_activeWallpaperCounter++;
|
||||
emit activeWallpaperCounterChanged(m_activeWallpaperCounter);
|
||||
}
|
||||
|
||||
void decreaseActiveWallpaperCounter()
|
||||
{
|
||||
if (m_activeWallpaperCounter <= 0) {
|
||||
return;
|
||||
}
|
||||
m_activeWallpaperCounter--;
|
||||
emit activeWallpaperCounterChanged(m_activeWallpaperCounter);
|
||||
}
|
||||
|
||||
signals:
|
||||
void projectSettingsListModelFound(ProjectSettingsListModel* li, const QString& type);
|
||||
void projectSettingsListModelNotFound();
|
||||
@ -95,7 +68,7 @@ public slots:
|
||||
const QString& fillMode,
|
||||
const QString& type, const bool saveToProfilesConfigFile = true);
|
||||
|
||||
void createWidget(const QUrl& absoluteStoragePath, const QString& previewImage, const QString &type);
|
||||
void createWidget(const QUrl& absoluteStoragePath, const QString& previewImage, const QString& type);
|
||||
|
||||
void removeAllWallpapers();
|
||||
void removeAllWidgets();
|
||||
@ -124,6 +97,36 @@ public slots:
|
||||
emit activeWidgetsCounterChanged(m_activeWidgetsCounter);
|
||||
}
|
||||
|
||||
void increaseActiveWidgetsCounter()
|
||||
{
|
||||
m_activeWidgetsCounter++;
|
||||
emit activeWidgetsCounterChanged(m_activeWidgetsCounter);
|
||||
}
|
||||
|
||||
void decreaseActiveWidgetsCounter()
|
||||
{
|
||||
if (m_activeWidgetsCounter <= 0) {
|
||||
return;
|
||||
}
|
||||
m_activeWidgetsCounter--;
|
||||
emit activeWidgetsCounterChanged(m_activeWidgetsCounter);
|
||||
}
|
||||
|
||||
void increaseActiveWallpaperCounter()
|
||||
{
|
||||
m_activeWallpaperCounter++;
|
||||
emit activeWallpaperCounterChanged(m_activeWallpaperCounter);
|
||||
}
|
||||
|
||||
void decreaseActiveWallpaperCounter()
|
||||
{
|
||||
if (m_activeWallpaperCounter <= 0) {
|
||||
return;
|
||||
}
|
||||
m_activeWallpaperCounter--;
|
||||
emit activeWallpaperCounterChanged(m_activeWallpaperCounter);
|
||||
}
|
||||
|
||||
private:
|
||||
void loadWallpaperProfiles();
|
||||
bool saveWallpaperProfile(const QString& profileName, const QJsonObject& content);
|
||||
|
@ -35,7 +35,9 @@ void SDKConnector::readyRead()
|
||||
*/
|
||||
void SDKConnector::newConnection()
|
||||
{
|
||||
m_clients.append(make_shared<SDKConnection>(m_server->nextPendingConnection()));
|
||||
auto connection = make_shared<SDKConnection>(m_server->nextPendingConnection());
|
||||
QObject::connect(connection.get(),&SDKConnection::requestDecreaseWidgetCount,this,&SDKConnector::requestDecreaseWidgetCount);
|
||||
m_clients.append(connection);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -27,9 +27,13 @@ using std::make_unique,
|
||||
|
||||
class SDKConnector : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SDKConnector(QObject* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void requestDecreaseWidgetCount();
|
||||
|
||||
public slots:
|
||||
void readyRead();
|
||||
void newConnection();
|
||||
@ -99,8 +103,8 @@ signals:
|
||||
void requestCloseAt(int at);
|
||||
void appIDChanged(QString appID);
|
||||
void monitorChanged(QVector<int> monitor);
|
||||
|
||||
void typeChanged(QString type);
|
||||
void requestDecreaseWidgetCount();
|
||||
|
||||
public slots:
|
||||
void readyRead()
|
||||
@ -146,6 +150,9 @@ public slots:
|
||||
|
||||
qDebug() << "### Destroy APPID:\t " << m_appID << " State: " << m_socket->state();
|
||||
}
|
||||
if(m_type.contains("widget",Qt::CaseInsensitive)){
|
||||
emit requestDecreaseWidgetCount();
|
||||
}
|
||||
}
|
||||
|
||||
void setAppID(QString appID)
|
||||
|
Loading…
Reference in New Issue
Block a user