Skip to content

Commit

Permalink
Add pretty 'about' window
Browse files Browse the repository at this point in the history
  • Loading branch information
cibomahto committed Dec 11, 2013
1 parent a0a30a3 commit 52eb48c
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 9 deletions.
22 changes: 22 additions & 0 deletions src/PatternPaint/aboutpatternpaint.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "aboutpatternpaint.h"
#include "ui_aboutpatternpaint.h"

#include <QDebug>
#include <QtWidgetsDepends>

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

QString versionNumber = QString("Version %1.%2.%3").arg(VERSION_MAJOR).arg(VERSION_MINOR).arg(VERSION_BUILD);
ui->versionLabel->setText(versionNumber);

ui->InfoText->setOpenExternalLinks(true);
}

AboutPatternPaint::~AboutPatternPaint()
{
delete ui;
}
22 changes: 22 additions & 0 deletions src/PatternPaint/aboutpatternpaint.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef ABOUTPATTERNPAINT_H
#define ABOUTPATTERNPAINT_H

#include <QDialog>

namespace Ui {
class AboutPatternPaint;
}

class AboutPatternPaint : public QDialog
{
Q_OBJECT

public:
explicit AboutPatternPaint(QWidget *parent = 0);
~AboutPatternPaint();

private:
Ui::AboutPatternPaint *ui;
};

#endif // ABOUTPATTERNPAINT_H
78 changes: 78 additions & 0 deletions src/PatternPaint/aboutpatternpaint.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutPatternPaint</class>
<widget class="QDialog" name="AboutPatternPaint">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>239</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>About PatternPaint</string>
</property>
<property name="styleSheet">
<string notr="true">background:url(:/resources/images/PatternPaintAbout.png)</string>
</property>
<widget class="QTextBrowser" name="InfoText">
<property name="geometry">
<rect>
<x>0</x>
<y>180</y>
<width>401</width>
<height>61</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background:none</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.Lucida Grande UI'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;Visit &lt;/span&gt;&lt;a href=&quot;http://blinkinlabs.com&quot;&gt;&lt;span style=&quot; font-size:14pt; text-decoration: underline; color:#0000ff;&quot;&gt;Blinkinlabs.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt; for more information about Pattern Paint, BlinkyTape, and other fun projects!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="versionLabel">
<property name="geometry">
<rect>
<x>0</x>
<y>150</y>
<width>391</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background:none</string>
</property>
<property name="text">
<string>Version 0.0.0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
1 change: 1 addition & 0 deletions src/PatternPaint/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<qresource prefix="/resources">
<file>images/BlinkyTape.jpg</file>
<file>images/blinkytapepattern.jpg</file>
<file>images/PatternPaintAbout.png</file>
</qresource>
</RCC>
Binary file added src/PatternPaint/images/PatternPaintAbout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 11 additions & 9 deletions src/PatternPaint/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "animation.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <systeminformation.h>
#include "colormodel.h"
#include "systeminformation.h"
#include "aboutpatternpaint.h"

#include <QFileDialog>
#include <QMessageBox>
Expand Down Expand Up @@ -93,7 +95,7 @@ void MainWindow::drawTimer_timeout() {

QImage img = ui->animationEditor->getPattern();
for(int i = 0; i < BLINKYTAPE_STRIP_HEIGHT; i++) {
QRgb color = BlinkyTape::correctBrightness(img.pixel(n, i));
QRgb color = ColorModel::correctBrightness(img.pixel(n, i));
ledData.append(qRed(color));
ledData.append(qGreen(color));
ledData.append(qBlue(color));
Expand Down Expand Up @@ -241,11 +243,9 @@ void MainWindow::on_tapeConnectionStatusChanged(bool connected)

void MainWindow::on_actionAbout_triggered()
{
QMessageBox::about(this, "Pattern Paint",
"<b>PatternPaint</b> is companion software for the BlinkyTape. "
"It allows you to create animations for your BlinkyTape in "
"real-time, and save your designs to the BlinkyTape for "
"playback on-the-go.");
// TODO: store this somewhere, for later disposal.
AboutPatternPaint* info = new AboutPatternPaint(this);
info->show();
}

void MainWindow::on_actionSystem_Information_triggered()
Expand Down Expand Up @@ -337,7 +337,6 @@ void MainWindow::on_actionLoad_rainbow_sketch_triggered()
return;
}

// TODO: So close!
QByteArray sketch = QByteArray(ColorSwirlSketch,COLORSWIRL_LENGTH);
uploader->startUpload(*tape, sketch);

Expand All @@ -358,7 +357,10 @@ void MainWindow::on_actionSave_to_Tape_triggered()
Animation animation(pattern,
1000/ui->animationSpeed->value(),
Animation::Encoding_RGB565_RLE);
uploader->startUpload(*tape, animation);

if(!uploader->startUpload(*tape, animation)) {
return;
}

progress->setValue(progress->minimum());
progress->show();
Expand Down

0 comments on commit 52eb48c

Please sign in to comment.