From 42cb020233b6635f2d06b7f7b533a0ee4f85f4fa Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 5 Jun 2012 18:07:28 +0000 Subject: Initial import, added automake project files, application framework, initial sudoku widget --- src/Makefile.am | 19 +++++++++++++++++++ src/main.cc | 13 +++++++++++++ src/mainwindow.cc | 10 ++++++++++ src/mainwindow.h | 22 ++++++++++++++++++++++ src/sudoku.cc | 20 ++++++++++++++++++++ src/sudoku.h | 22 ++++++++++++++++++++++ 6 files changed, 106 insertions(+) create mode 100644 src/Makefile.am create mode 100644 src/main.cc create mode 100644 src/mainwindow.cc create mode 100644 src/mainwindow.h create mode 100644 src/sudoku.cc create mode 100644 src/sudoku.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..a67c97d --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,19 @@ +bin_PROGRAMS = sudosolve + +# You have two .cpp files you wrote, editor.cpp and another.cpp +# Remember to include the name of the resource file with the .cpp extension. +sudosolve_SOURCES = \ + main.cc \ + mainwindow.cc \ + sudoku.cc + +# You have one .h file, it's called editor.h. Therefore, here I list +# its mocced name, moc_editor.cpp. +nodist_sudosolve_SOURCES = \ + moc_mainwindow.cc \ + moc_sudoku.cc + +# This rule lets GNU make create any moc_*.cpp from the equivalent *.h +moc_%.cc: %.h + moc $< -o $@ + diff --git a/src/main.cc b/src/main.cc new file mode 100644 index 0000000..91525f7 --- /dev/null +++ b/src/main.cc @@ -0,0 +1,13 @@ + +#include + +#include "mainwindow.h" + +int main(int argc, char **argv) +{ + QApplication application(argc, argv); + MainWindow mainwindow; + + mainwindow.show(); + return application.exec(); +} diff --git a/src/mainwindow.cc b/src/mainwindow.cc new file mode 100644 index 0000000..60d2dcf --- /dev/null +++ b/src/mainwindow.cc @@ -0,0 +1,10 @@ + +#include "mainwindow.h" +#include "sudoku.h" + +MainWindow::MainWindow() +{ + mainwindow_sudoku = new Sudoku(); + + setCentralWidget(mainwindow_sudoku); +} diff --git a/src/mainwindow.h b/src/mainwindow.h new file mode 100644 index 0000000..09f22dd --- /dev/null +++ b/src/mainwindow.h @@ -0,0 +1,22 @@ + +#ifndef __INCLUDED_SUDOSOLVE_MAINWINDOW__ +#define __INCLUDED_SUDOSOLVE_MAINWINDOW__ + +#include +#include + +class Sudoku; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + +private: + Sudoku *mainwindow_sudoku; + +}; + +#endif // __INCLUDED_SUDOSOLVE_MAINWINDOW__ \ No newline at end of file diff --git a/src/sudoku.cc b/src/sudoku.cc new file mode 100644 index 0000000..f676bb1 --- /dev/null +++ b/src/sudoku.cc @@ -0,0 +1,20 @@ + +#include "sudoku.h" + +#include +#include + +Sudoku::Sudoku() +{ + QGridLayout *gridlayout = new QGridLayout(); + + for (size_t row = 0; row < 9; row++) { + for (size_t column = 0; column < 9 ; column++) { + sudoku_value[row][column] = new QLineEdit(); + gridlayout->addWidget(sudoku_value[row][column], row, column); + } + + } + + setLayout(gridlayout); +} \ No newline at end of file diff --git a/src/sudoku.h b/src/sudoku.h new file mode 100644 index 0000000..c9d38e6 --- /dev/null +++ b/src/sudoku.h @@ -0,0 +1,22 @@ + +#ifndef __INCLUDED_SUDOSOLVE_SUDOKU__ +#define __INCLUDED_SUDOSOLVE_SUDOKU__ + +#include +#include + +class QLineEdit; + +class Sudoku : public QWidget +{ + Q_OBJECT + +public: + Sudoku(); + +private: + QLineEdit * sudoku_value[9][9]; + +}; + +#endif // __INCLUDED_SUDOSOLVE_SUDOKU__ \ No newline at end of file -- cgit v1.2.3