Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Qt5 support #4

Merged
merged 2 commits into from Jun 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 19 additions & 6 deletions CMakeLists.txt
Expand Up @@ -39,11 +39,20 @@ SET(ascii-design_RCS
winicon.rc
)

FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
QT4_WRAP_UI(ascii-design_UIS_H ${ascii-design_UIS})
QT4_WRAP_CPP(ascii-design_MOC_SRCS ${ascii-design_MOC_HDRS})
QT4_ADD_RESOURCES(ascii-design_RESOURCES ${ascii-design_RESOURCES})
FIND_PACKAGE(Qt5Widgets)

if (NOT Qt5Widgets_FOUND)
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
QT4_WRAP_UI(ascii-design_UIS_H ${ascii-design_UIS})
QT4_WRAP_CPP(ascii-design_MOC_SRCS ${ascii-design_MOC_HDRS})
QT4_ADD_RESOURCES(ascii-design_RESOURCES ${ascii-design_RESOURCES})
else()
set(CMAKE_AUTOMOC ON)
QT5_WRAP_UI(ascii-design_UIS_H ${ascii-design_UIS})
QT5_ADD_RESOURCES(ascii-design_RESOURCES ${ascii-design_RESOURCES})
endif()


ADD_DEFINITIONS(
-Wall
Expand Down Expand Up @@ -75,9 +84,13 @@ ADD_EXECUTABLE(${GUI}
IF( MINGW )
SET_TARGET_PROPERTIES( ${GUI} PROPERTIES LINK_FLAGS "-mwindows" )
ENDIF( MINGW )

TARGET_LINK_LIBRARIES(${GUI} ${QT_LIBRARIES})

if (Qt5Widgets_FOUND)
qt5_use_modules(${GUI} Widgets Gui)
endif()

install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/ascii-design DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(FILES icon/ascii-design.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
install(FILES pics/ascii-design.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps)
Expand Down
2 changes: 1 addition & 1 deletion ascii-design.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
QT = gui core
QT += gui core widgets
CONFIG += qt release warn_on
DESTDIR = bin
OBJECTS_DIR = build
Expand Down
4 changes: 2 additions & 2 deletions src/dialoginfoimpl.cpp
Expand Up @@ -25,8 +25,8 @@
#include <QUrl>
#include "dialoginfoimpl.h"

DialogInfoImpl::DialogInfoImpl( QWidget * parent, Qt::WFlags f)
: QDialog(parent, f)
DialogInfoImpl::DialogInfoImpl(QWidget * parent)
: QDialog(parent)
{
setupUi(this);

Expand Down
2 changes: 1 addition & 1 deletion src/dialoginfoimpl.h
Expand Up @@ -31,7 +31,7 @@ class DialogInfoImpl : public QDialog, public Ui::DialogInfo
{
Q_OBJECT
public:
DialogInfoImpl( QWidget * parent = 0, Qt::WFlags f = 0 );
DialogInfoImpl( QWidget * parent = 0);

private slots:
void openPaypalLink();
Expand Down
4 changes: 2 additions & 2 deletions src/dialogoptionsimpl.cpp
Expand Up @@ -23,8 +23,8 @@

#include "dialogoptionsimpl.h"

dialogOptionsImpl::dialogOptionsImpl( QWidget * parent, Qt::WFlags f)
: QDialog(parent, f)
dialogOptionsImpl::dialogOptionsImpl(QWidget * parent)
: QDialog(parent)
{
setupUi(this);
opt = new Options;
Expand Down
2 changes: 1 addition & 1 deletion src/dialogoptionsimpl.h
Expand Up @@ -35,7 +35,7 @@ class dialogOptionsImpl : public QDialog, public Ui::dialogOptions
{
Q_OBJECT
public:
dialogOptionsImpl( QWidget * parent = 0, Qt::WFlags f = 0 );
dialogOptionsImpl( QWidget * parent = 0);

private:
QString autoDetect();
Expand Down
4 changes: 2 additions & 2 deletions src/mainwindowimpl.cpp
Expand Up @@ -23,8 +23,8 @@

#include "mainwindowimpl.h"

MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
: QMainWindow(parent, f)
MainWindowImpl::MainWindowImpl(QWidget * parent)
: QMainWindow(parent)
{
setupUi(this);

Expand Down
2 changes: 1 addition & 1 deletion src/mainwindowimpl.h
Expand Up @@ -41,7 +41,7 @@ class MainWindowImpl : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
MainWindowImpl( QWidget * parent = 0, Qt::WFlags f = 0 );
MainWindowImpl( QWidget * parent = 0);
private:
bool saveFile(const QString &fileName);
void setActions();
Expand Down
5 changes: 4 additions & 1 deletion src/options.cpp
Expand Up @@ -26,8 +26,11 @@

Options::Options()
{
#if QT_VERSION >= 0x050000
QString myPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#else
QString myPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#endif
settings = new QSettings(QString("%1/.ascii-design_options.conf").arg(myPath),
QSettings::IniFormat);

Expand Down