mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-13 21:18:01 +03:00
support pausing activities from main config window
This commit is contained in:
parent
e3b398bee7
commit
2327965c24
@ -841,6 +841,16 @@ void LatteConfigDialog::on_switchButton_clicked()
|
||||
updatePauseButtonState();
|
||||
}
|
||||
|
||||
void LatteConfigDialog::on_pauseButton_clicked()
|
||||
{
|
||||
QString id = m_model->data(m_model->index(ui->layoutsView->currentIndex().row(), IDCOLUMN), Qt::DisplayRole).toString();
|
||||
Layout *layout = m_layouts[id];
|
||||
|
||||
if (layout) {
|
||||
m_corona->layoutManager()->pauseLayout(layout->name());
|
||||
}
|
||||
}
|
||||
|
||||
void LatteConfigDialog::layoutsChanged()
|
||||
{
|
||||
for (int i = 0; i < m_model->rowCount(); ++i) {
|
||||
|
@ -62,6 +62,7 @@ private slots:
|
||||
void on_newButton_clicked();
|
||||
void on_copyButton_clicked();
|
||||
void on_downloadButton_clicked();
|
||||
void on_pauseButton_clicked();
|
||||
void on_removeButton_clicked();
|
||||
void on_switchButton_clicked();
|
||||
void on_importButton_clicked();
|
||||
|
@ -718,8 +718,16 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
//! is such case we just activate these Activities
|
||||
Layout layout(this, Importer::layoutFilePath(layoutName));
|
||||
|
||||
int i = 0;
|
||||
|
||||
foreach (auto assignedActivity, layout.activities()) {
|
||||
m_activitiesController->startActivity(assignedActivity);
|
||||
//! Starting the activities must be done asynchronous because otherwise
|
||||
//! the activity manager cant close multiple activities
|
||||
QTimer::singleShot(i * 1000, [this, assignedActivity]() {
|
||||
m_activitiesController->startActivity(assignedActivity);
|
||||
});
|
||||
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
m_activitiesController->setCurrentActivity(layout.activities()[0]);
|
||||
@ -838,6 +846,27 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
emit activeLayoutsChanged();
|
||||
}
|
||||
|
||||
void LayoutManager::pauseLayout(QString layoutName)
|
||||
{
|
||||
if (memoryUsage() == Dock::MultipleLayouts) {
|
||||
Layout *layout = activeLayout(layoutName);
|
||||
|
||||
if (layout && !layout->activities().isEmpty()) {
|
||||
int i = 0;
|
||||
|
||||
foreach (auto activityId, layout->activities()) {
|
||||
//! Stopping the activities must be done asynchronous because otherwise
|
||||
//! the activity manager cant close multiple activities
|
||||
QTimer::singleShot(i * 1000, [this, activityId]() {
|
||||
m_activitiesController->stopActivity(activityId);
|
||||
});
|
||||
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::syncActiveLayoutsToOriginalFiles()
|
||||
{
|
||||
if (memoryUsage() == Dock::MultipleLayouts) {
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
void loadLayoutOnStartup(QString layoutName);
|
||||
void unload();
|
||||
void addDock(Plasma::Containment *containment, bool forceLoading = false, int expDockScreen = -1);
|
||||
void pauseLayout(QString layoutName);
|
||||
void recreateDock(Plasma::Containment *containment);
|
||||
void syncDockViewsToScreens();
|
||||
void syncActiveLayoutsToOriginalFiles();
|
||||
|
Loading…
Reference in New Issue
Block a user