17 #include <qtabwidget.h> 18 #include <q3textbrowser.h> 19 #include <qpushbutton.h> 20 #include <qstringlist.h> 21 #include <qdatetime.h> 25 #include <qstringlist.h> 27 #include <qapplication.h> 30 #include <Q3TextStream> 31 #include <QCloseEvent> 32 #include <Q3GridLayout> 36 #include "../titleWidget.h" 37 #include "../window.h" 38 #include "../../config.h" 39 #include "../../configuration/configuration.h" 41 #define DEFAULT_WIDTH 600 42 #define DEFAULT_HEIGHT 500 45 #define GET_RELEASES 1 46 #define GET_NEW_IMPROVEMENTS 2 47 #define GET_UPCOMING_FEATURES 3 54 QColor white(255, 255, 255);
55 QColor darkBlue(35, 75, 139);
56 QColor black(0, 0, 0);
62 setCaption( tr(
"About Album Shaper"));
66 logoFrame->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
72 if(((
Window*)(qApp->mainWidget()))->getConfig()->getBool(
"alerts",
"showSoftwareUpdateAlerts"))
75 http.setHost(
"albumshaper.sourceforge.net" );
82 http.get(
"/webService/releases.xml");
86 QDate currentDate = QDate::currentDate();
87 int copyYearFirst = QMIN( currentDate.year(), 2003 );
88 int copyYearLast = QMAX( currentDate.year(), 2004 );
93 ", © %1-%2 Will Stokes").arg(copyYearFirst).arg(copyYearLast),
96 progURL =
new QLabel(
"http://albumshaper.sourceforge.net", logoFrame );
99 QFont textFont = progDesc->font();
100 textFont.setWeight(QFont::Bold);
101 progDesc->setFont( textFont );
109 credits->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
111 credits->setSource(
"about.html");
113 QIcon( QPixmap(QString(
IMAGE_PATH)+
"tabIcons/credits.png") ),
118 history->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
120 history->setSource(
"history.html");
122 QIcon( QPixmap(QString(
IMAGE_PATH)+
"tabIcons/history.png") ),
129 QPixmap(QString(
IMAGE_PATH)+
"buttonIcons/button_ok.png"),
133 closeButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
135 connect(
closeButton, SIGNAL(clicked()), SLOT(close()) );
137 logoFrame->setPaletteBackgroundColor( darkBlue );
138 progDesc->setPaletteForegroundColor( white );
139 progDesc->setPaletteBackgroundColor( darkBlue );
140 progURL->setPaletteForegroundColor( white );
141 progURL->setPaletteBackgroundColor( darkBlue );
142 tabWidget->setPaletteForegroundColor( black );
144 Q3GridLayout* logoGrid =
new Q3GridLayout( logoFrame, 4, 3, 0);
147 logoGrid->addWidget( progDesc, 2, 1, Qt::AlignCenter );
148 logoGrid->addWidget(
progURL, 3, 1, Qt::AlignCenter );
150 grid =
new Q3GridLayout(
this, 3, 1, 0);
152 grid->addWidget( logoFrame, 0, 0 );
158 if( currentDate.year() > 2003 && currentDate.month() == 4 && currentDate.day() <= 3)
161 cakeLogo->setPixmap( QPixmap( QString(
IMAGE_PATH)+
"miscImages/birthdayL.png" ) );
163 cakeLogo2->setPixmap( QPixmap( QString(
IMAGE_PATH)+
"miscImages/birthdayR.png" ) );
164 QLabel* cakeMessage =
new QLabel( QString( tr(
"Happy Birthday Album Shaper!") +
165 QString(
" %1 ").arg(currentDate.year() - 2003) +
166 ( currentDate.year()-2003 == 1 ? tr(
"Year Old!") : tr(
"Years Old!")) ), logoFrame );
167 cakeMessage->setFont(textFont);
168 cakeMessage->setPaletteForegroundColor( white );
170 logoGrid->addWidget( cakeLogo, 0, 0, Qt::AlignCenter );
171 logoGrid->addWidget( cakeLogo2, 0, 2, Qt::AlignCenter );
172 logoGrid->addMultiCellWidget( cakeMessage, 1, 1, 0, 2, Qt::AlignCenter );
177 setFixedSize(size());
201 QFile fetchedDoc(
TEMP_DIR + QString(
"/releases.xml") );
202 if(fetchedDoc.open(QIODevice::WriteOnly))
206 Q3TextStream stream( &fetchedDoc );
207 stream.setEncoding( Q3TextStream::UnicodeUTF8 );
208 stream << QString(
http.readAll() );
213 if( !fetchedDoc.open( QIODevice::ReadOnly ) )
221 if( !xmlDom.setContent( &fetchedDoc ) )
233 QDomElement root = xmlDom.documentElement();
234 QDomNode node = root.firstChild();
236 bool thisVersionFound =
false;
237 while( !node.isNull() )
239 if( node.isElement() && node.nodeName() ==
"release" )
241 val = node.firstChild().toText();
245 releases->append( QString(val.nodeValue()) );
249 thisVersionFound =
true;
253 node = node.nextSibling();
260 QFile fetchedDoc(
TEMP_DIR + QString(
"/newImprovements.html") );
261 if(fetchedDoc.open(QIODevice::WriteOnly))
263 Q3TextStream stream( &fetchedDoc ); stream.setEncoding( Q3TextStream::UnicodeUTF8 );
264 stream <<
"<html><body bgcolor=\"white\" text=\"black\">\n";
265 stream <<
"<b><font size=\"+1\">" << tr(
"New improvements to Album Shaper are available in a new release!") <<
"<br><hr></font></b>";
270 http.get(
"/webService/" +
releases->first() +
"_changelog.html");
280 if(!thisVersionFound)
290 QIcon( QPixmap(QString(
IMAGE_PATH)+
"tabIcons/newImprovements.png") ),
291 tr(
"Software Updates") );
297 http.get(
"/webService/upcomingFeatures.html");
302 rootDir.remove(
"releases.xml");
314 QFile fetchedDoc(
TEMP_DIR + QString(
"/newImprovements.html") );
315 if(fetchedDoc.open(QIODevice::WriteOnly | QIODevice::Append))
318 Q3TextStream stream( &fetchedDoc );
319 stream.setEncoding( Q3TextStream::UnicodeUTF8 );
320 stream << QString(
http.readAll() );
331 if(fetchedDoc.open(QIODevice::WriteOnly | QIODevice::Append))
334 Q3TextStream stream( &fetchedDoc );
335 stream.setEncoding( Q3TextStream::UnicodeUTF8 );
336 stream <<
"</body></html>";
344 QIcon( QPixmap(QString(
IMAGE_PATH)+
"tabIcons/newImprovements.png") ),
345 tr(
"Software Updates") );
350 http.get(
"/webService/upcomingFeatures.html");
360 http.get(
"/webService/" +
releases->first() +
"_changelog.html");
373 QFile fetchedDoc(
TEMP_DIR + QString(
"/upcomingFeatures.html") );
374 if(fetchedDoc.open(QIODevice::WriteOnly))
377 Q3TextStream stream( &fetchedDoc );
378 stream.setEncoding( Q3TextStream::UnicodeUTF8 );
379 stream << QString(
http.readAll() );
388 QIcon( QPixmap(QString(
IMAGE_PATH)+
"tabIcons/upcomingFeatures.png") ),
389 tr(
"Upcoming Features") );
396 rootDir.remove(
"upcomingFeatures.html");
406 QWidget::closeEvent( e );
#define GET_NEW_IMPROVEMENTS
Q3TextBrowser * newImprovements
Top level widget, encapsulates the title widget, the layout widget, and the toolbar widget...
QPushButton * closeButton
Close button.
void closeEvent(QCloseEvent *e)
Q3TextBrowser * upcomingFeatures
#define ALBUMSHAPER_VERSION
About(int mode, QWidget *parent=0, const char *name=0)
void fileFetched(bool error)
#define GET_UPCOMING_FEATURES