[Add] Initial commit: MainWindow, Toolbar ribbon and stuff.
12
.clang_complete
Normal file
@ -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/
|
24
.gitignore
vendored
Normal file
@ -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/
|
||||||
|
|
18
bin/hpdf.pro
Normal file
@ -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
|
||||||
|
|
12
bin/hpdf.qrc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource>
|
||||||
|
<file>../img/cut.png</file>
|
||||||
|
<file>../img/myeditor.png</file>
|
||||||
|
<file>../img/open.png</file>
|
||||||
|
<file>../img/paste.png</file>
|
||||||
|
<file>../img/save.png</file>
|
||||||
|
<file>../img/copy.png</file>
|
||||||
|
<file>../img/new.png</file>
|
||||||
|
<file>../img/saveas.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
BIN
img/copy.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/cut.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/myeditor.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
img/new.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
img/open.png
Normal file
After Width: | Height: | Size: 963 B |
BIN
img/paste.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
img/save.png
Normal file
After Width: | Height: | Size: 1014 B |
BIN
img/saveas.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
10
src/main.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <QApplication>
|
||||||
|
#include "pdf_factory.h"
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
PDFFactory pdffactory;
|
||||||
|
pdffactory.show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
14
src/main_window.cpp
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
17
src/main_window.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit MainWindow(QWidget* parent = 0);
|
||||||
|
~MainWindow(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MainWindow* ui;
|
||||||
|
};
|
||||||
|
|
24
src/main_window.ui
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenuBar" name="menuBar" />
|
||||||
|
<widget class="QToolBar" name="mainToolBar" />
|
||||||
|
<widget class="QWidget" name="centralWidget" />
|
||||||
|
<widget class="QStatusBar" name="statusBar" />
|
||||||
|
</widget>
|
||||||
|
<layoutDefault spacing="6" margin="11" />
|
||||||
|
<pixmapfunction></pixmapfunction>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
94
src/pdf_factory.cpp
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
#include <QtWidgets>
|
||||||
|
#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(""));
|
||||||
|
}
|
||||||
|
|
44
src/pdf_factory.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|