Skip to content

Commit

Permalink
[SSC] Changing to more conventionel Widget.
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxei committed Nov 18, 2020
1 parent 2e640a4 commit 60ecb8c
Show file tree
Hide file tree
Showing 50 changed files with 2,126 additions and 45 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ set(QT_RES
${CMAKE_SOURCE_DIR}/resources/resources.qrc
${CMAKE_SOURCE_DIR}/gui/gui.qrc)

set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_SOURCE_DIR}/ui/)

# Set Qt source files
set(SRC ${QT_RES}
src/papercards_qml.cpp
src/Backend.cpp
src/DocumentHandler.cpp
src/PdfHandler.cpp
src/model/Card.cpp)
src/mainwindow.cpp
src/sidepanel.cpp)

# Copy version to source code
add_definitions(-DMAJOR_VERSION=${PROJECT_VERSION_MAJOR})
Expand Down
13 changes: 10 additions & 3 deletions Papercards.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ DEFINES += QT_DEPRECATED_WARNINGS
# You can also select to disable deprecated APIs only up to a certain version of Qt.
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += src/papercards_qml.cpp src/Backend.cpp src/DocumentHandler.cpp src/model/Card.cpp
HEADERS += src/Backend.h src/DocumentHandler.h src/model/Card.h
SOURCES += src/papercards_qml.cpp src/Backend.cpp src/DocumentHandler.cpp src/model/Card.cpp \
src/mainwindow.cpp
HEADERS += src/Backend.h src/DocumentHandler.h src/model/Card.h \
src/mainwindow.h \
src/material_icons.h

RESOURCES += resources/resources.qrc gui/gui.qrc
RESOURCES += resources/resources.qrc gui/gui.qrc \
ui/ui.qrc

OTHER_FILES += gui/*.qml gui/components/*.qml

Expand All @@ -39,3 +43,6 @@ QML_DESIGNER_IMPORT_PATH =
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

FORMS += \
ui/mainwindow.ui
280 changes: 280 additions & 0 deletions Papercards.pro.qtds

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions frameworks/MacOSXBundleInfo.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
38 changes: 38 additions & 0 deletions gui/Test.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12

ApplicationWindow {

id: root
visible: true
title: "Papercards"
width: 800
height: 600

ToolBar {
id: toolBar
height: 40
position: ToolBar.Header
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: 0
}

Switch {
id: element
x: 228
y: 310
text: qsTr("Test")
}

}

/*##^##
Designer {
D{i:1;anchors_width:800;anchors_x:-6;anchors_y:0}
}
##^##*/
1 change: 1 addition & 0 deletions gui/gui.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<file>components/DefaultMenuBar.qml</file>
<file>components/NativeMenuBar.qml</file>
<file>DialogConfirmDiscard.qml</file>
<file>Test.qml</file>
</qresource>
<qresource prefix="/">
<file>qtquickcontrols2.conf</file>
Expand Down
1 change: 1 addition & 0 deletions gui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.papercards.backend 1.0
import "components" as Components

ApplicationWindow {
// flags: Qt.FramelessWindowHint
property real scaleFactor: statusBar.scaleFactor
property var targetFunction
property bool discard: false
Expand Down
1 change: 0 additions & 1 deletion gui/qtquickcontrols2.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[Controls]
Style=Material

[Material]
Theme=Dark
Expand Down
Binary file removed resources/MaterialIcons-Regular.ttf
Binary file not shown.
Binary file removed resources/PapercardsIcons.ttf
Binary file not shown.
Binary file removed resources/WorkSans-Light.ttf
Binary file not shown.
Binary file removed resources/WorkSans-Regular.ttf
Binary file not shown.
Binary file added resources/feather.ttf
Binary file not shown.
Binary file modified resources/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/logo.psd
Binary file not shown.
Binary file added resources/logo_old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 1 addition & 15 deletions resources/resources.qrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
<RCC>
<qresource prefix="/resources">
<file>WorkSans-Light.ttf</file>
<file>WorkSans-Regular.ttf</file>
<file>MaterialIcons-Regular.ttf</file>
<file>default_deck.json</file>
<file>logo.png</file>
<file>roboto/Roboto-Black.ttf</file>
<file>roboto/Roboto-BlackItalic.ttf</file>
<file>roboto/Roboto-Bold.ttf</file>
<file>roboto/Roboto-BoldItalic.ttf</file>
<file>roboto/Roboto-Italic.ttf</file>
<file>roboto/Roboto-Light.ttf</file>
<file>roboto/Roboto-LightItalic.ttf</file>
<file>roboto/Roboto-Medium.ttf</file>
<file>roboto/Roboto-MediumItalic.ttf</file>
<file>roboto/Roboto-Regular.ttf</file>
<file>roboto/Roboto-Thin.ttf</file>
<file>roboto/Roboto-ThinItalic.ttf</file>
<file>feather.ttf</file>
</qresource>
</RCC>
Binary file removed resources/roboto/Roboto-Black.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-BlackItalic.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-Bold.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-Italic.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-Light.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-LightItalic.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-Medium.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-MediumItalic.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-Regular.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-Thin.ttf
Binary file not shown.
Binary file removed resources/roboto/Roboto-ThinItalic.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions resources/underline-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "MainWindow.h"
#include "ui_mainwindow.h"

#include <QDebug>

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::mainWindow) {
ui->setupUi(this);
setUnifiedTitleAndToolBarOnMac(true);
}

MainWindow::~MainWindow() {
delete ui;
}
20 changes: 20 additions & 0 deletions src/MainWindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include <QMainWindow>

namespace Ui {
class mainWindow;
}

class MainWindow : public QMainWindow {
Q_OBJECT
private:
Ui::mainWindow *ui;

public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
};

#endif // MAIN_WINDOW_H
12 changes: 12 additions & 0 deletions src/SidePanel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "SidePanel.h"
#include "ui_sidepanel.h"

#include <QDebug>

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

SidePanel::~SidePanel() {
delete ui;
}
20 changes: 20 additions & 0 deletions src/SidePanel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef SIDE_PANEL_H
#define SIDE_PANEL_H

#include "QWidget"

namespace Ui {
class sidePanel;
}

class SidePanel : public QWidget {
Q_OBJECT
private:
Ui::sidePanel *ui;

public:
explicit SidePanel(QWidget *parent = nullptr);
~SidePanel() override;
};

#endif //SIDE_PANEL_H
3 changes: 2 additions & 1 deletion src/Backend.cpp → src/old/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void BackEnd::exportAsPdf(const QUrl &fileUrl) {
QPdfWriter writer(filePath);
writer.setCreator("Simon Schäfer");
writer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b);
writer.setResolution(130);
writer.setResolution(600);
writer.setTitle("Tests Deck");

QPageSize page_size = QPageSize(QPageSize::A6);
Expand All @@ -280,6 +280,7 @@ void BackEnd::exportAsPdf(const QUrl &fileUrl) {
QPainter painter;

painter.begin(&writer);
painter.scale(10,10);
for (Card *card : this->cards_) {
writer.newPage();
QTextDocument print_document;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/PdfHandler.h → src/old/PdfHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class PdfHandler : public QObject {


};

#endif //PDF_HANDLER_H
Loading

0 comments on commit 60ecb8c

Please sign in to comment.