mirror of
https://github.com/vicr123/theshell.git
synced 2025-01-23 12:12:06 -05:00
Merge branch 'refs/heads/master' into blueprint
This commit is contained in:
commit
78c9670bcc
3 changed files with 53 additions and 9 deletions
|
@ -161,6 +161,33 @@ InfoPaneDropdown::InfoPaneDropdown(WId MainWindowId, QWidget *parent) :
|
||||||
|
|
||||||
updateBatteryChart();
|
updateBatteryChart();
|
||||||
|
|
||||||
|
//Check Redshift
|
||||||
|
QProcess* redshiftQuery = new QProcess;
|
||||||
|
redshiftQuery->start("redshift -V");
|
||||||
|
connect(redshiftQuery, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus) {
|
||||||
|
QString output = redshiftQuery->readAll().trimmed();
|
||||||
|
output.remove("redshift ");
|
||||||
|
|
||||||
|
QStringList parts = output.split(".");
|
||||||
|
for (int i = 0; i < parts.count(); i++) {
|
||||||
|
int version = parts.at(i).toInt();
|
||||||
|
if (i == 0) {
|
||||||
|
if (version > 1) {
|
||||||
|
break;
|
||||||
|
} else if (version < 1) {
|
||||||
|
isNewRedshift = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (i == 1) {
|
||||||
|
if (version < 11) {
|
||||||
|
isNewRedshift = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
redshiftQuery->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
//Set up KDE Connect
|
//Set up KDE Connect
|
||||||
if (!QFile("/usr/lib/kdeconnectd").exists()) {
|
if (!QFile("/usr/lib/kdeconnectd").exists()) {
|
||||||
//If KDE Connect is not installed, hide the KDE Connect option
|
//If KDE Connect is not installed, hide the KDE Connect option
|
||||||
|
@ -721,8 +748,8 @@ void InfoPaneDropdown::processTimer() {
|
||||||
int endMsecs = ui->endRedshift->time().msecsSinceStartOfDay();
|
int endMsecs = ui->endRedshift->time().msecsSinceStartOfDay();
|
||||||
int endIntensity = ui->redshiftIntensity->value();
|
int endIntensity = ui->redshiftIntensity->value();
|
||||||
const int oneHour = 3600000;
|
const int oneHour = 3600000;
|
||||||
QProcess* redshiftAdjust = new QProcess;
|
QString redshiftCommand;
|
||||||
connect(redshiftAdjust, SIGNAL(finished(int)), redshiftAdjust, SLOT(deleteLater()));
|
|
||||||
if (ui->redshiftPause->isChecked()) {
|
if (ui->redshiftPause->isChecked()) {
|
||||||
//Calculate redshift value
|
//Calculate redshift value
|
||||||
//Transition to redshift is 1 hour from the start.
|
//Transition to redshift is 1 hour from the start.
|
||||||
|
@ -777,7 +804,7 @@ void InfoPaneDropdown::processTimer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
redshiftAdjust->start("redshift -O " + QString::number(intensity));
|
redshiftCommand = "redshift -O " + QString::number(intensity);
|
||||||
|
|
||||||
isRedshiftOn = true;
|
isRedshiftOn = true;
|
||||||
if (intensity == 6500 && effectiveRedshiftOn) {
|
if (intensity == 6500 && effectiveRedshiftOn) {
|
||||||
|
@ -792,9 +819,9 @@ void InfoPaneDropdown::processTimer() {
|
||||||
} else {
|
} else {
|
||||||
//Check Redshift Override
|
//Check Redshift Override
|
||||||
if (overrideRedshift == 2) {
|
if (overrideRedshift == 2) {
|
||||||
redshiftAdjust->start("redshift -O " + QString::number(endIntensity));
|
redshiftCommand = "redshift -O " + QString::number(endIntensity);
|
||||||
} else {
|
} else {
|
||||||
redshiftAdjust->start("redshift -O 6500");
|
redshiftCommand = "redshift -O 6500";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRedshiftOn) {
|
if (isRedshiftOn) {
|
||||||
|
@ -804,6 +831,14 @@ void InfoPaneDropdown::processTimer() {
|
||||||
emit redshiftEnabledChanged(false);
|
emit redshiftEnabledChanged(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isNewRedshift) {
|
||||||
|
redshiftCommand += " -P";
|
||||||
|
}
|
||||||
|
|
||||||
|
QProcess* redshiftAdjust = new QProcess();
|
||||||
|
redshiftAdjust->start(redshiftCommand);
|
||||||
|
connect(redshiftAdjust, SIGNAL(finished(int)), redshiftAdjust, SLOT(deleteLater()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*{
|
/*{
|
||||||
|
@ -1336,13 +1371,21 @@ void InfoPaneDropdown::on_endRedshift_timeChanged(const QTime &time)
|
||||||
|
|
||||||
void InfoPaneDropdown::on_redshiftIntensity_sliderMoved(int position)
|
void InfoPaneDropdown::on_redshiftIntensity_sliderMoved(int position)
|
||||||
{
|
{
|
||||||
QProcess::startDetached("redshift -O " + QString::number(position));
|
if (isNewRedshift) {
|
||||||
|
QProcess::startDetached("redshift -P -O " + QString::number(position));
|
||||||
|
} else {
|
||||||
|
QProcess::startDetached("redshift -O " + QString::number(position));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoPaneDropdown::on_redshiftIntensity_sliderReleased()
|
void InfoPaneDropdown::on_redshiftIntensity_sliderReleased()
|
||||||
{
|
{
|
||||||
if (!isRedshiftOn) {
|
if (!isRedshiftOn) {
|
||||||
QProcess::startDetached("redshift -O 6500");
|
if (isNewRedshift) {
|
||||||
|
QProcess::startDetached("redshift -P -O 6500");
|
||||||
|
} else {
|
||||||
|
QProcess::startDetached("redshift -O 6500");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -504,6 +504,7 @@ class InfoPaneDropdown : public QDialog
|
||||||
Ui::InfoPaneDropdown *ui;
|
Ui::InfoPaneDropdown *ui;
|
||||||
|
|
||||||
bool isRedshiftOn = false;
|
bool isRedshiftOn = false;
|
||||||
|
bool isNewRedshift = true;
|
||||||
dropdownType currentDropDown = Clock;
|
dropdownType currentDropDown = Clock;
|
||||||
void changeDropDown(dropdownType changeTo, bool doAnimation = true);
|
void changeDropDown(dropdownType changeTo, bool doAnimation = true);
|
||||||
int mouseClickPoint;
|
int mouseClickPoint;
|
||||||
|
|
|
@ -44,7 +44,7 @@ void NotificationsDBusAdaptor::CloseNotification(uint id)
|
||||||
NotificationObject* notification = this->parentWidget()->getNotification(id);
|
NotificationObject* notification = this->parentWidget()->getNotification(id);
|
||||||
notification->dismiss();
|
notification->dismiss();
|
||||||
} else {
|
} else {
|
||||||
|
//ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ QStringList NotificationsDBusAdaptor::GetCapabilities()
|
||||||
QString NotificationsDBusAdaptor::GetServerInformation(QString &vendor, QString &version, QString &spec_version)
|
QString NotificationsDBusAdaptor::GetServerInformation(QString &vendor, QString &version, QString &spec_version)
|
||||||
{
|
{
|
||||||
vendor = "theSuite";
|
vendor = "theSuite";
|
||||||
version = QString(TS_VERSION);
|
version = TS_VERSION;
|
||||||
spec_version = "1.2";
|
spec_version = "1.2";
|
||||||
return "theShell";
|
return "theShell";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue