diff --git a/RingWinClient.pro b/RingWinClient.pro index e28a4ee5c18f0ad90c606ffd6fe6fd4c5d593a96..2be72d92db262f100cef5aa33147e080c9140cf3 100644 --- a/RingWinClient.pro +++ b/RingWinClient.pro @@ -32,7 +32,8 @@ SOURCES += main.cpp\ aboutdialog.cpp \ pivotviewwidget.cpp \ pivotcontrol.cpp \ - videowidget.cpp + videowidget.cpp \ + utils.cpp HEADERS += mainwindow.h \ callwidget.h \ @@ -46,7 +47,8 @@ HEADERS += mainwindow.h \ aboutdialog.h \ pivotviewwidget.h \ pivotcontrol.h \ - videowidget.h + videowidget.h \ + utils.h FORMS += mainwindow.ui \ callwidget.ui \ @@ -57,6 +59,8 @@ FORMS += mainwindow.ui \ aboutdialog.ui \ pivotviewwidget.ui +win32: LIBS += -lole32 -luuid -lshlwapi + INCLUDEPATH += /home/edric/Documents/CrossWorkspace/ring/binArch/include/libringclient win32: LIBS += -L/home/edric/Documents/CrossWorkspace/ring/binArch/lib/ -lringclient diff --git a/aboutdialog.cpp b/aboutdialog.cpp index ecec731b323802b4767c6ba1cd61e226e605bea2..cca1eec25c9e8b9fc34dd2fdf44887a549423653 100644 --- a/aboutdialog.cpp +++ b/aboutdialog.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/aboutdialog.h b/aboutdialog.h index 17df05f489fdb9a7c37d7584594c16eb51ce909b..838418f183013c12c87090861d59012f380a2650 100644 --- a/aboutdialog.h +++ b/aboutdialog.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/accountdetails.cpp b/accountdetails.cpp index c18f75321e3430f655007f03d6031491d2825dbb..51559062506e89dfda0277da104c99f566c7b48a 100644 --- a/accountdetails.cpp +++ b/accountdetails.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/accountdetails.h b/accountdetails.h index 6e76b87b831cf3fffb0dd333284c5673cf45a47c..29212f98c3d2ecd4c0d99611f2f6bb56b1937a6d 100644 --- a/accountdetails.h +++ b/accountdetails.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/callwidget.cpp b/callwidget.cpp index fae63aaafeb27bed36d63175577de6b5a077c7d3..4e444c090accd69b133966bff50a996744668aa3 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * @@ -27,6 +27,7 @@ #include "fallbackpersoncollection.h" #include "accountmodel.h" +#include "utils.h" CallWidget::CallWidget(QWidget *parent) : NavWidget(Main ,parent), @@ -91,6 +92,7 @@ CallWidget::findRingAccount() { if (!found) { AccountModel::instance()->add("RING", Account::Protocol::RING); AccountModel::instance()->save(); + Utils::CreateStartupLink(); findRingAccount(); } } diff --git a/callwidget.h b/callwidget.h index e8c1bbda33bddfe132c53b42f9fbb6ae971e562e..a33a6e14cbf1a90b4d064589d0be75b4d9bb8b64 100644 --- a/callwidget.h +++ b/callwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/configurationwidget.cpp b/configurationwidget.cpp index 784e8ea449e10dee9ba19a3ad8144d977c640477..6be02e545a212de854146099146d28008683a0ee 100644 --- a/configurationwidget.cpp +++ b/configurationwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * @@ -23,12 +23,13 @@ #include "video/channel.h" #include "video/resolution.h" #include "video/rate.h" +#include "video/previewmanager.h" #include "accountmodel.h" #include "protocolmodel.h" #include "accountdetails.h" -#include <video/previewmanager.h> +#include "utils.h" ConfigurationWidget::ConfigurationWidget(QWidget *parent) : NavWidget(Nav, parent), @@ -54,6 +55,7 @@ ConfigurationWidget::ConfigurationWidget(QWidget *parent) : ui->accountDetailLayout->addWidget(accountDetails_); ui->testVideoButton->setCheckable(true); ui->accountTypeBox->setModel(accountModel_->protocolModel()); + ui->startupBox->setChecked(Utils::CheckStartupLink()); } void ConfigurationWidget::atExit() { @@ -155,3 +157,11 @@ ConfigurationWidget::on_addAccountButton_clicked() ui->accountTypeBox->currentIndex(), 0)); accountModel_->save(); } + +void ConfigurationWidget::on_startupBox_toggled(bool checked) +{ + if (checked) + Utils::CreateStartupLink(); + else + Utils::DeleteStartupLink(); +} diff --git a/configurationwidget.h b/configurationwidget.h index 8e61637fde3ef1347f313583785cc24764835af6..5cd624d42b2a7667664669ccaef14d789ddbfac6 100644 --- a/configurationwidget.h +++ b/configurationwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * @@ -54,6 +54,8 @@ private slots: private slots: void accountSelected(QItemSelection itemSel); + void on_startupBox_toggled(bool checked); + private: Ui::ConfigurationWidget *ui; AccountModel* accountModel_; diff --git a/configurationwidget.ui b/configurationwidget.ui index 4266ffdc7844ed17cd5791666629ec81e94b6061..e0e9ee0d58def1c378b844a8c4dec84288f6acec 100644 --- a/configurationwidget.ui +++ b/configurationwidget.ui @@ -19,7 +19,7 @@ <property name="windowTitle"> <string>Form</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> @@ -29,7 +29,7 @@ <attribute name="title"> <string>Video</string> </attribute> - <layout class="QGridLayout" name="gridLayout" rowstretch="0,1" columnstretch="0,0"> + <layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,0"> <item row="0" column="0"> <layout class="QVBoxLayout" name="verticalLayout_3"> <property name="spacing"> @@ -223,6 +223,16 @@ </widget> </widget> </item> + <item> + <widget class="QCheckBox" name="startupBox"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string>Launch Ring on Startup</string> + </property> + </widget> + </item> </layout> </widget> <customwidgets> diff --git a/main.cpp b/main.cpp index e838e873ca22edc467d230cbb8e231477c9c2eea..24831d4e62f2cad7c1200071abd2223cef733671 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/mainbar.cpp b/mainbar.cpp index a19d9e2555ee5bbe71870443fb21411deadfe384..46351d8e81bf671e56ab7858c53a0de63e1a0ab5 100644 --- a/mainbar.cpp +++ b/mainbar.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/mainbar.h b/mainbar.h index 72866724e9961ecbfa3da0a261c1ea8eb52650d5..bbc9932e6d910888b67cbb0a376915559fd3d7ca 100644 --- a/mainbar.h +++ b/mainbar.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/mainwindow.cpp b/mainwindow.cpp index 2120e9798082c357dfb4699ebef6ab68ddb3c990..a852a18ee727f391b5a571cb9eea384d451c5297 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * @@ -75,7 +75,8 @@ MainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason) { this->show(); } -void MainWindow::onIncomingCall(Call *call) { +void +MainWindow::onIncomingCall(Call *call) { Q_UNUSED(call); QWidget::showNormal(); } diff --git a/mainwindow.h b/mainwindow.h index b1c71742058d6a0a83318c0052dfc9806631458c..6f46d97c70a0406985fd4cb2738e3878f72d902d 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/navbar.cpp b/navbar.cpp index 546ce8e81a0b2c03600279697835190637083b09..a51dd614fa1e947b861e9ee0242efa9d007dbfdc 100644 --- a/navbar.cpp +++ b/navbar.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/navbar.h b/navbar.h index 32a8d43f190f4f47302eea947867444ff0993182..58b9bbe82f8404d3fc8dc146a7832cc61bc2b8b7 100644 --- a/navbar.h +++ b/navbar.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/navstack.cpp b/navstack.cpp index 745c4f000d1d11904b143c647631722d1fb6db1e..333e422dbaa0607c1adffc0318e955399543ab7c 100644 --- a/navstack.cpp +++ b/navstack.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/navstack.h b/navstack.h index b9ee234fafebdef061704dd2d7499869da37967c..337252e44376e2d8b1f8c26e0e3fead2c2e36d47 100644 --- a/navstack.h +++ b/navstack.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/navwidget.cpp b/navwidget.cpp index dba19a5a78b7de38f49861b3659c12e05185734b..a63a53c352e9d6edb2abbaf33c29d188681c389b 100644 --- a/navwidget.cpp +++ b/navwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/navwidget.h b/navwidget.h index ca2742711b051ee185f883414c626aff86122041..053f70f5d19aa59e62bee82a3bc602c4c3caadc0 100644 --- a/navwidget.h +++ b/navwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/pivotcontrol.cpp b/pivotcontrol.cpp index f16bd9dd3c9a5a4c84c2ffe22f1e062705229346..cb708c16dab8b07e78ec09d4d43a12350c2a6aa1 100644 --- a/pivotcontrol.cpp +++ b/pivotcontrol.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/pivotcontrol.h b/pivotcontrol.h index 66cd9455b326ed5304ba8a23867c537e6855de56..5168ca7f924397e57d8b8cfc269e448b786d96c3 100644 --- a/pivotcontrol.h +++ b/pivotcontrol.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/pivotviewwidget.cpp b/pivotviewwidget.cpp index 996ffd6880a765795a1c3c1339d7823cee066afc..2bb35941903dc21c698416c28d93591a29068771 100644 --- a/pivotviewwidget.cpp +++ b/pivotviewwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/pivotviewwidget.h b/pivotviewwidget.h index 96c6467a7d4c176b10d28588773ca05b10f56520..44bbd62a2b1197b873b3def75786a93dbb7b8622 100644 --- a/pivotviewwidget.h +++ b/pivotviewwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify * diff --git a/utils.cpp b/utils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..78d9561de7c0d753942282b2e2152122db4491f1 --- /dev/null +++ b/utils.cpp @@ -0,0 +1,81 @@ +/*************************************************************************** + * Copyright (C) 2015 by Savoir-Faire Linux * + * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* + * * + * 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 "utils.h" + +bool +Utils::CreateStartupLink() { + TCHAR userHome[MAX_PATH]; + SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, userHome); + + TCHAR workingDirectory[MAX_PATH]; + GetCurrentDirectory(MAX_PATH, workingDirectory); + + std::wstring programPath(workingDirectory); + programPath += TEXT("\\RingClientWindows.exe"); + + std::wstring linkPath(userHome); + linkPath += TEXT("\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\Ring.lnk"); + + return Utils::CreateLink(programPath.c_str(), linkPath.c_str()); +} + +bool +Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) { + HRESULT hres; + IShellLink* psl; + + hres = CoCreateInstance(CLSID_ShellLink, NULL, + CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl); + if (SUCCEEDED(hres)) + { + IPersistFile* ppf; + psl->SetPath(lpszPathObj); + + hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf); + if (SUCCEEDED(hres)) + { + hres = ppf->Save(lpszPathLink, TRUE); + ppf->Release(); + } + psl->Release(); + } + return hres; +} + +void +Utils::DeleteStartupLink() { + TCHAR userHome[MAX_PATH]; + SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, userHome); + + std::wstring linkPath(userHome); + linkPath += TEXT("\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\Ring.lnk"); + + DeleteFile(linkPath.c_str()); +} + +bool +Utils::CheckStartupLink() { + TCHAR userHome[MAX_PATH]; + SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, userHome); + + std::wstring linkPath(userHome); + linkPath += TEXT("\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\Ring.lnk"); + return PathFileExists(linkPath.c_str()); +} + diff --git a/utils.h b/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..1a79740fe672e940571d00e2b9d869e4c3a65069 --- /dev/null +++ b/utils.h @@ -0,0 +1,40 @@ +/*************************************************************************** + * Copyright (C) 2015 by Savoir-Faire Linux * + * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* + * * + * 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 UTILS_H +#define UTILS_H + +#include <windows.h> +#include <lmcons.h> +#include <shobjidl.h> +#include <shlguid.h> +#include <shlobj.h> +#include <shlwapi.h> + +#include <string> + +class Utils +{ +public: + static bool CreateStartupLink(); + static void DeleteStartupLink(); + static bool CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink); + static bool CheckStartupLink(); +}; + +#endif // UTILS_H diff --git a/videowidget.cpp b/videowidget.cpp index a2ea7f74ec13a8e2229468d5439c5c21739a0c09..c8f2f77793b537cd261a46fa946dc0e0a3ce67d3 100644 --- a/videowidget.cpp +++ b/videowidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2015 by Savoir-Faire Linux * + * Copyright (C) 2015 by Savoir-Faire Linux * * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* * * * This program is free software; you can redistribute it and/or modify *