Removed unused files

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-11-09 18:19:04 -02:00 committed by Dirk Hohndel
parent f5f2c37184
commit e1d43ade27
3 changed files with 6 additions and 414 deletions

View file

@ -1,173 +0,0 @@
#include "preferences.h"
#include "mainwindow.h"
#include "models.h"
#include "divelocationmodel.h"
#include "prefs-macros.h"
#include "qthelper.h"
#include "subsurfacestartup.h"
#include <QSettings>
#include <QFileDialog>
#include <QMessageBox>
#include <QShortcut>
#include <QNetworkProxy>
#include <QNetworkCookieJar>
#include "subsurfacewebservices.h"
#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
#include "socialnetworks.h"
#include <QWebView>
#endif
PreferencesDialog *PreferencesDialog::instance()
{
static PreferencesDialog *dialog = new PreferencesDialog(MainWindow::instance());
return dialog;
}
PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
FacebookManager *fb = FacebookManager::instance();
facebookWebView = new QWebView(this);
ui.fbWebviewContainer->layout()->addWidget(facebookWebView);
if (fb->loggedIn()) {
facebookLoggedIn();
} else {
facebookDisconnect();
}
connect(facebookWebView, &QWebView::urlChanged, fb, &FacebookManager::tryLogin);
connect(fb, &FacebookManager::justLoggedIn, this, &PreferencesDialog::facebookLoggedIn);
connect(ui.fbDisconnect, &QPushButton::clicked, fb, &FacebookManager::logout);
connect(fb, &FacebookManager::justLoggedOut, this, &PreferencesDialog::facebookDisconnect);
#endif
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
// connect(ui.defaultSetpoint, SIGNAL(valueChanged(double)), this, SLOT(defaultSetpointChanged(double)));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close()));
loadSettings();
setUiFromPrefs();
rememberPrefs();
}
void PreferencesDialog::facebookLoggedIn()
{
#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
ui.fbDisconnect->show();
ui.fbWebviewContainer->hide();
ui.fbWebviewContainer->setEnabled(false);
ui.FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the button below"));
#endif
}
void PreferencesDialog::facebookDisconnect()
{
#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
// remove the connect/disconnect button
// and instead add the login view
ui.fbDisconnect->hide();
ui.fbWebviewContainer->show();
ui.fbWebviewContainer->setEnabled(true);
ui.FBLabel->setText(tr("To connect to Facebook, please log in. This enables Subsurface to publish dives to your timeline"));
if (facebookWebView) {
facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
}
#endif
}
void PreferencesDialog::showEvent(QShowEvent *event)
{
setUiFromPrefs();
rememberPrefs();
QDialog::showEvent(event);
}
void PreferencesDialog::setUiFromPrefs()
{
}
void PreferencesDialog::restorePrefs()
{
prefs = oldPrefs;
setUiFromPrefs();
}
void PreferencesDialog::rememberPrefs()
{
oldPrefs = prefs;
}
void PreferencesDialog::syncSettings()
{
}
void PreferencesDialog::loadSettings()
{
// This code was on the mainwindow, it should belong nowhere, but since we didn't
// correctly fixed this code yet ( too much stuff on the code calling preferences )
// force this here.
loadPreferences();
QSettings s;
QVariant v;
}
void PreferencesDialog::buttonClicked(QAbstractButton *button)
{
switch (ui.buttonBox->standardButton(button)) {
case QDialogButtonBox::Discard:
restorePrefs();
syncSettings();
close();
break;
case QDialogButtonBox::Apply:
syncSettings();
break;
case QDialogButtonBox::FirstButton:
syncSettings();
close();
break;
default:
break; // ignore warnings.
}
}
#undef SB
#if 0
// TODO: Copy this later.
void PreferencesDialog::on_resetSettings_clicked()
{
QSettings s;
QMessageBox response(this);
response.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
response.setDefaultButton(QMessageBox::Cancel);
response.setWindowTitle(tr("Warning"));
response.setText(tr("If you click OK, all settings of Subsurface will be reset to their default values. This will be applied immediately."));
response.setWindowModality(Qt::WindowModal);
int result = response.exec();
if (result == QMessageBox::Ok) {
copy_prefs(&default_prefs, &prefs);
setUiFromPrefs();
Q_FOREACH (QString key, s.allKeys()) {
s.remove(key);
}
syncSettings();
close();
}
}
#endif
void PreferencesDialog::emitSettingsChanged()
{
emit settingsChanged();
}

View file

@ -1,241 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PreferencesDialog</class>
<widget class="QDialog" name="PreferencesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>835</width>
<height>698</height>
</rect>
</property>
<property name="windowTitle">
<string>Preferences</string>
</property>
<property name="windowIcon">
<iconset>
<normalon>:/subsurface-icon</normalon>
</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="mainHorizontalLayout">
<item>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="layoutMode">
<enum>QListView::Batched</enum>
</property>
<property name="spacing">
<number>0</number>
</property>
<property name="gridSize">
<size>
<width>110</width>
<height>40</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="currentRow">
<number>-1</number>
</property>
<item>
<property name="text">
<string>Facebook</string>
</property>
<property name="icon">
<iconset>
<normalon>:/facebook</normalon>
</iconset>
</property>
</item>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="facebook_page">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="fbLayout" stretch="0">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="FBLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Connect to facebook text placeholder</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="fbWebviewContainer" native="true">
<layout class="QVBoxLayout" name="verticalLayout_10"/>
</widget>
</item>
<item>
<widget class="QPushButton" name="fbDisconnect">
<property name="text">
<string>Disconnect</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Discard|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PreferencesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>264</x>
<y>720</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PreferencesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>332</x>
<y>720</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>listWidget</sender>
<signal>currentRowChanged(int)</signal>
<receiver>stackedWidget</receiver>
<slot>setCurrentIndex(int)</slot>
<hints>
<hint type="sourcelabel">
<x>37</x>
<y>97</y>
</hint>
<hint type="destinationlabel">
<x>282</x>
<y>18</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -0,0 +1,6 @@
#include "isocialnetworkintegration.h"
//Hack for moc.
ISocialNetworkIntegration::ISocialNetworkIntegration(QObject* parent)
{
}