Discontinue theWave

This commit is contained in:
Victor Tran 2017-11-07 22:23:15 +11:00
parent f0c50550e8
commit c7a8f93374
22 changed files with 115 additions and 4498 deletions

View file

@ -70,158 +70,6 @@ void AppsListModel::search(QString query) {
}
}
bool showtheWaveOption = true;
/*if (settings.value("thewave/enabled", true).toBool()) {
if (arg1.toLower() == "emergency call") {
QListWidgetItem *callItem = new QListWidgetItem();
callItem->setText(tr("Place a call"));
callItem->setIcon(QIcon::fromTheme("call-start"));
callItem->setData(Qt::UserRole, "thewave:emergency call");
ui->listWidget->addItem(callItem);
QListWidgetItem *call = new QListWidgetItem();
call->setText(tr("Emergency Call"));
call->setData(Qt::UserRole, "thewave:emergency call");
call->setIcon(QIcon(":/icons/blank.svg"));
QFont font = call->font();
font.setPointSize(30);
call->setFont(font);
ui->listWidget->addItem(call);
showtheWaveOption = false;
} else if ((arg1.startsWith("call") && arg1.count() == 4) || arg1.startsWith("call ")) {
QListWidgetItem *call = new QListWidgetItem();
QString parse = arg1;
if (arg1.count() == 4 || arg1.count() == 5) {
call->setText(tr("Place a call"));
call->setData(Qt::UserRole, "thewave:call");
call->setIcon(QIcon::fromTheme("call-start"));
} else {
parse.remove(0, 5);
QListWidgetItem *callItem = new QListWidgetItem();
callItem->setText(tr("Place a call"));
callItem->setIcon(QIcon::fromTheme("call-start"));
callItem->setData(Qt::UserRole, "thewave:call " + parse);
ui->listWidget->addItem(callItem);
call->setText((QString) parse.at(0).toUpper() + parse.right(parse.length() - 1) + "");
call->setData(Qt::UserRole, "thewave:call " + parse);
call->setIcon(QIcon(":/icons/blank.svg"));
QFont font = call->font();
font.setPointSize(30);
call->setFont(font);
}
ui->listWidget->addItem(call);
showtheWaveOption = false;
} else if (arg1.startsWith("weather")) {
QListWidgetItem *weather = new QListWidgetItem();
QListWidgetItem *weatherItem = new QListWidgetItem();
weatherItem->setText(tr("Weather"));
weatherItem->setIcon(QIcon::fromTheme("weather-clear"));
weatherItem->setData(Qt::UserRole, "thewave:weather");
ui->listWidget->addItem(weatherItem);
weather->setText(tr("Unknown"));
weather->setData(Qt::UserRole, "thewave:weather");
weather->setIcon(QIcon::fromTheme("dialog-error"));
QFont font = weather->font();
font.setPointSize(30);
weather->setFont(font);
ui->listWidget->addItem(weather);
showtheWaveOption = false;
} else if (arg1.startsWith("play") && MainWin->isMprisAvailable()) {
QListWidgetItem *i = new QListWidgetItem();
i->setText(tr("Play"));
i->setIcon(QIcon::fromTheme("media-playback-start"));
i->setData(Qt::UserRole, "media:play");
ui->listWidget->addItem(i);
showtheWaveOption = false;
} else if (arg1.startsWith("pause") && MainWin->isMprisAvailable()) {
QListWidgetItem *i = new QListWidgetItem();
i->setText(tr("Pause"));
i->setIcon(QIcon::fromTheme("media-playback-pause"));
i->setData(Qt::UserRole, "media:pause");
ui->listWidget->addItem(i);
showtheWaveOption = false;
} else if (arg1.startsWith("next") && MainWin->isMprisAvailable()) {
QListWidgetItem *i = new QListWidgetItem();
i->setText(tr("Next Track"));
i->setIcon(QIcon::fromTheme("media-skip-forward"));
i->setData(Qt::UserRole, "media:next");
ui->listWidget->addItem(i);
showtheWaveOption = false;
} else if ((arg1.startsWith("previous") || arg1.startsWith("back")) && MainWin->isMprisAvailable()) {
QListWidgetItem *i = new QListWidgetItem();
i->setText(tr("Previous Track"));
i->setIcon(QIcon::fromTheme("media-skip-backward"));
i->setData(Qt::UserRole, "media:previous");
ui->listWidget->addItem(i);
showtheWaveOption = false;
} else if ((arg1.contains("current") || arg1.contains("what") || arg1.contains("now")) &&
(arg1.contains("track") || arg1.contains("song") || arg1.contains("playing")) && MainWin->isMprisAvailable()) { //Get current song info
QListWidgetItem *nowPlaying = new QListWidgetItem();
nowPlaying->setText(tr("Now Playing"));
nowPlaying->setIcon(QIcon::fromTheme("media-playback-start"));
nowPlaying->setData(Qt::UserRole, "thewave:current track");
ui->listWidget->addItem(nowPlaying);
QListWidgetItem *title = new QListWidgetItem();
title->setText(MainWin->songName());
title->setData(Qt::UserRole, "thewave:current track");
title->setIcon(QIcon(":/icons/blank.svg"));
QFont font = title->font();
font.setPointSize(30);
title->setFont(font);
ui->listWidget->addItem(title);
if (MainWin->songAlbum() != "" || MainWin->songArtist() != "") {
QListWidgetItem *extra = new QListWidgetItem();
if (MainWin->songArtist() != "" && MainWin->songAlbum() != "") {
extra->setText(MainWin->songArtist() + " · " + MainWin->songAlbum());
} else if (MainWin->songArtist() == "") {
extra->setText(MainWin->songAlbum());
} else {
extra->setText(MainWin->songArtist());
}
extra->setData(Qt::UserRole, "thewave:current track");
extra->setIcon(QIcon(":/icons/blank.svg"));
ui->listWidget->addItem(extra);
}
QListWidgetItem *space = new QListWidgetItem();
ui->listWidget->addItem(space);
QListWidgetItem *play = new QListWidgetItem();
play->setText(tr("Play"));
play->setIcon(QIcon::fromTheme("media-playback-start"));
play->setData(Qt::UserRole, "media:play");
ui->listWidget->addItem(play);
QListWidgetItem *pause = new QListWidgetItem();
pause->setText(tr("Pause"));
pause->setIcon(QIcon::fromTheme("media-playback-pause"));
pause->setData(Qt::UserRole, "media:pause");
ui->listWidget->addItem(pause);
QListWidgetItem *next = new QListWidgetItem();
next->setText(tr("Next Track"));
next->setIcon(QIcon::fromTheme("media-skip-forward"));
next->setData(Qt::UserRole, "media:next");
ui->listWidget->addItem(next);
QListWidgetItem *prev = new QListWidgetItem();
prev->setText(tr("Previous Track"));
prev->setIcon(QIcon::fromTheme("media-skip-backward"));
prev->setData(Qt::UserRole, "media:previous");
ui->listWidget->addItem(prev);
showtheWaveOption = false;
}
}*/
int i = 0;
for (App app : apps) {
if (i >= pinnedAppsCount || pinnedAppsCount == 0) {
@ -294,14 +142,6 @@ void AppsListModel::search(QString query) {
}
}
if (showtheWaveOption && settings.value("thewave/enabled", true).toBool()) {
App app;
app.setCommand("thewave:" + query);
app.setDescription(tr("Query theWave"));
app.setName(query);
app.setIcon(QIcon(":/icons/thewave.svg"));
appsShown.append(app);
}
updateData();
}
}
@ -358,13 +198,6 @@ void AppsListModel::loadData() {
}
}
App waveApp;
waveApp.setCommand("thewave");
waveApp.setIcon(QIcon(":/icons/thewave.svg"));
waveApp.setName(tr("theWave"));
waveApp.setDescription(tr("Personal Assistant"));
apps.append(waveApp);
std::sort(apps.begin(), apps.end());
for (int i = pinnedAppsList.count() - 1; i >= 0; i--) {
@ -632,16 +465,7 @@ bool AppsListModel::launchApp(QModelIndex index) {
on_lineEdit_textEdited(ui->lineEdit->text());
} else {*/
QString command = appsShown.at(index.row()).command().remove("%u");
if (command.startsWith("thewave")) {
if (command.split(":").count() > 1) {
QStringList request = command.split(":");
request.removeFirst();
emit queryWave(request.join(" "));
} else {
emit queryWave("");
}
return false;
} else if (command.startsWith("call:")) {
if (command.startsWith("call:")) {
QString callCommand = command.mid(5);
QStringList parts = callCommand.split(":");
int deviceIndex = parts.at(0).toInt();

View file

@ -45,7 +45,6 @@ public slots:
void loadData();
signals:
void queryWave(QString query);
private:
struct dataLoad {

View file

@ -209,17 +209,6 @@ InfoPaneDropdown::InfoPaneDropdown(WId MainWindowId, QWidget *parent) :
}
ui->redshiftIntensity->setValue(redshiftVal.toInt());
QString thewaveVoiceEngine = settings.value("thewave/ttsEngine", "festival").toString();
if (thewaveVoiceEngine == "pico2wave") {
ui->thewaveTTSpico2wave->setChecked(true);
} else if (thewaveVoiceEngine == "espeak") {
ui->thewaveTTSespeak->setChecked(true);
} else if (thewaveVoiceEngine == "festival") {
ui->thewaveTTSfestival->setChecked(true);
} else if (thewaveVoiceEngine == "none") {
ui->thewaveTTSsilent->setChecked(true);
}
if (settings.value("ui/useFullScreenEndSession", false).toBool()) {
ui->endSessionConfirmFullScreen->setChecked(true);
ui->endSessionConfirmInMenu->setChecked(false);
@ -273,12 +262,8 @@ InfoPaneDropdown::InfoPaneDropdown(WId MainWindowId, QWidget *parent) :
ui->lockScreenBackground->setText(lockScreenSettings->value("background", "/usr/share/icons/theos/backgrounds/triangle/1920x1080.png").toString());
//ui->lineEdit_2->setText(settings.value("startup/autostart", "").toString());
ui->redshiftPause->setChecked(!settings.value("display/redshiftPaused", true).toBool());
ui->thewaveWikipediaSwitch->setChecked(settings.value("thewave/wikipediaSearch", true).toBool());
ui->TouchFeedbackSwitch->setChecked(settings.value("input/touchFeedbackSound", false).toBool());
ui->SuperkeyGatewaySwitch->setChecked(settings.value("input/superkeyGateway", true).toBool());
ui->thewaveOffensiveSwitch->setChecked(settings.value("thewave/blockOffensiveWords", true).toBool());
ui->theWaveSwitch->setChecked(settings.value("thewave/enabled", true).toBool());
ui->theWaveName->setText(settings.value("thewave/name", "").toString());
ui->TextSwitch->setChecked(settings.value("bar/showText", true).toBool());
ui->windowManager->setText(settings.value("startup/WindowManagerCommand", "kwin_x11").toString());
ui->barDesktopsSwitch->setChecked(settings.value("bar/showWindowsFromOtherDesktops", true).toBool());
@ -1278,37 +1263,6 @@ void InfoPaneDropdown::on_TouchFeedbackSwitch_toggled(bool checked)
settings.setValue("input/touchFeedbackSound", checked);
}
void InfoPaneDropdown::on_thewaveTTSpico2wave_clicked()
{
settings.setValue("thewave/ttsEngine", "pico2wave");
}
void InfoPaneDropdown::on_thewaveTTSfestival_clicked()
{
settings.setValue("thewave/ttsEngine", "festival");
}
void InfoPaneDropdown::on_thewaveWikipediaSwitch_toggled(bool checked)
{
settings.setValue("thewave/wikipediaSearch", checked);
}
void InfoPaneDropdown::on_thewaveTTSespeak_clicked()
{
settings.setValue("thewave/ttsEngine", "espeak");
}
void InfoPaneDropdown::on_thewaveOffensiveSwitch_toggled(bool checked)
{
settings.setValue("thewave/blockOffensiveWords", checked);
}
void InfoPaneDropdown::on_theWaveName_textEdited(const QString &arg1)
{
settings.setValue("thewave/name", arg1);
}
void InfoPaneDropdown::on_brightnessSlider_sliderMoved(int position)
{
QProcess* backlight = new QProcess(this);
@ -1369,16 +1323,6 @@ void InfoPaneDropdown::on_barDesktopsSwitch_toggled(bool checked)
settings.setValue("bar/showWindowsFromOtherDesktops", checked);
}
void InfoPaneDropdown::on_thewaveTTSsilent_clicked()
{
settings.setValue("thewave/ttsEngine", "none");
}
void InfoPaneDropdown::on_theWaveSwitch_toggled(bool checked)
{
settings.setValue("thewave/enabled", checked);
}
void InfoPaneDropdown::on_BluetoothSwitch_toggled(bool checked)
{
QDBusInterface("org.thesuite.tsbt", "/org/thesuite/tsbt", "org.thesuite.tsbt", QDBusConnection::sessionBus()).setProperty("BluetoothEnabled", checked);

View file

@ -172,18 +172,6 @@ private slots:
void on_TouchFeedbackSwitch_toggled(bool checked);
void on_thewaveTTSpico2wave_clicked();
void on_thewaveTTSfestival_clicked();
void on_thewaveWikipediaSwitch_toggled(bool checked);
void on_thewaveTTSespeak_clicked();
void on_thewaveOffensiveSwitch_toggled(bool checked);
void on_theWaveName_textEdited(const QString &arg1);
void on_brightnessSlider_sliderMoved(int position);
void on_brightnessSlider_valueChanged(int value);
@ -206,10 +194,6 @@ private slots:
void on_barDesktopsSwitch_toggled(bool checked);
void on_thewaveTTSsilent_clicked();
void on_theWaveSwitch_toggled(bool checked);
void bluetoothEnabledChanged();
void on_BluetoothSwitch_toggled(bool checked);
@ -411,7 +395,6 @@ public slots:
void startTimer(QTime time);
//Switches for theWave
void on_WifiSwitch_toggled(bool checked);
private:

View file

@ -611,14 +611,14 @@
<second>0</second>
<year>1969</year>
<month>9</month>
<day>12</day>
<day>11</day>
</datetime>
</property>
<property name="date">
<date>
<year>1969</year>
<month>9</month>
<day>12</day>
<day>11</day>
</date>
</property>
<property name="displayFormat">
@ -1755,15 +1755,6 @@
<normaloff>.</normaloff>.</iconset>
</property>
</item>
<item>
<property name="text">
<string>theWave</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/thewave.svg</normaloff>:/icons/thewave.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Users</string>
@ -1823,7 +1814,7 @@
<item>
<widget class="QStackedWidget" name="settingsTabs">
<property name="currentIndex">
<number>7</number>
<number>8</number>
</property>
<widget class="QWidget" name="StartupSettings">
<layout class="QVBoxLayout" name="verticalLayout_9">
@ -3501,203 +3492,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="theWaveSettings">
<layout class="QGridLayout" name="gridLayout_7">
<item row="1" column="0">
<widget class="QLabel" name="label_36">
<property name="text">
<string>Enable theWave</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_28">
<property name="text">
<string>Search on Wikipedia</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QFrame" name="displayHeader_6">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_20">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="displayLabel_6">
<property name="font">
<font>
<pointsize>15</pointsize>
</font>
</property>
<property name="text">
<string>theWave</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="displayLine_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="1">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="thewaveTTSsilent">
<property name="text">
<string>Si&amp;lent</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="thewaveTTSfestival">
<property name="text">
<string>Festi&amp;val</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="thewaveTTSespeak">
<property name="text">
<string>espea&amp;k</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="thewaveTTSpico2wave">
<property name="text">
<string>pico&amp;2wave</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_27">
<property name="text">
<string>Text to Speech engine</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Switch" name="thewaveWikipediaSwitch">
<property name="text">
<string>WikipediaSwitch</string>
</property>
</widget>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer_14">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_29">
<property name="text">
<string>Block recognized offensive words</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="theWaveName"/>
</item>
<item row="5" column="1">
<widget class="Switch" name="thewaveOffensiveSwitch">
<property name="text">
<string>OffensiveSwitch</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_30">
<property name="text">
<string>Preferred Name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Switch" name="theWaveSwitch">
<property name="text">
<string>theWaveSwitch</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="label_55">
<property name="text">
<string>Recognized offensive words will be replaced with asterisks. However, there will probably be some false positives.</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4">
<layout class="QGridLayout" name="gridLayout_12">
<item row="0" column="0">
@ -4847,14 +4641,6 @@ Items that will be kept if you choose to keep files:
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header>clickablelabel.h</header>
<slots>
<signal>clicked()</signal>
</slots>
</customwidget>
<customwidget>
<class>AnimatedStackedWidget</class>
<extends>QStackedWidget</extends>
@ -4866,6 +4652,14 @@ Items that will be kept if you choose to keep files:
<extends>QPushButton</extends>
<header>switch.h</header>
</customwidget>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header>clickablelabel.h</header>
<slots>
<signal>clicked()</signal>
</slots>
</customwidget>
<customwidget>
<class>NetworkWidget</class>
<extends>QWidget</extends>

View file

@ -1338,11 +1338,6 @@ void MainWindow::on_date_clicked()
infoPane->show(InfoPaneDropdown::Clock);
}
void MainWindow::on_pushButton_2_clicked()
{
openMenu(true);
}
void MainWindow::internetLabelChanged(QString text, QIcon icon) {
/*ui->networkLabel->setText(display);
if (signalStrength == -1) {
@ -1708,34 +1703,27 @@ void MainWindow::on_desktopBack_clicked()
sendMessageToRootWindow("_NET_CURRENT_DESKTOP", 0, switchToDesktop);
}
void MainWindow::openMenu(bool openTotheWave, bool startListening) {
if (gatewayMenu->isVisible()) {
if (openTotheWave) {
gatewayMenu->show(openTotheWave, startListening);
void MainWindow::openMenu() {
lockHide = true;
}
QRect screenGeometry = QApplication::desktop()->screenGeometry();
QRect availableGeometry = QApplication::desktop()->availableGeometry();
//gatewayMenu->setGeometry(availableGeometry.x(), availableGeometry.y(), gatewayMenu->width(), availableGeometry.height());
if (settings.value("bar/onTop", true).toBool()) {
gatewayMenu->setGeometry(this->x() - gatewayMenu->width(), this->y() + this->height() - 1, gatewayMenu->width(), availableGeometry.height() - (this->height() + (this->y() - availableGeometry.y())) + 1);
} else {
lockHide = true;
int height;
QRect screenGeometry = QApplication::desktop()->screenGeometry();
QRect availableGeometry = QApplication::desktop()->availableGeometry();
//gatewayMenu->setGeometry(availableGeometry.x(), availableGeometry.y(), gatewayMenu->width(), availableGeometry.height());
if (settings.value("bar/onTop", true).toBool()) {
gatewayMenu->setGeometry(this->x() - gatewayMenu->width(), this->y() + this->height() - 1, gatewayMenu->width(), availableGeometry.height() - (this->height() + (this->y() - availableGeometry.y())) + 1);
if (availableGeometry.bottom() < screenGeometry.height() - this->height()) {
height = availableGeometry.height();
} else {
int height;
if (availableGeometry.bottom() < screenGeometry.height() - this->height()) {
height = availableGeometry.height();
} else {
height = this->y() - screenGeometry.top() + 1;
}
gatewayMenu->setGeometry(this->x() - gatewayMenu->width(), availableGeometry.y() , gatewayMenu->width(), height);
height = this->y() - screenGeometry.top() + 1;
}
gatewayMenu->show(openTotheWave, startListening);
gatewayMenu->setFocus();
gatewayMenu->setGeometry(this->x() - gatewayMenu->width(), availableGeometry.y() , gatewayMenu->width(), height);
}
gatewayMenu->show();
gatewayMenu->setFocus();
}
bool MainWindow::isMprisAvailable() {

View file

@ -85,7 +85,7 @@ public:
QString songAlbum();
public slots:
void openMenu(bool openTotheWave = false, bool startListening = false);
void openMenu();
void doUpdate();
@ -96,8 +96,6 @@ private slots:
void on_date_clicked();
void on_pushButton_2_clicked();
void internetLabelChanged(QString text, QIcon icon);
void on_networkLabel_clicked();

View file

@ -144,33 +144,6 @@
<item>
<widget class="BTHandsfree" name="phonesWidget" native="true"/>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>theWave</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="thewave" resource="resources.qrc">
<normaloff>:/icons/thewave.svg</normaloff>:/icons/thewave.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="batteryFrame">
<property name="frameShape">

688
menu.cpp
View file

@ -39,22 +39,10 @@ Menu::Menu(BTHandsfree* bt, QWidget *parent) :
ui->offFrame->setParent(this);
ui->offFrame->setVisible(false);
ui->thewaveFrame->setParent(this);
this->layout()->removeWidget(ui->offFrame);
this->layout()->removeWidget(ui->thewaveFrame);
ui->offFrame->setGeometry(10, -this->height(), this->width() - 20, this->height() - 20);
ui->thewaveFrame->setGeometry(10, -this->height(), this->width() - 20, this->height() - 20);
ui->timerIcon->setPixmap(QIcon::fromTheme("player-time").pixmap(16));
ui->userIcon->setPixmap(QIcon::fromTheme("system-users").pixmap(16));
ui->thewave_connection_disconnection_label->setPixmap(QIcon::fromTheme("network-disconnect").pixmap(16));
ui->timeIcon->setPixmap(QIcon::fromTheme("player-time").pixmap(32));
ui->callIcon->setPixmap(QIcon::fromTheme("call-start").pixmap(32));
ui->messageIcon->setPixmap(QIcon::fromTheme("message-send").pixmap(32));
ui->launchIcon->setPixmap(QIcon::fromTheme("system-run").pixmap(32));
ui->infoIcon->setPixmap(QIcon::fromTheme("text-html").pixmap(32));
ui->mathIcon->setPixmap(QIcon::fromTheme("accessories-calculator").pixmap(32));
ui->settingsIcon->setPixmap(QIcon::fromTheme("preferences-system").pixmap(32));
ui->mediaIcon->setPixmap(QIcon::fromTheme("media-playback-start").pixmap(32));
ui->commandLinkButton->setProperty("type", "destructive");
ui->commandLinkButton_2->setProperty("type", "destructive");
@ -90,25 +78,17 @@ Menu::Menu(BTHandsfree* bt, QWidget *parent) :
//ui->listWidget->installEventFilter(this);
ui->appsListView->installEventFilter(this);
ui->activateTheWave->installEventFilter(this);
ui->pushButton->installEventFilter(this);
ui->pushButton_3->installEventFilter(this);
this->installEventFilter(this);
if (QFile("/usr/bin/install_theos").exists()) {
if (QFile("/usr/bin/scallop").exists()) {
ui->InstallLayout->setVisible(true);
} else {
ui->InstallLayout->setVisible(false);
}
QNetworkAccessManager networkManager;
if (networkManager.networkAccessible() == QNetworkAccessManager::Accessible) {
ui->thewaveInternetFrame->setVisible(false);
} else {
ui->thewaveInternetFrame->setVisible(true);
}
QString seatPath = QString(qgetenv("XDG_SEAT_PATH"));
if (seatPath == "") {
ui->commandLinkButton_4->setEnabled(false);
@ -121,17 +101,8 @@ Menu::Menu(BTHandsfree* bt, QWidget *parent) :
//listPal.setBrush(QPalette::Inactive, QPalette::HighlightedText, listPal.brush(QPalette::Active, QPalette::HighlightedText));
//ui->listWidget->setPalette(listPal);
this->theWaveFrame = ui->thewaveFrame;
//populateAppList();
AppsListModel* appsListModel = new AppsListModel(bt);
connect(appsListModel, &AppsListModel::queryWave, [=](QString query) {
ui->activateTheWave->click();
if (query != "") {
ui->thewave_line->setText(query);
on_thewave_line_returnPressed();
}
});
ui->appsListView->setModel(appsListModel);
ui->appsListView->setItemDelegate(new AppsDelegate);
@ -155,47 +126,32 @@ Menu::~Menu()
delete ui;
}
void Menu::show(bool openTotheWave, bool startListening) {
if (this->isVisible()) {
this->uncollapse();
} else {
//Reload menu
//((AppsListModel*) ui->appsListView->model())->loadData();
void Menu::show() {
unsigned long desktop = 0xFFFFFFFF;
XChangeProperty(QX11Info::display(), this->winId(), XInternAtom(QX11Info::display(), "_NET_WM_DESKTOP", False),
XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &desktop, 1); //Set visible on all desktops
unsigned long desktop = 0xFFFFFFFF;
XChangeProperty(QX11Info::display(), this->winId(), XInternAtom(QX11Info::display(), "_NET_WM_DESKTOP", False),
XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &desktop, 1); //Set visible on all desktops
QDialog::show();
doCheckForClose = true;
QDialog::show();
doCheckForClose = true;
ui->offFrame->setGeometry(10, this->height(), this->width() - 20, this->height() - 20);
ui->offFrame->setGeometry(10, this->height(), this->width() - 20, this->height() - 20);
ui->thewaveFrame->setGeometry(10, this->height(), this->width() - 20, this->height() - 20);
tPropertyAnimation* animation = new tPropertyAnimation(this, "geometry");
animation->setStartValue(this->geometry());
animation->setEndValue(QRect(this->x() + this->width(), this->y(), this->width(), this->height()));
animation->setDuration(500);
animation->setEasingCurve(QEasingCurve::OutCubic);
connect(animation, SIGNAL(finished()), animation, SLOT(deleteLater()));
animation->start();
tPropertyAnimation* animation = new tPropertyAnimation(this, "geometry");
animation->setStartValue(this->geometry());
animation->setEndValue(QRect(this->x() + this->width(), this->y(), this->width(), this->height()));
animation->setDuration(500);
animation->setEasingCurve(QEasingCurve::OutCubic);
connect(animation, SIGNAL(finished()), animation, SLOT(deleteLater()));
animation->start();
ui->lineEdit->setText("");
ui->lineEdit->setFocus();
on_lineEdit_textEdited("");
ui->lineEdit->setText("");
ui->lineEdit->setFocus();
on_lineEdit_textEdited("");
ui->appsListView->scrollToTop();
ui->appsListView->scrollToTop();
//Show Tutorial Screen
TutorialWin->showScreen(TutorialWindow::GatewaySearch);
}
if (openTotheWave && !this->istheWaveOpen) {
ui->activateTheWave->click();
}
if (startListening && openTotheWave) {
ui->listentheWave->click();
}
//Show Tutorial Screen
TutorialWin->showScreen(TutorialWindow::GatewaySearch);
connect(NativeFilter, &NativeEventFilter::DoRetranslation, [=] {
ui->retranslateUi(this);
@ -205,47 +161,13 @@ void Menu::show(bool openTotheWave, bool startListening) {
void Menu::changeEvent(QEvent *event) {
QDialog::changeEvent(event);
if (event->type() == QEvent::ActivationChange) {
if (istheWaveOpen) {
if (this->isActiveWindow()) {
uncollapse();
} else {
collapse();
}
} else {
if (!this->isActiveWindow()) {
this->close();
}
if (!this->isActiveWindow()) {
this->close();
}
}
}
void Menu::collapse() {
QRect screenGeometry = QApplication::desktop()->screenGeometry();
tPropertyAnimation* animation = new tPropertyAnimation(this, "geometry");
animation->setStartValue(this->geometry());
animation->setEndValue(QRect(screenGeometry.x() - (this->width() - 50), this->y(), this->width(), this->height()));
animation->setDuration(500);
animation->setEasingCurve(QEasingCurve::OutCubic);
animation->start();
connect(animation, SIGNAL(finished()), animation, SLOT(deleteLater()));
}
void Menu::uncollapse() {
QRect screenGeometry = QApplication::desktop()->screenGeometry();
tPropertyAnimation* animation = new tPropertyAnimation(this, "geometry");
animation->setStartValue(this->geometry());
animation->setEndValue(QRect(screenGeometry.x(), this->y(), this->width(), this->height()));
animation->setDuration(500);
animation->setEasingCurve(QEasingCurve::OutCubic);
animation->start();
connect(animation, SIGNAL(finished()), animation, SLOT(deleteLater()));
}
void Menu::close() {
if (istheWaveOpen) {
ui->closetheWaveButton->click();
}
tPropertyAnimation* animation = new tPropertyAnimation(this, "geometry");
animation->setStartValue(this->geometry());
animation->setEndValue(QRect(this->x() - this->width(), this->y(), this->width(), this->height()));
@ -436,82 +358,66 @@ bool Menu::eventFilter(QObject *object, QEvent *event) {
this->close();
return true;
} else {
//if (object != ui->thewave_line && object != ui->lineEdit) {
//if (ui->thewave_line->hasFocus() || ui->lineEdit->hasFocus()) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *e = (QKeyEvent*) event;
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
if (!istheWaveReady) {
if (object != ui->lineEdit && object != ui->thewave_line && object != this) {
if (object == ui->appsListView) {
on_lineEdit_returnPressed();
} else {
((QPushButton*) object)->click();
}
on_lineEdit_returnPressed();
}
}
event->ignore();
} else {
if (istheWaveReady) {
ui->thewave_line->setText(ui->thewave_line->text().append(e->text())); //Type letter into theWave
ui->thewave_line->setFocus();
if (event->type() == QEvent::KeyPress) {
QKeyEvent *e = (QKeyEvent*) event;
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
if (object != ui->lineEdit && object != this) {
if (object == ui->appsListView) {
on_lineEdit_returnPressed();
} else {
if (e->key() != Qt::Key_Up && e->key() != Qt::Key_Down) {
ui->lineEdit->setText(ui->lineEdit->text().append(e->text())); //Type letter into search box
ui->lineEdit->setFocus();
on_lineEdit_textEdited(ui->lineEdit->text());
((QPushButton*) object)->click();
}
on_lineEdit_returnPressed();
}
event->ignore();
} else {
if (e->key() != Qt::Key_Up && e->key() != Qt::Key_Down) {
ui->lineEdit->setText(ui->lineEdit->text().append(e->text())); //Type letter into search box
ui->lineEdit->setFocus();
on_lineEdit_textEdited(ui->lineEdit->text());
} else {
int currentRow;
if (ui->appsListView->selectionModel()->selectedRows().count() == 0) {
currentRow = -1;
} else {
currentRow = ui->appsListView->selectionModel()->selectedRows().first().row();
}
if (e->key() == Qt::Key_Down) {
QModelIndex indexToSelect;
if (currentRow == pinnedAppsCount - 1 && pinnedAppsCount != 0 && ui->lineEdit->text() == "") {
indexToSelect = ui->appsListView->model()->index(pinnedAppsCount + 1, 0);
} else if (currentRow == -1) {
indexToSelect = ui->appsListView->model()->index(0, 0);
} else if (currentRow == ui->appsListView->model()->rowCount() - 1) {
indexToSelect = ui->appsListView->model()->index(0, 0);
} else {
int currentRow;
if (ui->appsListView->selectionModel()->selectedRows().count() == 0) {
currentRow = -1;
} else {
currentRow = ui->appsListView->selectionModel()->selectedRows().first().row();
}
if (e->key() == Qt::Key_Down) {
QModelIndex indexToSelect;
if (currentRow == pinnedAppsCount - 1 && pinnedAppsCount != 0 && ui->lineEdit->text() == "") {
indexToSelect = ui->appsListView->model()->index(pinnedAppsCount + 1, 0);
} else if (currentRow == -1) {
indexToSelect = ui->appsListView->model()->index(0, 0);
} else if (currentRow == ui->appsListView->model()->rowCount() - 1) {
indexToSelect = ui->appsListView->model()->index(0, 0);
} else {
indexToSelect = ui->appsListView->model()->index(currentRow + 1, 0);
}
ui->appsListView->selectionModel()->select(indexToSelect, QItemSelectionModel::ClearAndSelect);
ui->appsListView->scrollTo(indexToSelect);
} else if (e->key() == Qt::Key_Up) {
QModelIndex indexToSelect;
if (currentRow == pinnedAppsCount + 1 && pinnedAppsCount != 0 && ui->lineEdit->text() == "") {
indexToSelect = ui->appsListView->model()->index(pinnedAppsCount - 1, 0);
} else if (currentRow == -1) {
indexToSelect = ui->appsListView->model()->index(ui->appsListView->model()->rowCount() - 1, 0);
} else if (currentRow == 0) {
indexToSelect = ui->appsListView->model()->index(ui->appsListView->model()->rowCount() - 1, 0);
} else {
indexToSelect = ui->appsListView->model()->index(currentRow - 1, 0);
}
ui->appsListView->selectionModel()->select(indexToSelect, QItemSelectionModel::ClearAndSelect);
ui->appsListView->scrollTo(indexToSelect);
}
indexToSelect = ui->appsListView->model()->index(currentRow + 1, 0);
}
ui->appsListView->selectionModel()->select(indexToSelect, QItemSelectionModel::ClearAndSelect);
ui->appsListView->scrollTo(indexToSelect);
} else if (e->key() == Qt::Key_Up) {
QModelIndex indexToSelect;
if (currentRow == pinnedAppsCount + 1 && pinnedAppsCount != 0 && ui->lineEdit->text() == "") {
indexToSelect = ui->appsListView->model()->index(pinnedAppsCount - 1, 0);
} else if (currentRow == -1) {
indexToSelect = ui->appsListView->model()->index(ui->appsListView->model()->rowCount() - 1, 0);
} else if (currentRow == 0) {
indexToSelect = ui->appsListView->model()->index(ui->appsListView->model()->rowCount() - 1, 0);
} else {
indexToSelect = ui->appsListView->model()->index(currentRow - 1, 0);
}
ui->appsListView->selectionModel()->select(indexToSelect, QItemSelectionModel::ClearAndSelect);
ui->appsListView->scrollTo(indexToSelect);
}
}
e->ignore();
return true;
} else {
return QDialog::eventFilter(object, event);
}
/*} else {
if (event->type() == QEvent::KeyPress) {
event->ignore();
return true;
}
e->ignore();
return true;
} else {
return QDialog::eventFilter(object, event);
}*/
}
}
}
@ -537,7 +443,7 @@ void Menu::on_lineEdit_returnPressed()
void Menu::on_pushButton_3_clicked()
{
QProcess::startDetached("install_theos");
QProcess::startDetached("scallop");
this->close();
}
@ -578,367 +484,6 @@ void Menu::on_commandLinkButton_8_clicked()
QProcess::startDetached("xset dpms force off");
}
void Menu::on_activateTheWave_clicked()
{
istheWaveOpen = true;
this->resetFrames();
tPropertyAnimation* anim = new tPropertyAnimation(ui->thewaveFrame, "geometry");
anim->setStartValue(QRect(10, this->height(), this->width() - 20, this->height() - 20));
anim->setEndValue(QRect(10, 10, this->width() - 20, this->height() - 20));
anim->setDuration(500);
anim->setEasingCurve(QEasingCurve::OutCubic);
anim->start();
waveWorker = new theWaveWorker();
if (waveWorker->isDisabled()) {
ui->thewaveDisabledFrame->setVisible(true);
ui->thewaveFrameInner->setVisible(false);
ui->listentheWave->setVisible(false);
} else {
ui->thewaveDisabledFrame->setVisible(false);
ui->thewaveFrameInner->setVisible(true);
ui->listentheWave->setVisible(true);
ui->theWaveSpeakFrame->setVisible(false);
ui->thewave_hintFrame->setVisible(false);
ui->thewaveHintIcon->setPixmap(QIcon::fromTheme("dialog-information").pixmap(16, 16));
QThread *t = new QThread();
waveWorker->moveToThread(t);
//connect(t, SIGNAL(started()), waveWorker, SLOT(begin()));
connect(t, &QThread::started, [=]() {
this->istheWaveReady = true;
});
connect(waveWorker, SIGNAL(finished()), waveWorker, SLOT(deleteLater()));
connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
connect(waveWorker, &theWaveWorker::outputResponse, [=](QString response) {
if (settings.value("thewave/blockOffensiveWords").toBool()) {
//Sorry... If there's a better way though, that'd be good :)
response.replace("shit", "s•••", Qt::CaseInsensitive);
response.replace("fuck", "f•••", Qt::CaseInsensitive);
response.replace("cunt", "c•••", Qt::CaseInsensitive);
response.replace("bitch", "b••••", Qt::CaseInsensitive);
}
ui->thewave_response->setText(response);
ui->thewave_hintFrame->setVisible(false);
});
connect(waveWorker, &theWaveWorker::outputHint, [=](QString hint) {
ui->thewaveHint->setText(hint);
ui->thewave_hintFrame->setVisible(true);
});
connect(waveWorker, SIGNAL(outputSpeech(QString)), this, SLOT(thewave_outputSpeech(QString)));
connect(waveWorker, &theWaveWorker::startedListening, [=]() {
isListening = true;
});
connect(waveWorker, &theWaveWorker::stoppedListening, [=]() {
isListening = false;
});
connect(waveWorker, &theWaveWorker::doLaunchApp, [=](QString appName) {
for (App app : ((AppsListModel*) ui->appsListView->model())->availableApps()) {
if (app.name() == appName) {
QProcess::startDetached(app.command().remove("%u"));
this->close();
}
}
});
connect(waveWorker, &theWaveWorker::showBigListenFrame, [=]() {
QString name = settings.value("thewave/name").toString();
if (name == "") {
switch (qrand() % 5) {
case 0:
ui->theWaveSpeakGreeting->setText("Hey there. What's next?");
break;
case 1:
ui->theWaveSpeakGreeting->setText("What can I do for you?");
break;
case 2:
ui->theWaveSpeakGreeting->setText("Hello.");
break;
case 3:
ui->theWaveSpeakGreeting->setText("Oh, hey there!");
break;
case 4:
QTime current = QTime::currentTime();
if (current.hour() < 12) {
ui->theWaveSpeakGreeting->setText("Good morning!");
} else if (current.hour() < 17) {
ui->theWaveSpeakGreeting->setText("Good afternoon!");
} else {
ui->theWaveSpeakGreeting->setText("Good evening!");
}
break;
}
} else {
switch (qrand() % 5) {
case 0:
ui->theWaveSpeakGreeting->setText("Hey, " + name + ". What's next?");
break;
case 1:
ui->theWaveSpeakGreeting->setText("What can I do for you, " + name + "?");
break;
case 2:
ui->theWaveSpeakGreeting->setText("Hello " + name + "!");
break;
case 3:
ui->theWaveSpeakGreeting->setText("Oh, hey " + name + "!");
break;
case 4:
QTime current = QTime::currentTime();
if (current.hour() < 12) {
ui->theWaveSpeakGreeting->setText("Good morning " + name + "!");
} else if (current.hour() < 17) {
ui->theWaveSpeakGreeting->setText("Good afternoon " + name + "!");
} else {
ui->theWaveSpeakGreeting->setText("Good evening " + name + "!");
}
break;
}
}
ui->thewaveFrameInner->setVisible(false);
ui->theWaveSpeakFrame->setVisible(true);
});
connect(waveWorker, &theWaveWorker::hideBigListenFrame, [=]() {
ui->thewaveFrameInner->setVisible(true);
ui->theWaveSpeakFrame->setVisible(false);
});
connect(waveWorker, SIGNAL(showCallFrame(bool)), this, SLOT(showCallFrame(bool))); //Call
connect(waveWorker, SIGNAL(resetFrames()), this, SLOT(resetFrames())); //Reset
connect(waveWorker, SIGNAL(showMessageFrame()), this, SLOT(showMessageFrame())); //Text Message
connect(waveWorker, SIGNAL(showHelpFrame()), this, SLOT(showHelpFrame())); //Help
connect(waveWorker, SIGNAL(showWikipediaFrame(QString,QString)), this, SLOT(showWikipediaFrame(QString,QString))); //Wikipedia
connect(waveWorker, SIGNAL(launchApp(QString)), this, SLOT(thewave_launchapp(QString))); //Launch
connect(waveWorker, SIGNAL(setTimer(QTime)), MainWin->getInfoPane(), SLOT(startTimer(QTime))); //Start a timer
connect(waveWorker, SIGNAL(showFlightFrame(QString)), this, SLOT(showFlightFrame(QString))); //Flight
connect(waveWorker, SIGNAL(loudnessChanged(qreal)), this, SLOT(thewaveLoudnessChanged(qreal))); //Input Loudness
connect(waveWorker, SIGNAL(showSettingsFrame(QIcon,QString,bool)), this, SLOT(showSettingFrame(QIcon,QString,bool))); //Settings
connect(waveWorker, SIGNAL(showMathematicsFrame(QString,QString)), this, SLOT(showMathematicsFrame(QString,QString))); //Mathematics
connect(waveWorker, SIGNAL(showMediaFrame(QPixmap,QString,QString,bool)), this, SLOT(showMediaFrame(QPixmap,QString,QString,bool))); //Media Player
connect(this, SIGNAL(thewave_processText(QString,bool)), waveWorker, SLOT(processSpeech(QString,bool))); //Manual Input Text Processing
connect(this, SIGNAL(thewaveBegin()), waveWorker, SLOT(begin())); //Begin
connect(this, SIGNAL(thewaveStop()), waveWorker, SLOT(endAndProcess())); //Stop
connect(this, SIGNAL(thewave_sayLaunchApp(QString)), waveWorker, SLOT(launchAppReply(QString))); //Launch App User Reply
connect(this, SIGNAL(thewave_sayLaunchApp_disambiguation(QStringList)), waveWorker, SLOT(launchApp_disambiguation(QStringList))); //Lauch App Disambiguation Reply
connect(this, SIGNAL(currentSettingChanged(bool)), waveWorker, SLOT(currentSettingChanged(bool)));
connect(waveWorker, SIGNAL(loudnessChanged(qreal)), ui->theWaveFeedback, SLOT(addLevel(qreal)));
/*connect(w, &speechWorker::outputFrame, [=](QFrame *frame) {
ui->frame->layout()->addWidget(frame);
});*/
t->start();
}
}
void Menu::thewaveLoudnessChanged(qreal loudness) {
if (loudness == -1) {
ui->speechBar->setMaximum(0);
ui->speechBar->setValue(0);
} else if (loudness == -2) {
ui->speechBar->setVisible(false);
} else {
ui->speechBar->setMaximum(100);
ui->speechBar->setValue(loudness * 100);
ui->speechBar->setVisible(true);
}
}
void Menu::thewave_outputSpeech(QString speech) {
QString displaySpeech = speech;
if (settings.value("thewave/blockOffensiveWords").toBool()) {
//Sorry... If there's a better way though, that'd be good :)
displaySpeech.replace("shit", "s•••", Qt::CaseInsensitive);
displaySpeech.replace("fuck", "f•••", Qt::CaseInsensitive);
displaySpeech.replace("cunt", "c•••", Qt::CaseInsensitive);
displaySpeech.replace("bitch", "b••••", Qt::CaseInsensitive);
}
ui->thewave_line->setText(displaySpeech);
ui->theWaveBigSpeechLabel->setText(displaySpeech);
}
void Menu::on_closetheWaveButton_clicked()
{
if (this->isListening) {
emit thewaveStop();
}
this->istheWaveReady = false;
this->resetFrames();
ui->thewave_response->setText(tr("Hit \"Speak\" to start speaking."));
ui->thewave_line->setText("");
tPropertyAnimation* anim = new tPropertyAnimation(ui->thewaveFrame, "geometry");
anim->setStartValue(QRect(10, 10, this->width() - 20, this->height() - 20));
anim->setEndValue(QRect(10, this->height(), this->width() - 20, this->height() - 20));
anim->setDuration(500);
anim->setEasingCurve(QEasingCurve::OutCubic);
connect(anim, SIGNAL(finished()), anim, SLOT(deleteLater()));
anim->start();
if (waveWorker != NULL) {
//waveWorker->quit(); //This deletes the worker thread.
waveWorker->disconnect();
waveWorker->deleteLater();
waveWorker = NULL;
}
istheWaveOpen = false;
ui->appsListView->setFocus();
}
void Menu::showCallFrame(bool emergency) {
Q_UNUSED(emergency)
ui->thewave_callFrame->setVisible(true);
ui->thewave_callFrame->setBackupText(tr("Can't place a call from this device."));
}
void Menu::showMessageFrame() {
ui->thewave_messageframe->setVisible(true);
ui->thewave_messageframe->setBackupText(tr("Can't send messages from this device."));
}
void Menu::showHelpFrame() {
ui->thewave_helpFrame->setVisible(true);
ui->thewave_helpFrame->setBackupText(tr("theWave Help."));
}
void Menu::resetFrames() {
ui->thewave_callFrame->setVisible(false);
ui->thewave_messageframe->setVisible(false);
ui->thewave_helpFrame->setVisible(false);
ui->wikipediaFrame->setVisible(false);
ui->thewave_spacerFrame->setVisible(true);
ui->thewave_launchFrame->setVisible(false);
ui->thewaveWeatherFrame->setVisible(false);
ui->thewave_flightFrame->setVisible(false);
ui->thewaveSettingsFrame->setVisible(false);
ui->thewaveMathematicsFrame->setVisible(false);
ui->thewaveMediaFrame->setVisible(false);
}
void Menu::showMediaFrame(QPixmap art, QString title, QString artist, bool isPlaying) {
ui->thewaveMedia_Art->setPixmap(art.scaled(32, 32));
ui->thewaveMedia_Title->setText(title);
ui->thewaveMedia_Artist->setText(artist);
if (isPlaying) {
ui->thewaveMedia_Play->setIcon(QIcon::fromTheme("media-playback-pause"));
} else {
ui->thewaveMedia_Play->setIcon(QIcon::fromTheme("media-playback-start"));
}
ui->thewaveMediaFrame->setVisible(true);
if (artist == "") {
ui->thewaveMediaFrame->setBackupText("Now Playing: " + title);
} else {
ui->thewaveMediaFrame->setBackupText("Now Playing: " + title + " · " + artist);
}
}
void Menu::showWikipediaFrame(QString title, QString text) {
ui->wikipediaTitle->setText(title);
ui->wikipediaText->setHtml(text);
ui->wikipediaFrame->setVisible(true);
ui->thewave_spacerFrame->setVisible(false);
ui->wikipediaFrame->setBackupText("Wikipedia Content");
}
void Menu::showFlightFrame(QString flight) {
ui->flightNumber->setText(flight);
ui->flightImage->setPixmap(QIcon(":/icons/flight/unknown.svg").pixmap(500, 70));
ui->thewave_flightFrame->setVisible(true);
ui->wikipediaFrame->setBackupText(flight + " has been cancelled.");
}
void Menu::showSettingFrame(QIcon icon, QString text, bool isOn) {
ui->thewaveSettingsFrame_icon->setPixmap(icon.pixmap(64, 64));
ui->thewaveSettingsFrame_Name->setText(text);
ui->thewaveSettingsFrame_Switch->setChecked(isOn);
ui->thewaveSettingsFrame->setVisible(true);
ui->thewaveSettingsFrame->setBackupText(text + " has been switched " + (isOn ? "on" : "off"));
}
void Menu::showMathematicsFrame(QString expression, QString answer) {
ui->thewaveMathematicsFrame->setVisible(true);
ui->thewaveMathematics_expression->setText(expression);
ui->thewaveMathematics_answer->setText(answer);
ui->thewaveMathematicsFrame->setBackupText(expression + answer);
}
void Menu::on_thewave_line_returnPressed()
{
while (!istheWaveReady) {
QApplication::processEvents();
}
emit thewave_processText(ui->thewave_line->text());
thewave_outputSpeech(ui->thewave_line->text());
}
void Menu::on_closetheWaveButton_2_clicked()
{
QProcess::startDetached("xdg-open https://en.wikipedia.org/wiki/" + ui->wikipediaTitle->text().replace(" ", "_"));
this->close();
}
void Menu::thewave_launchapp(QString appName) {
ui->thewave_launchFrame->setVisible(true);
QList<App> apps;
for (App app : ((AppsListModel*) ui->appsListView->model())->availableApps()) {
if (app.name().remove(" ").contains(appName.remove(" "), Qt::CaseInsensitive)) {
apps.append(app);
}
}
if (apps.count() == 0) {
ui->thewave_launch_appIcon->setVisible(false);
ui->thewave_launch_appName->setVisible(false);
ui->thewave_launch_error->setVisible(true);
ui->thewave_launch_launchapp->setVisible(false);
ui->thewave_spacerFrame->setVisible(true);
} else if (apps.count() == 1) {
ui->thewave_launch_appIcon->setVisible(true);
ui->thewave_launch_appName->setVisible(true);
ui->thewave_launch_error->setVisible(false);
ui->thewave_launchOneAppFrame->setVisible(true);
ui->thewave_launch_disambiguation->setVisible(false);
ui->thewave_launch_launchapp->setVisible(true);
ui->thewave_spacerFrame->setVisible(true);
ui->thewave_launch_appName->setText(apps.first().name());
ui->thewave_launch_appIcon->setPixmap(apps.first().icon().pixmap(64));
ui->thewave_launch_launchapp->setProperty("appcommand", apps.first().command());
emit thewave_sayLaunchApp(apps.first().name());
} else {
ui->thewave_launch_error->setVisible(false);
ui->thewave_launchOneAppFrame->setVisible(false);
ui->thewave_launch_disambiguation->setVisible(true);
ui->thewave_spacerFrame->setVisible(false);
ui->thewave_launch_disambiguation->clear();
QStringList appNames;
for (App app : apps) {
QListWidgetItem* item = new QListWidgetItem();
item->setText(app.name());
item->setIcon(app.icon());
item->setData(Qt::UserRole, app.command());
ui->thewave_launch_disambiguation->addItem(item);
appNames.append(app.name());
}
emit (thewave_sayLaunchApp_disambiguation(appNames));
}
}
void Menu::on_thewave_launch_launchapp_clicked()
{
QProcess::startDetached(ui->thewave_launch_launchapp->property("appcommand").toString().remove("%u"));
this->close();
}
void Menu::on_commandLinkButton_6_clicked()
{
this->close();
@ -954,41 +499,6 @@ void Menu::on_commandLinkButton_4_clicked()
QDBusConnection::systemBus().send(message);
}
void Menu::on_listentheWave_clicked()
{
if (this->isListening) {
emit thewaveStop();
} else {
emit thewaveBegin();
}
}
void Menu::on_thewave_launch_disambiguation_itemClicked(QListWidgetItem *item)
{
QProcess::startDetached(item->data(Qt::UserRole).toString().remove("%u"));
this->close();
}
void Menu::on_thewaveSettingsFrame_Switch_toggled(bool checked)
{
emit currentSettingChanged(checked);
}
void Menu::on_thewaveMedia_Next_clicked()
{
MainWin->nextSong();
}
void Menu::on_thewaveMedia_Play_clicked()
{
MainWin->playPause();
}
void Menu::on_thewaveMedia_Back_clicked()
{
MainWin->previousSong();
}
void Menu::mousePressEvent(QMouseEvent *event) {
}
@ -1001,50 +511,6 @@ void Menu::mouseReleaseEvent(QMouseEvent *event) {
}
theWaveFrame::theWaveFrame(QWidget *parent) : QFrame(parent)
{
}
void theWaveFrame::mousePressEvent(QMouseEvent *event) {
if (event->button() == Qt::LeftButton) {
this->startPosition = event->pos();
}
}
void theWaveFrame::mouseMoveEvent(QMouseEvent *event)
{
if (event->buttons() & Qt::LeftButton && ((event->pos() - this->startPosition).manhattanLength() >= QApplication::startDragDistance())) {
QPixmap pixmap = this->grab();
QByteArray pngArray;
QBuffer buffer(&pngArray);
buffer.open(QIODevice::WriteOnly);
pixmap.save(&buffer, "PNG");
buffer.close();
QDrag *drag = new QDrag(this);
QMimeData *mime = new QMimeData();
mime->setData("image/png", pngArray);
/*if (this->backupText() != "") {
//mime->setText(this->backupText());
mime->setText(this->backupText());
}*/
drag->setMimeData(mime);
drag->setPixmap(pixmap);
((Menu*) this->window())->collapse();
drag->exec();
((Menu*) this->window())->uncollapse();
}
}
void theWaveFrame::setBackupText(QString text) {
this->bText = text;
}
QString theWaveFrame::backupText() {
return this->bText;
}
void Menu::on_exitButton_clicked()
{
QApplication::exit(0);

91
menu.h
View file

@ -34,7 +34,6 @@
#include <systemd/sd-login.h>
#include "endsessionwait.h"
#include "mainwindow.h"
#include "thewaveworker.h"
#include "dbusevents.h"
#include "tutorialwindow.h"
#include "bthandsfree.h"
@ -43,27 +42,6 @@
#undef KeyPress
class theWaveWorker;
class theWaveFrame : public QFrame
{
Q_OBJECT
Q_PROPERTY(QString backupText READ backupText WRITE setBackupText)
public:
explicit theWaveFrame(QWidget *parent = 0);
signals:
public slots:
QString backupText();
void setBackupText(QString text);
private:
QPoint startPosition;
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
QString bText;
};
namespace Ui {
class Menu;
}
@ -79,31 +57,14 @@ public:
void setGeometry(int x, int y, int w, int h);
void setGeometry(QRect geometry);
void show(bool openTotheWave = false, bool startListening = false);
void show();
void close();
QFrame* theWaveFrame;
signals:
void menuClosing();
void thewave_processText(QString text, bool isText = false);
void thewave_sayLaunchApp(QString app);
void thewave_sayLaunchApp_disambiguation(QStringList apps);
void thewaveBegin();
void thewaveStop();
void currentSettingChanged(bool isOn);
public slots:
void collapse();
void uncollapse();
private slots:
void checkForclose();
@ -131,56 +92,10 @@ private slots:
void on_commandLinkButton_8_clicked();
void on_activateTheWave_clicked();
void on_closetheWaveButton_clicked();
void showCallFrame(bool emergency);
void resetFrames();
void showMessageFrame();
void showHelpFrame();
void showWikipediaFrame(QString title, QString text);
void thewave_launchapp(QString app);
void on_thewave_line_returnPressed();
void on_closetheWaveButton_2_clicked();
void on_thewave_launch_launchapp_clicked();
void thewave_outputSpeech(QString speech);
void showFlightFrame(QString flight);
void thewaveLoudnessChanged(qreal loudness);
void on_commandLinkButton_6_clicked();
void on_commandLinkButton_4_clicked();
void on_listentheWave_clicked();
void on_thewave_launch_disambiguation_itemClicked(QListWidgetItem *item);
void showSettingFrame(QIcon icon, QString text, bool isOn);
void on_thewaveSettingsFrame_Switch_toggled(bool checked);
void showMathematicsFrame(QString expression, QString answer);
void showMediaFrame(QPixmap art, QString title, QString artist, bool isPlaying);
void on_thewaveMedia_Next_clicked();
void on_thewaveMedia_Play_clicked();
void on_thewaveMedia_Back_clicked();
void on_exitButton_clicked();
void on_fakeEndButton_clicked();
@ -204,7 +119,6 @@ private:
int pinnedAppsCount = 0;
bool doCheckForClose = false;
bool istheWaveOpen = false;
//void closeEvent(QCloseEvent *event);
void paintEvent(QPaintEvent* event);
@ -216,10 +130,7 @@ private:
void reject();
theWaveWorker* waveWorker;
BTHandsfree* bt;
bool isListening = false;
bool istheWaveReady = false;
};
#endif // MENU_H

1400
menu.ui

File diff suppressed because it is too large Load diff

View file

@ -47,7 +47,6 @@ NativeEventFilter::NativeEventFilter(QObject* parent) : QObject(parent)
XGrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_Delete), ControlMask | Mod1Mask, RootWindow(QX11Info::display(), 0), true, GrabModeAsync, GrabModeAsync);
XGrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_L), Mod4Mask, RootWindow(QX11Info::display(), 0), true, GrabModeAsync, GrabModeAsync);
XGrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_F2), Mod1Mask, RootWindow(QX11Info::display(), 0), true, GrabModeAsync, GrabModeAsync);
XGrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_space), Mod4Mask, RootWindow(QX11Info::display(), 0), true, GrabModeAsync, GrabModeAsync);
XGrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_P), Mod4Mask | Mod1Mask, RootWindow(QX11Info::display(), 0), true, GrabModeAsync, GrabModeAsync);
XGrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_F1), Mod4Mask, RootWindow(QX11Info::display(), 0), true, GrabModeAsync, GrabModeAsync);
XGrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_F2), Mod4Mask, RootWindow(QX11Info::display(), 0), true, GrabModeAsync, GrabModeAsync);
@ -86,7 +85,6 @@ NativeEventFilter::~NativeEventFilter() {
XUngrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_F2), Mod1Mask, QX11Info::appRootWindow());
XUngrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_Super_L), AnyModifier, QX11Info::appRootWindow());
XUngrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_Super_R), AnyModifier, QX11Info::appRootWindow());
XUngrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_space), Mod4Mask, QX11Info::appRootWindow());
XUngrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_P), Mod4Mask | Mod1Mask, QX11Info::appRootWindow());
XUngrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_F1), Mod4Mask, QX11Info::appRootWindow());
XUngrabKey(QX11Info::display(), XKeysymToKeycode(QX11Info::display(), XK_F2), Mod4Mask, QX11Info::appRootWindow());
@ -273,9 +271,6 @@ bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *mes
MainWin->openMenu();
}
ignoreSuper = false;
} else if (button->detail == XKeysymToKeycode(QX11Info::display(), XK_space) && button->state == Mod4Mask) { //theWave
ignoreSuper = true;
MainWin->openMenu(true, true);
} else if (button->detail == XKeysymToKeycode(QX11Info::display(), XK_F1) && (button->state == Mod4Mask)) {
MainWin->getInfoPane()->show(InfoPaneDropdown::Clock);
ignoreSuper = true;

View file

@ -22,7 +22,12 @@
#include "ui_onboarding.h"
#include "internationalisation.h"
#define ChangelogOnbording "New in theShell 7.0:\n"\
#define ChangelogOnbording \
"New in theShell 7.1:\n"\
"- theWave has been discontinued.\n"\
"- New Notifications system\n"\
"\n"\
"New in theShell 7.0:\n"\
"- Quiet Mode has been added to theShell! Click on the volume icon in the bar, or head to the Notifications Status Center pane to change the setting.\n"\
"- The Gateway has been revamped and now shows your apps properly, as well as updates automatically whenever you install a new app.\n"\
"- Flight Mode has been added\n"\
@ -100,7 +105,6 @@ Onboarding::Onboarding(QWidget *parent) :
//ui->buttonBox->setVisible(false);
ui->backButton->setVisible(false);
ui->changelog->setText(ChangelogOnbording);
ui->thewaveLogo->setPixmap(QIcon(":/icons/thewave.svg").pixmap(256, 256));
ui->stackedWidget->setCurrentIndex(0);
ui->welcomeLabel->setText(tr("Welcome to theShell %1!").arg(TS_VERSION));
ui->tsLogo->setPixmap(QIcon::fromTheme("theshell").pixmap(256, 256));
@ -171,10 +175,9 @@ void Onboarding::on_stackedWidget_currentChanged(int arg1)
ui->backButton->setVisible(false);
break;
case 3:
case 4:
ui->nextButton->setEnabled(false);
break;
case 5:
case 4:
ui->nextButton->setText(tr("Start"));
break;
}
@ -182,7 +185,7 @@ void Onboarding::on_stackedWidget_currentChanged(int arg1)
void Onboarding::on_nextButton_clicked()
{
if (ui->stackedWidget->currentIndex() == 5) {
if (ui->stackedWidget->currentIndex() == 4) {
onboardingDone = true;
this->accept();
} else {
@ -201,18 +204,6 @@ void Onboarding::on_beginButton_clicked()
this->accept();
}
void Onboarding::on_enabletheWaveButton_clicked()
{
settings.setValue("thewave/enabled", true);
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->currentIndex() + 1);
}
void Onboarding::on_disabletheWaveButton_clicked()
{
settings.setValue("thewave/enabled", false);
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->currentIndex() + 1);
}
void Onboarding::on_changeLanguageButton_clicked()
{
ui->stackedWidget->setCurrentIndex(0);

View file

@ -54,10 +54,6 @@ private slots:
void on_beginButton_clicked();
void on_enabletheWaveButton_clicked();
void on_disabletheWaveButton_clicked();
void on_changeLanguageButton_clicked();
void on_localeList_currentRowChanged(int currentRow);

View file

@ -257,137 +257,6 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="text">
<string>theWave</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>theWave is a personal assistant that comes with theShell.</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="thewaveLogo">
<property name="text">
<string notr="true">theWave Logo</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>You can find theWave inside the Gateway or on the bar.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QPushButton" name="enabletheWaveButton">
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="text">
<string>Enable theWave</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="disabletheWaveButton">
<property name="text">
<string>Disable theWave</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_6">
<property name="autoFillBackground">
<bool>true</bool>

View file

@ -33,7 +33,6 @@
</qresource>
<qresource prefix="/icons">
<file>icon.svg</file>
<file>thewave.svg</file>
<file>blank.svg</file>
<file>icon-bp.svg</file>
</qresource>

View file

@ -59,7 +59,6 @@ SOURCES += main.cpp\
upowerdbus.cpp \
infopanedropdown.cpp \
clickablelabel.cpp \
thewaveworker.cpp \
loginsplash.cpp \
hoverframe.cpp \
choosebackground.cpp \
@ -73,7 +72,6 @@ SOURCES += main.cpp\
dbusevents.cpp \
fadebutton.cpp \
rundialog.cpp \
thewavefeedbackframe.cpp \
mousescrollwidget.cpp \
animatedstackedwidget.cpp \
onboarding.cpp \
@ -104,7 +102,6 @@ HEADERS += mainwindow.h \
upowerdbus.h \
infopanedropdown.h \
clickablelabel.h \
thewaveworker.h \
loginsplash.h \
hoverframe.h \
choosebackground.h \
@ -118,7 +115,6 @@ HEADERS += mainwindow.h \
dbusevents.h \
fadebutton.h \
rundialog.h \
thewavefeedbackframe.h \
mousescrollwidget.h \
animatedstackedwidget.h \
onboarding.h \

View file

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48"
height="48"
viewBox="0 0 48 48.000001"
id="svg4207"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="thewave.svg">
<defs
id="defs4209">
<linearGradient
id="linearGradient5737"
osb:paint="solid">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop5739" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient4763">
<stop
style="stop-color:#646400;stop-opacity:1"
offset="0"
id="stop4765" />
<stop
style="stop-color:#c8c800;stop-opacity:1"
offset="1"
id="stop4767" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4763"
id="linearGradient4769"
x1="3"
y1="1049.3622"
x2="45"
y2="1007.3622"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.047619,0,0,1.047619,-1.1428552,-1053.3318)" />
<filter
style="color-interpolation-filters:sRGB"
id="filter4279"
inkscape:label="filter1">
<feGaussianBlur
stdDeviation="6"
id="feGaussianBlur4285" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#000000"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="4"
inkscape:cx="32.762357"
inkscape:cy="31.145584"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:window-width="1280"
inkscape:window-height="757"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid4757"
snapvisiblegridlinesonly="false"
originx="2.7755576e-17"
originy="2.4980019e-16"
spacingx="1"
spacingy="1"
dotted="false"
empspacing="4" />
</sodipodi:namedview>
<metadata
id="metadata4212">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1004.3622)">
<path
style="opacity:1;fill:url(#linearGradient4769);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 24 2 A 22 22 0 0 0 19.328125 2.515625 A 12 12 0 0 1 24 12 A 12 12 0 0 1 12 24 A 12 12 0 0 1 2.5234375 19.353516 A 22 22 0 0 0 2 24 A 22 22 0 0 0 2.0078125 24.177734 C 5.4851324 24.785533 7.7203862 26.892261 9.4140625 28.585938 C 11.414062 30.585938 12.666667 32 16 32 C 19.333333 32 20.585938 30.585938 22.585938 28.585938 C 24.585938 26.585938 27.333333 24 32 24 C 36.666667 24 39.414062 26.585938 41.414062 28.585938 C 42.579808 29.751682 43.500807 30.706925 44.71875 31.310547 A 22 22 0 0 0 46 24 A 22 22 0 0 0 24 2 z M 32 28 C 28.666667 28 27.414062 29.416016 25.414062 31.416016 C 23.414062 33.416016 20.666667 36 16 36 C 11.333333 36 8.5859375 33.416016 6.5859375 31.416016 C 5.1821671 30.012245 4.1335587 28.907868 2.4882812 28.367188 A 22 22 0 0 0 24 46 A 22 22 0 0 0 35.589844 42.648438 A 5 5 0 0 1 34 39 A 5 5 0 0 1 39 34 A 5 5 0 0 1 42.652344 35.591797 A 22 22 0 0 0 43.064453 34.855469 C 41.172557 33.92066 39.746101 32.576179 38.585938 31.416016 C 36.585938 29.416016 35.333333 28 32 28 z "
id="path4761"
transform="translate(0,1004.3622)" />
<g
id="g4157">
<path
inkscape:connector-curvature="0"
id="path4771"
d="m 54,1025.3622 -3,3 3,3 0,0 0,0"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path4773"
d="m 51,1028.3622 6,0"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
id="g4153">
<path
inkscape:connector-curvature="0"
id="path4801"
d="m 21,998.3622 3,3 3,-3"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path4803"
d="m 24,1001.3622 0,-6"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
id="g4254"
transform="translate(1.4285711,1.1071)"
style="stroke-width:1.39999998;stroke-miterlimit:4;stroke-dasharray:none" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -1,68 +0,0 @@
/****************************************
*
* theShell - Desktop Environment
* Copyright (C) 2017 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
#include "thewavefeedbackframe.h"
theWaveFeedbackFrame::theWaveFeedbackFrame(QWidget *parent) : QFrame(parent)
{
connect(&indeterminateTimer, SIGNAL(timeout()), this, SLOT(repaint()));
indeterminateTimer.setInterval(10);
for (int i = 0; i < this->width(); i = i + 2) {
levels.append((qreal) 1 / (qreal) this->height());
}
}
void theWaveFeedbackFrame::paintEvent(QPaintEvent *event) {
QPainter painter(this);
int i = this->width();
if (indeterminate) {
//qreal random = (qreal) qrand() / (RAND_MAX);
levels.insert(0, (qSin(qDegreesToRadians((qreal) indeterminateStage * 3 - 90))) / 2 + 0.5);
indeterminateStage++;
}
for (qreal level : levels) {
//painter.drawLine(i, this->height(), i, this->height() - (level * this->height()));
int distanceFromMiddle = (level * this->height()) / 2;
painter.drawLine(i, this->height() / 2 + distanceFromMiddle, i, this->height() / 2 - distanceFromMiddle);
i = i - 2;
}
event->accept();
}
void theWaveFeedbackFrame::addLevel(qreal level) {
if (level == -1) { //Processing
indeterminate = true;
indeterminateTimer.start();
} else if (level == -2) { //Reset
levels.clear();
for (int i = 0; i < this->width(); i = i + 2) {
levels.append((qreal) 1 / (qreal) this->height());
}
indeterminateTimer.stop();
} else {
levels.insert(0, level);
this->repaint();
indeterminate = false;
indeterminateStage = 0;
indeterminateTimer.stop();
}
}

View file

@ -1,51 +0,0 @@
/****************************************
*
* theShell - Desktop Environment
* Copyright (C) 2017 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
#ifndef THEWAVEFEEDBACKFRAME_H
#define THEWAVEFEEDBACKFRAME_H
#include <QFrame>
#include <QPaintEvent>
#include <QPainter>
#include <QTimer>
#include <QDebug>
#include <QtMath>
class theWaveFeedbackFrame : public QFrame
{
Q_OBJECT
public:
explicit theWaveFeedbackFrame(QWidget *parent = 0);
signals:
public slots:
void addLevel(qreal level);
private:
void paintEvent(QPaintEvent *event);
QList<qreal> levels;
bool indeterminate = false;
int indeterminateStage = 0;
QTimer indeterminateTimer;
};
#endif // THEWAVEFEEDBACKFRAME_H

File diff suppressed because it is too large Load diff

View file

@ -1,160 +0,0 @@
/****************************************
*
* theShell - Desktop Environment
* Copyright (C) 2017 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
#ifndef THEWAVEWORKER_H
#define THEWAVEWORKER_H
#include <QObject>
#include <QProcess>
#include <QFrame>
#include <QSoundEffect>
#include <QSound>
#include <QUrl>
#include <QDebug>
#include <QMap>
#include <QTime>
#include <QAudioRecorder>
#include <QAudioEncoderSettings>
#include <QAudioProbe>
#include <QThread>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QSettings>
#include <QXmlSimpleReader>
#include <QXmlInputSource>
#include <QEventLoop>
#include <QDir>
#include <QApplication>
#include <QGeoPositionInfoSource>
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <qmath.h>
#include <KF5/AkonadiCore/control.h>
#include <KF5/AkonadiCore/servermanager.h>
#include <KF5/AkonadiCore/session.h>
#include "menu.h"
class Menu;
class theWaveWorker : public QObject
{
Q_OBJECT
enum SpeechState {
Idle,
TimerGetTime,
emailGetRecipient,
emailGetSubject,
emailGetBody,
emailConfirm
};
QMap<QString, float> numberDictionary;
public:
explicit theWaveWorker(QObject *parent = 0);
~theWaveWorker();
bool isDisabled();
signals:
void outputSpeech(QString);
void outputResponse(QString);
void outputHint(QString);
void loudnessChanged(qreal loudness);
void outputFrame(QFrame *);
void complete();
void startedListening();
void stoppedListening();
void showBigListenFrame();
void hideBigListenFrame();
void finished();
void resetFrames();
void showCallFrame(bool emergency);
void showMessageFrame();
void showHelpFrame();
void showWikipediaFrame(QString title, QString text);
void launchApp(QString app);
void doLaunchApp(QString app);
void showFlightFrame(QString flight);
void showSettingsFrame(QIcon icon, QString setting, bool isOn);
void showMathematicsFrame(QString expression, QString answer);
void showMediaFrame(QPixmap art, QString title, QString artist, bool isPlaying);
void setTimer(QTime);
public slots:
void begin();
void endAndProcess();
void processSpeech(QString speech, bool voiceFeedback = true);
void quit();
void soundBuffer(QAudioBuffer buffer);
bool launchAkonadi();
void launchAppReply(QString app);
void launchApp_disambiguation(QStringList apps);
void currentSettingChanged(bool isOn);
private slots:
void outputAvailable();
void SetSetting(QString setting, bool isOn);
private:
QProcess *speechProc;
QString buffer;
QTime endListenTimer;
qreal oldLoudness = 0;
qreal maxLoudnessForSession = 0;
bool isListeningAfterLoudnessChange = false;
void speak(QString speech, bool restartOnceComplete = false);
SpeechState state = Idle;
QSoundEffect* startListeningSound, *okListeningSound, *errorListeningSound, *stopListeningSound;
QAudioRecorder* testRecorder = NULL;
QAudioRecorder* recorder = NULL;
QAudioProbe* probe = NULL;
QGeoPositionInfoSource* geolocationSource;
QGeoCoordinate currentCoordinates;
bool stopEverything = false;
bool resetOnNextBegin = false;
bool speechPlaying = false;
bool disabled = false;
bool isRunning = false;
bool noVoiceInput = true;
QString currentSetting;
QSettings settings;
};
#endif // THEWAVEWORKER_H