Skip to content

Commit

Permalink
Merge pull request #16 from evenator/qt5
Browse files Browse the repository at this point in the history
Qt5
  • Loading branch information
pjreed authored Sep 30, 2016
2 parents 34fcddb + 5b5e61c commit 11d7f9e
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 20 deletions.
30 changes: 21 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,33 @@ cmake_minimum_required(VERSION 2.8.3)
project(swri_console)

find_package(catkin REQUIRED COMPONENTS rosbag_storage roscpp rosgraph_msgs)
find_package(Qt4 REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)

catkin_package(
INCLUDE_DIRS include
DEPENDS Qt4
CATKIN_DEPENDS rosbag_storage roscpp rosgraph_msgs
)

include(${QT_USE_FILE})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(include
${catkin_INCLUDE_DIRS}
${QT_INCLUDE_DIR} )
add_definitions(${QT_DEFINITIONS})
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
)
add_definitions(
${Qt5Core_DEFINITIONS}
${Qt5Gui_DEFINITIONS}
${Qt5Widgets_DEFINITIONS}
)

set(QT_USE_QTCORE TRUE)
set(QT_USE_QTGUI TRUE)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")

# Build mapviz node
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
Expand All @@ -42,13 +52,15 @@ file (GLOB SRC_FILES
src/log_database_proxy_model.cpp
src/ros_thread.cpp
src/settings_keys.cpp)
qt4_add_resources(RCC_SRCS resources/images.qrc)
qt4_wrap_ui(SRC_FILES ${UI_FILES})
qt4_wrap_cpp(SRC_FILES ${HEADER_FILES})
qt5_add_resources(RCC_SRCS resources/images.qrc)
qt5_wrap_ui(SRC_FILES ${UI_FILES})
qt5_wrap_cpp(SRC_FILES ${HEADER_FILES})

add_executable(swri_console ${HEADER_FILES} ${SRC_FILES} ${RCC_SRCS} src/main.cpp)
target_link_libraries(swri_console
${QT_LIBRARIES}
${Qt5Core_LIBRARIES}
${Qt5Gui_LIBRARIES}
${Qt5Widgets_LIBRARIES}
${catkin_LIBRARIES})

install(DIRECTORY include/${PROJECT_NAME}/
Expand Down
2 changes: 1 addition & 1 deletion include/swri_console/console_master.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ConsoleMaster : public QObject
Q_OBJECT;

public:
ConsoleMaster();
ConsoleMaster(int argc, char** argv);
virtual ~ConsoleMaster();

public Q_SLOTS:
Expand Down
2 changes: 1 addition & 1 deletion include/swri_console/console_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef SWRI_CONSOLE_CONSOLE_WINDOW_H_
#define SWRI_CONSOLE_CONSOLE_WINDOW_H_

#include <QtGui/QMainWindow>
#include <QtWidgets/QMainWindow>
#include <QColor>
#include <QPushButton>
#include <QSettings>
Expand Down
2 changes: 1 addition & 1 deletion include/swri_console/ros_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace swri_console
{
Q_OBJECT
public:
RosThread();
RosThread(int argc, char** argv);
/*
* Shuts down ROS and causes the thread to exit.
*/
Expand Down
6 changes: 4 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
<license>BSD</license>

<buildtool_depend>catkin</buildtool_depend>
<exec_depend>libqt4</exec_depend>
<depend>libqt4-dev</depend>
<build_depend>libqt5-opengl-dev</build_depend>
<depend>libqt5-core</depend>
<depend>libqt5-gui</depend>
<depend>libqt5-widgets</depend>
<depend>rosbag_storage</depend>
<depend>roscpp</depend>
<depend>rosgraph_msgs</depend>
Expand Down
4 changes: 2 additions & 2 deletions src/console_master.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

namespace swri_console
{
ConsoleMaster::ConsoleMaster()
:
ConsoleMaster::ConsoleMaster(int argc, char** argv):
ros_thread_(argc, argv),
connected_(false),
window_font_(QFont("Ubuntu Mono", 9))
{
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int main(int argc, char **argv)
QCoreApplication::setOrganizationDomain("swri.org");
QCoreApplication::setApplicationName("SwRI Console");

swri_console::ConsoleMaster master;
swri_console::ConsoleMaster master(argc, argv);
master.createNewWindow();
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
int result = app.exec();
Expand Down
5 changes: 2 additions & 3 deletions src/ros_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@

using namespace swri_console;

RosThread::RosThread() :
RosThread::RosThread(int argc, char** argv) :
is_connected_(false),
is_running_(true)
{
int argc = QCoreApplication::argc();
ros::init(argc, QCoreApplication::argv(), "swri_console",
ros::init(argc, argv, "swri_console",
ros::init_options::AnonymousName |
ros::init_options::NoRosout);
}
Expand Down

0 comments on commit 11d7f9e

Please sign in to comment.