Browse Source

added an about dialog

1.0-fixes 0.4
Wes Hardaker 11 years ago
parent
commit
3ed9f0db1e
  1. 14
      AboutDialog.cpp
  2. 22
      AboutDialog.h
  3. 167
      AboutDialog.ui
  4. 2
      MainWindow.cpp
  5. 10
      Morse.cpp
  6. 2
      Morse.h
  7. 9
      cutecw.pro

14
AboutDialog.cpp

@ -0,0 +1,14 @@
#include "AboutDialog.h"
#include "ui_AboutDialog.h"
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
}
AboutDialog::~AboutDialog()
{
delete ui;
}

22
AboutDialog.h

@ -0,0 +1,22 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QtGui/QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
private:
Ui::AboutDialog *ui;
};
#endif // ABOUTDIALOG_H

167
AboutDialog.ui

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Cute CW</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="helpicon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>icons/64x64/cutecw.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>Morse Code Training Software</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>By Wes Hardaker (WS6Z)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>wes@ws6z.com</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>http://www.hamtools.org/cutecw/</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AboutDialog</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>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AboutDialog</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>
</ui>

2
MainWindow.cpp

@ -1,6 +1,7 @@
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include "ui_Prefs.h"
#include "ui_AboutDialog.h"
#include <QtMultimedia/QAudioFormat>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
@ -65,6 +66,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->prefs, SIGNAL(clicked()), m_morse, SLOT(prefsButton()));
ui->modeMenu->setText(tr("Type Morse Code"));
this->setFocus();
startIt();
}

10
Morse.cpp

@ -83,6 +83,14 @@ void Morse::prefsButton() {
}
}
void Morse::aboutButton() {
Ui::AboutDialog about;
QDialog *dialog = new QDialog(m_parent);
about.setupUi(dialog);
about.helpicon->setPixmap(QPixmap(":/icons/64x64/cutecw.png"));
dialog->exec();
}
QMenuBar *
Morse::menuBar()
{
@ -199,6 +207,8 @@ void Morse::switchMode(int newmode) {
m_modes[m_gameMode]->switchFromYou();
m_gameMode = (Morse::TrainingMode) newmode;
m_modes[(TrainingMode) newmode]->switchToYou();
connect(menuBar()->addAction("About"), SIGNAL(triggered()), this, SLOT(aboutButton()));
}
//

2
Morse.h

@ -19,6 +19,7 @@
#include "ui_MainWindow.h"
#include "ui_Prefs.h"
#include "ui_AboutDialog.h"
class MainWindow;
class PlayMode;
@ -87,6 +88,7 @@ public slots:
void keyPressed(QChar key);
void prefsButton();
void aboutButton();
void switchMode(int newMode);
void clearStatsButton();

9
cutecw.pro

@ -33,7 +33,8 @@ SOURCES += main.cpp\
modes/games/WordGame.cpp \
modes/games/HighScoresDialog.cpp \
modes/games/HighScores.cpp \
modes/QModeStart.cpp
modes/QModeStart.cpp \
AboutDialog.cpp
HEADERS += MainWindow.h \
Morse.h \
@ -62,10 +63,12 @@ HEADERS += MainWindow.h \
modes/games/WordGame.h \
modes/games/HighScoresDialog.h \
modes/games/HighScores.h \
modes/QModeStart.h
modes/QModeStart.h \
AboutDialog.h
FORMS += MainWindow.ui \
Prefs.ui
Prefs.ui \
AboutDialog.ui
CONFIG += mobility
MOBILITY =

Loading…
Cancel
Save