commit eae4c1ee83d41bd1bc5687a909403cacc6c74fa0 Author: Rtch90 Date: Mon Dec 15 15:10:14 2014 +0000 [Add] Initial commit: MainWindow, Toolbar ribbon and stuff. diff --git a/.clang_complete b/.clang_complete new file mode 100644 index 0000000..9093b49 --- /dev/null +++ b/.clang_complete @@ -0,0 +1,12 @@ +-I /usr/include/SDL/ +-I /usr/include/freetype2/ +-I /usr/include/libxml2/ +-I /usr/include/GL/ +-I /usr/include/AL/ +-I /usr/include/vorbis/ +-I /usr/include/c++/ +-I /usr/include/gtk-2.0/ +-I /usr/include/gtk-3.0/ +-I /usr/include/qt4/ +-I /usr/include/x86_64-linux-gnu/qt5/ +-I lib/lua/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..621a4fb --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files +*.slo +*.lo +*.o + +# Compiled Dynamic libraries +*.so + +# Compiled Static libraries +*.lai +*.la +*.a + +# Crap. +*hpdf +*Makefile* +moc_* +*.swp +*.swo +*pro.user +ui_* +qrc_* +tmp/ + diff --git a/bin/hpdf.pro b/bin/hpdf.pro new file mode 100644 index 0000000..2b6fc48 --- /dev/null +++ b/bin/hpdf.pro @@ -0,0 +1,18 @@ +QT += widgets + +TEMPLATE = app +TARGET = hpdf +DEPENDPATH += . +INCLUDEPATH += . + +HEADERS += \ + ../src/pdf_factory.h + +SOURCES += \ + ../src/main.cpp \ + ../src/pdf_factory.cpp + +RESOURCES += hpdf.qrc + +CONFIG += console + diff --git a/bin/hpdf.qrc b/bin/hpdf.qrc new file mode 100644 index 0000000..2703623 --- /dev/null +++ b/bin/hpdf.qrc @@ -0,0 +1,12 @@ + + + ../img/cut.png + ../img/myeditor.png + ../img/open.png + ../img/paste.png + ../img/save.png + ../img/copy.png + ../img/new.png + ../img/saveas.png + + diff --git a/img/copy.png b/img/copy.png new file mode 100644 index 0000000..4ce1158 Binary files /dev/null and b/img/copy.png differ diff --git a/img/cut.png b/img/cut.png new file mode 100644 index 0000000..23e1387 Binary files /dev/null and b/img/cut.png differ diff --git a/img/myeditor.png b/img/myeditor.png new file mode 100644 index 0000000..0baef17 Binary files /dev/null and b/img/myeditor.png differ diff --git a/img/new.png b/img/new.png new file mode 100644 index 0000000..2913d69 Binary files /dev/null and b/img/new.png differ diff --git a/img/open.png b/img/open.png new file mode 100644 index 0000000..03a100b Binary files /dev/null and b/img/open.png differ diff --git a/img/paste.png b/img/paste.png new file mode 100644 index 0000000..1fccb4b Binary files /dev/null and b/img/paste.png differ diff --git a/img/save.png b/img/save.png new file mode 100644 index 0000000..7fe1511 Binary files /dev/null and b/img/save.png differ diff --git a/img/saveas.png b/img/saveas.png new file mode 100644 index 0000000..f08182b Binary files /dev/null and b/img/saveas.png differ diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..19f7a9b --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,10 @@ +#include +#include "pdf_factory.h" + +int main(int argc, char* argv[]) { + QApplication a(argc, argv); + PDFFactory pdffactory; + pdffactory.show(); + + return a.exec(); +} diff --git a/src/main_window.cpp b/src/main_window.cpp new file mode 100644 index 0000000..62ca750 --- /dev/null +++ b/src/main_window.cpp @@ -0,0 +1,14 @@ +#include "main_window.h" +#include "ui_main_window.h" + +MainWindow::Mainwindow(Qwidget* parent) : + QMainWindow(parent), + ui(new UI::MainWindow { + + ui->setupUI(this); +} + +MainWindow::~MainWindow(void) { + delete ui; +} + diff --git a/src/main_window.h b/src/main_window.h new file mode 100644 index 0000000..3ccfcbf --- /dev/null +++ b/src/main_window.h @@ -0,0 +1,17 @@ +#pragma once +#include + +namespace Ui { + class MainWindow; +} + +class MainWindow : public QMainWindow { + Q_OBJECT +public: + explicit MainWindow(QWidget* parent = 0); + ~MainWindow(void); + +private: + Ui::MainWindow* ui; +}; + diff --git a/src/main_window.ui b/src/main_window.ui new file mode 100644 index 0000000..6050363 --- /dev/null +++ b/src/main_window.ui @@ -0,0 +1,24 @@ + + MainWindow + + + + 0 + 0 + 400 + 300 + + + + MainWindow + + + + + + + + + + + diff --git a/src/pdf_factory.cpp b/src/pdf_factory.cpp new file mode 100644 index 0000000..ccf6e84 --- /dev/null +++ b/src/pdf_factory.cpp @@ -0,0 +1,94 @@ +#include +#include "pdf_factory.h" + +PDFFactory::PDFFactory(void) { + createWidgets(); + createActions(); + createToolBars(); + createRibbon(); + createStatusBar(); +} + +/* Create the shit we need for our window. */ +void PDFFactory::createWidgets(void) { + centralWidget = new QWidget(); + QVBoxLayout* layout = new QVBoxLayout(); + centralWidget->setLayout(layout); + setCentralWidget(centralWidget); + + /* Create ribbon. */ + ribbon = new QTabWidget(); + ribbon->addTab(new QWidget(), tr("File")); + ribbon->addTab(new QWidget(), tr("Edit")); + ribbon->addTab(new QWidget(), tr("View")); + ribbon->addTab(new QWidget(), tr("Help")); + ribbon->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + ribbon->setFixedHeight(100); + layout->addWidget(ribbon); + + /*setWindowIcon(QIcon(":/img/hpdf.png"));*/ + setGeometry(0, 0, 550, 650); +} + +void PDFFactory::createActions(void) { + openAction = new QAction(tr("&Open"), this); + openAction->setIcon(QIcon(":/img/open.png")); + openAction->setShortcut(tr("Ctrl+O")); + openAction->setStatusTip(tr("Open a PDF")); + connect(openAction, SIGNAL(triggered()), this, SLOT(open())); + + exportAction = new QAction(tr("&Export"), this); + exportAction->setIcon(QIcon(":/img/save.png")); + exportAction->setShortcut(tr("Ctrl+S")); + exportAction->setStatusTip(tr("Export the selected frame to a new PDF")); + /*connect(saveAction, SIGNAL(triggered()), this, SLOT(save()))*/ + + exportAllAction = new QAction(tr("Combine all and export"), this); + exportAllAction->setIcon(QIcon(":/img/saveas.png")); + exportAllAction->setShortcut(tr("Shift+Ctrl+S")); + exportAllAction->setStatusTip(tr("Combine all and export as one PDF")); + /*connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()))*/ + + cutAction = new QAction(tr("C&ut"), this); + cutAction->setIcon(QIcon(":/img/cut.png")); + cutAction->setShortcut(tr("Ctrl+X")); + cutAction->setStatusTip(tr("Cut selected contents to clipboard")); + /*connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()))*/ + + copyAction = new QAction(tr("&Copy"), this); + copyAction->setIcon(QIcon(":/img/copy.png")); + copyAction->setShortcut(tr("Ctrl+C")); + copyAction->setStatusTip(tr("Copy selected contents to clipboard")); + /*connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()))*/ + + pasteAction = new QAction(tr("&Paste"), this); + pasteAction->setIcon(QIcon(":/img/paste.png")); + pasteAction->setShortcut(tr("Ctrl+V")); + pasteAction->setStatusTip(tr("Paste clipboard's contents into current" + "selection")); + /*connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()))*/ +} + +void PDFFactory::createToolBars() { + fileToolBar = new QToolBar(tr("File")); + fileToolBar->addAction(openAction); + fileToolBar->addAction(exportAction); + fileToolBar->addAction(exportAllAction); + + editToolBar = new QToolBar(tr("Edit")); + editToolBar->addAction(cutAction); + editToolBar->addAction(copyAction); + editToolBar->addAction(pasteAction); +} + +void PDFFactory::createRibbon(void) { + QWidget* tabFile = ribbon->widget(0); + QVBoxLayout* layoutTabFile = new QVBoxLayout(); + tabFile->setLayout(layoutTabFile); + layoutTabFile->addWidget(fileToolBar); +} + +void PDFFactory::createStatusBar(void) { + statusBar()->showMessage(tr("")); +} + diff --git a/src/pdf_factory.h b/src/pdf_factory.h new file mode 100644 index 0000000..f476230 --- /dev/null +++ b/src/pdf_factory.h @@ -0,0 +1,44 @@ +#pragma once +#include + +class QAction; +class QToolBar; +class QTabWidget; +class QWidget; + +class PDFFactory : public QMainWindow { + Q_OBJECT +public: + PDFFactory(); + +protected: + /*void closeEvent(QCloseEvent* event);*/ + +private slots: + /*void openFile(void); + void exportFile(void); + void exportAllFiles(void);*/ + +private: + void createWidgets(void); + void createActions(void); + void createToolBars(void); + void createRibbon(); + void createStatusBar(); + + QAction* openAction; + QAction* exportAction; + QAction* exportAllAction; + QAction* cutAction; + QAction* copyAction; + QAction* pasteAction; + QAction* aboutAction; + + QWidget* centralWidget; + + QTabWidget* ribbon; + + QToolBar* fileToolBar; + QToolBar* editToolBar; +}; +