Skip to content

Commit

Permalink
updater now works fine
Browse files Browse the repository at this point in the history
  • Loading branch information
pypt committed Jun 1, 2012
1 parent 944947f commit 25c6fd7
Show file tree
Hide file tree
Showing 10 changed files with 483 additions and 156 deletions.
12 changes: 8 additions & 4 deletions Fervor.pri
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,27 @@ HEADERS += tests/fvversioncomparatortest.h




DEPENDPATH += "$$PWD"
INCLUDEPATH += "$$PWD"

SOURCES += fvupdatewindow.cpp \
fvupdater.cpp \
fvversioncomparator.cpp \
fvplatform.cpp \
fvignoredversions.cpp
fvignoredversions.cpp \
fvavailableupdate.cpp \
fvupdateconfirmdialog.cpp

HEADERS += fvupdatewindow.h \
fvupdater.h \
fvversioncomparator.h \
fvplatform.h \
fvignoredversions.h
fvignoredversions.h \
fvavailableupdate.h \
fvupdateconfirmdialog.h

FORMS += fvupdatewindow.ui
FORMS += fvupdatewindow.ui \
fvupdateconfirmdialog.ui

TRANSLATIONS += fervor_lt.ts
CODECFORTR = UTF-8
97 changes: 97 additions & 0 deletions fvavailableupdate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#include "fvavailableupdate.h"

FvAvailableUpdate::FvAvailableUpdate(QObject *parent) :
QObject(parent)
{
// noop
}

QString FvAvailableUpdate::GetTitle()
{
return m_title;
}

void FvAvailableUpdate::SetTitle(QString title)
{
m_title = title;
}

QUrl FvAvailableUpdate::GetReleaseNotesLink()
{
return m_releaseNotesLink;
}

void FvAvailableUpdate::SetReleaseNotesLink(QUrl releaseNotesLink)
{
m_releaseNotesLink = releaseNotesLink;
}

void FvAvailableUpdate::SetReleaseNotesLink(QString releaseNotesLink)
{
SetReleaseNotesLink(QUrl(releaseNotesLink));
}

QString FvAvailableUpdate::GetPubDate()
{
return m_pubDate;
}

void FvAvailableUpdate::SetPubDate(QString pubDate)
{
m_pubDate = pubDate;
}

QUrl FvAvailableUpdate::GetEnclosureUrl()
{
return m_enclosureUrl;
}

void FvAvailableUpdate::SetEnclosureUrl(QUrl enclosureUrl)
{
m_enclosureUrl = enclosureUrl;
}

void FvAvailableUpdate::SetEnclosureUrl(QString enclosureUrl)
{
SetEnclosureUrl(QUrl(enclosureUrl));
}

QString FvAvailableUpdate::GetEnclosureVersion()
{
return m_enclosureVersion;
}

void FvAvailableUpdate::SetEnclosureVersion(QString enclosureVersion)
{
m_enclosureVersion = enclosureVersion;
}

QString FvAvailableUpdate::GetEnclosurePlatform()
{
return m_enclosurePlatform;
}

void FvAvailableUpdate::SetEnclosurePlatform(QString enclosurePlatform)
{
m_enclosurePlatform = enclosurePlatform;
}

unsigned long FvAvailableUpdate::GetEnclosureLength()
{
return m_enclosureLength;
}

void FvAvailableUpdate::SetEnclosureLength(unsigned long enclosureLength)
{
m_enclosureLength = enclosureLength;
}

QString FvAvailableUpdate::GetEnclosureType()
{
return m_enclosureType;
}

void FvAvailableUpdate::SetEnclosureType(QString enclosureType)
{
m_enclosureType = enclosureType;
}
51 changes: 51 additions & 0 deletions fvavailableupdate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef FVAVAILABLEUPDATE_H
#define FVAVAILABLEUPDATE_H

#include <QObject>
#include <QUrl>

class FvAvailableUpdate : public QObject
{
Q_OBJECT
public:
explicit FvAvailableUpdate(QObject *parent = 0);

QString GetTitle();
void SetTitle(QString title);

QUrl GetReleaseNotesLink();
void SetReleaseNotesLink(QUrl releaseNotesLink);
void SetReleaseNotesLink(QString releaseNotesLink);

QString GetPubDate();
void SetPubDate(QString pubDate);

QUrl GetEnclosureUrl();
void SetEnclosureUrl(QUrl enclosureUrl);
void SetEnclosureUrl(QString enclosureUrl);

QString GetEnclosureVersion();
void SetEnclosureVersion(QString enclosureVersion);

QString GetEnclosurePlatform();
void SetEnclosurePlatform(QString enclosurePlatform);

unsigned long GetEnclosureLength();
void SetEnclosureLength(unsigned long enclosureLength);

QString GetEnclosureType();
void SetEnclosureType(QString enclosureType);

private:
QString m_title;
QUrl m_releaseNotesLink;
QString m_pubDate;
QUrl m_enclosureUrl;
QString m_enclosureVersion;
QString m_enclosurePlatform;
unsigned long m_enclosureLength;
QString m_enclosureType;

};

#endif // FVAVAILABLEUPDATE_H
30 changes: 30 additions & 0 deletions fvupdateconfirmdialog.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
#include "fvupdateconfirmdialog.h"
#include "fvavailableupdate.h"
#include "fvupdater.h"
#include "ui_fvupdateconfirmdialog.h"


FvUpdateConfirmDialog::FvUpdateConfirmDialog(QWidget *parent) :
QDialog(parent),
m_ui(new Ui::FvUpdateConfirmDialog)
{
m_ui->setupUi(this);

// Delete on close
setAttribute(Qt::WA_DeleteOnClose, true);

// Set the "close app, then reopen" string
QString closeReopenString = m_ui->downloadThisUpdateLabel->text().arg(QApplication::applicationName());
m_ui->downloadThisUpdateLabel->setText(closeReopenString);

// Connect buttons
connect(m_ui->confirmButtonBox, SIGNAL(accepted()),
FvUpdater::sharedUpdater(), SLOT(UpdateInstallationConfirmed()));
connect(m_ui->confirmButtonBox, SIGNAL(rejected()),
FvUpdater::sharedUpdater(), SLOT(UpdateInstallationNotConfirmed()));
}

FvUpdateConfirmDialog::~FvUpdateConfirmDialog()
{
delete m_ui;
}

bool FvUpdateConfirmDialog::UpdateWindowWithCurrentProposedUpdate()
{
FvAvailableUpdate* proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate();
if (! proposedUpdate) {
return false;
}

QString downloadLinkString = m_ui->updateFileLinkLabel->text()
.arg(proposedUpdate->GetEnclosureUrl().toString());
m_ui->updateFileLinkLabel->setText(downloadLinkString);

return true;
}
5 changes: 4 additions & 1 deletion fvupdateconfirmdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ class FvUpdateConfirmDialog : public QDialog
public:
explicit FvUpdateConfirmDialog(QWidget *parent = 0);
~FvUpdateConfirmDialog();


// Update the current update proposal from FvUpdater
bool UpdateWindowWithCurrentProposedUpdate();

private:
Ui::FvUpdateConfirmDialog* m_ui;
};
Expand Down
35 changes: 1 addition & 34 deletions fvupdateconfirmdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,5 @@
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>confirmButtonBox</sender>
<signal>accepted()</signal>
<receiver>FvUpdateConfirmDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>confirmButtonBox</sender>
<signal>rejected()</signal>
<receiver>FvUpdateConfirmDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
Loading

0 comments on commit 25c6fd7

Please sign in to comment.