Skip to content

Commit

Permalink
Kolejny krok realizacji aplikacji Adresy Qt5
Browse files Browse the repository at this point in the history
  • Loading branch information
xinulsw committed Jan 9, 2015
1 parent 622a781 commit 3689834
Show file tree
Hide file tree
Showing 18 changed files with 478 additions and 6 deletions.
15 changes: 12 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.doctest',
'sphinx.ext.pngmath',
'sphinx.ext.viewcode',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -88,7 +90,7 @@

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
show_authors = True

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
Expand Down Expand Up @@ -196,7 +198,7 @@
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'MateriayeCGITdoc'
htmlhelp_basename = 'Materiały CG IT'

# -- Options for LaTeX output ---------------------------------------------

Expand Down Expand Up @@ -278,3 +280,10 @@

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

try:
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except:
pass
57 changes: 57 additions & 0 deletions docs/qt/adresy/adresy01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include "adresy.h"
#include "ui_adresy.h"

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

QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

nazwaLine = new QLineEdit;
nazwaLine = ui->nazwaLine;
nazwaLine->setReadOnly(true);

adresText = new QTextEdit;
adresText = ui->adresText;
adresText->setReadOnly(true);

dodajBtn = new QPushButton;
dodajBtn = ui->dodajBtn;

zapiszBtn = new QPushButton;
zapiszBtn = ui->zapiszBtn;
zapiszBtn->hide();

anulujBtn = new QPushButton;
anulujBtn = ui->anulujBtn;
anulujBtn->hide();

nastBtn = new QPushButton;
nastBtn = ui->nastBtn;
nastBtn->setEnabled(false);

poprzBtn = new QPushButton;
poprzBtn = ui->poprzBtn;
poprzBtn->setEnabled(false);

edytujBtn = new QPushButton;
edytujBtn = ui->edytujBtn;
edytujBtn->setEnabled(false);

usunBtn = new QPushButton;
usunBtn = ui->usunBtn;
usunBtn->setEnabled(false);

koniecBtn = new QPushButton;
koniecBtn = ui->koniecBtn;
koniecBtn->setEnabled(true);

setWindowTitle(trUtf8("Prosta książka adresowa"));
}

adresy::~adresy()
{
delete ui;
}
36 changes: 36 additions & 0 deletions docs/qt/adresy/adresy01.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef ADRESY_H
#define ADRESY_H

#include <QWidget>
#include <QLineEdit>
#include <QTextEdit>
#include <QPushButton>
#include <QTextCodec>

namespace Ui {
class adresy;
}

class adresy : public QWidget
{
Q_OBJECT

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

private:
Ui::adresy *ui;
QPushButton *dodajBtn;
QPushButton *zapiszBtn;
QPushButton *anulujBtn;
QPushButton *poprzBtn;
QPushButton *nastBtn;
QPushButton *edytujBtn;
QPushButton *usunBtn;
QPushButton *koniecBtn;
QLineEdit *nazwaLine;
QTextEdit *adresText;
};

#endif // ADRESY_H
114 changes: 114 additions & 0 deletions docs/qt/adresy/adresy02.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#include "adresy.h"
#include "ui_adresy.h"

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

QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

nazwaLine = new QLineEdit;
nazwaLine = ui->nazwaLine;
nazwaLine->setReadOnly(true);

adresText = new QTextEdit;
adresText = ui->adresText;
adresText->setReadOnly(true);

dodajBtn = new QPushButton;
dodajBtn = ui->dodajBtn;

zapiszBtn = new QPushButton;
zapiszBtn = ui->zapiszBtn;
zapiszBtn->hide();

anulujBtn = new QPushButton;
anulujBtn = ui->anulujBtn;
anulujBtn->hide();

nastBtn = new QPushButton;
nastBtn = ui->nastBtn;
nastBtn->setEnabled(false);

poprzBtn = new QPushButton;
poprzBtn = ui->poprzBtn;
poprzBtn->setEnabled(false);

edytujBtn = new QPushButton;
edytujBtn = ui->edytujBtn;
edytujBtn->setEnabled(false);

usunBtn = new QPushButton;
usunBtn = ui->usunBtn;
usunBtn->setEnabled(false);

koniecBtn = new QPushButton;
koniecBtn = ui->koniecBtn;
koniecBtn->setEnabled(true);

connect(dodajBtn, SIGNAL(clicked()), this, SLOT(dodajKontakt()));
connect(koniecBtn,SIGNAL(clicked()),this, SLOT(koniec()));

setWindowTitle(trUtf8("Prosta książka adresowa"));
}

adresy::~adresy()
{
delete ui;
}

void adresy::dodajKontakt() {
staraNazwa = nazwaLine->text();
staryAdres = adresText->toPlainText();

nazwaLine->clear();
adresText->clear();

aktGui(dodajT);
}

void adresy::aktGui(Tryb tryb) {
aktTryb=tryb;
switch (aktTryb) {
case dodajT:
case edytujT:
nazwaLine->setReadOnly(false);
nazwaLine->setFocus(Qt::OtherFocusReason);
adresText->setReadOnly(false);

dodajBtn->setEnabled(false);
edytujBtn->setEnabled(false);
usunBtn->setEnabled(false);

zapiszBtn->show();
anulujBtn->show();

nastBtn->setEnabled(false);
poprzBtn->setEnabled(false);
break;
case nawigujT:
if (kontakty.isEmpty()) {
nazwaLine->clear();
adresText->clear();
}
nazwaLine->setReadOnly(true);
adresText->setReadOnly(true);
dodajBtn->setEnabled(true);

int ile=kontakty.size();
edytujBtn->setEnabled(ile >= 1);
usunBtn->setEnabled(ile >=1 );
nastBtn->setEnabled(ile > 1);
poprzBtn->setEnabled(ile > 1);

zapiszBtn->hide();
anulujBtn->hide();
break;
}
}

void adresy::koniec() {
adresy::close();
}
49 changes: 49 additions & 0 deletions docs/qt/adresy/adresy02.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#ifndef ADRESY_H
#define ADRESY_H

#include <QWidget>
#include <QLineEdit>
#include <QTextEdit>
#include <QPushButton>
#include <QTextCodec>

namespace Ui {
class adresy;
}

class adresy : public QWidget
{
Q_OBJECT

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

enum Tryb { nawigujT, dodajT, edytujT };

public slots:
void dodajKontakt();
void koniec();

private:
Ui::adresy *ui;
QPushButton *dodajBtn;
QPushButton *zapiszBtn;
QPushButton *anulujBtn;
QPushButton *poprzBtn;
QPushButton *nastBtn;
QPushButton *edytujBtn;
QPushButton *usunBtn;
QPushButton *koniecBtn;
QLineEdit *nazwaLine;
QTextEdit *adresText;

QString staraNazwa;
QString staryAdres;
Tryb aktTryb;
void aktGui(Tryb tryb);
QMap<QString,QString> kontakty;

};

#endif // ADRESY_H
Binary file added docs/qt/adresy/img/qt5_01.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_02.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_03.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_04.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_05.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_06.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_07.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_08.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_09.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/qt/adresy/img/qt5_12.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3689834

Please sign in to comment.