Skip to content
This repository
Browse code

Merge pull request #1 from pvanek/master

build for mac improvements and terminal plugin updates
  • Loading branch information...
commit 31198504ebd7b6a36e81310ce758e20e28b49c2d 2 parents 268134a + 207872e
Mezomish authored
62 CMakeLists.txt
@@ -7,10 +7,14 @@
7 7 # cd build
8 8 # cmake .. -DCMAKE_INSTALL_PREFIX=/usr (or whatever prefix you'd like)
9 9 # make
  10 +# make install
  11 +#
  12 +# mac os x notes:
  13 +# juffed.app is build by default. There are some additions to steps above.
  14 +# "make install" is required to get plugins working
  15 +# "make bundle" an optional make target to build bundle with all dependencies inside
  16 +#
10 17
11   -option ( BUILD_PLUGINS "Build plugins from the externally linked SVN" ON )
12   -option ( APPLEBUNDLE "Build juffed as a Mac OS X bundle" OFF )
13   -option ( APPLEBUNDLE_STANDALONE "Pack APPLEBUNDLE with all its dependencies (libs)" OFF )
14 18
15 19 project (juffed)
16 20 cmake_minimum_required (VERSION 2.6.0)
@@ -147,7 +151,7 @@ target_link_libraries ( ${QSCI_ENGINE}
147 151 ${QSCINTILLA_LIBRARY}
148 152 )
149 153
150   -if (APPLEBUNDLE)
  154 +if (APPLE)
151 155 message ( STATUS "Building as an apple bundle" )
152 156 set ( APPLE_PREFIX "${CMAKE_INSTALL_PREFIX}/${JUFFED}.app/Contents" )
153 157
@@ -168,7 +172,7 @@ if (APPLEBUNDLE)
168 172 # this is a must to load the lib correctly
169 173 set_target_properties( ${JUFFLIB} PROPERTIES INSTALL_NAME_DIR "@executable_path/../MacOS" )
170 174 set_target_properties( ${QSCI_ENGINE} PROPERTIES INSTALL_NAME_DIR "@executable_path/../MacOS" )
171   -else (APPLEBUNDLE)
  175 +else (APPLE)
172 176 set(GUI_TYPE "")
173 177 set(APPLE_BUNDLE_SOURCES "")
174 178 # now we want to use soversion etc.
@@ -181,7 +185,7 @@ else (APPLEBUNDLE)
181 185 set_target_properties( ${JUFFLIB} PROPERTIES INSTALL_NAME_DIR ${LIB_INSTALL_DIR} )
182 186 set_target_properties( ${QSCI_ENGINE} PROPERTIES INSTALL_NAME_DIR ${LIB_INSTALL_DIR} )
183 187 endif (NOT APPLE)
184   -endif (APPLEBUNDLE)
  188 +endif (APPLE)
185 189
186 190 if ( MINGW )
187 191 add_definitions(
@@ -225,26 +229,22 @@ if ( UNIX )
225 229 set(CMAKE_CXX_FLAGS "-Wall -Werror -Wextra")
226 230 endif ( UNIX )
227 231
228   -if (BUILD_PLUGINS AND EXISTS ${CMAKE_SOURCE_DIR}/plugins)
229   - message(STATUS "Plugins: all externally linked cmake-ready plugs will be built")
230   - set(JUFFED_CMAKE_PLUGINS 1)
231   - if (UNIX)
232   - set(JUFFED_PLUGINS_DIR ${LIB_INSTALL_DIR}/juffed/plugins)
233   - endif (UNIX)
234   - if (APPLEBUNDLE)
235   - set(JUFFED_PLUGINS_DIR ${APPLE_PREFIX}/plugins)
236   - endif (APPLEBUNDLE)
237   - if (WIN32)
238   - set(JUFFED_PLUGINS_DIR ${CMAKE_INSTALL_PREFIX}/plugins)
239   - endif(WIN32)
240   - message(STATUS "Plugins: location = ${JUFFED_PLUGINS_DIR}")
241   - # dive into external SVN link
242   - set(JUFFED_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
243   - set(JUFFED_LIBRARY ${JUFFLIB})
244   - add_subdirectory(plugins)
245   -else ()
246   - message(STATUS "Plugins: externally linked plugins will not be built")
247   -endif ()
  232 +#
  233 +# plugins
  234 +message(STATUS "Plugins: all externally linked cmake-ready plugs will be built")
  235 +set(JUFFED_CMAKE_PLUGINS 1)
  236 +if (UNIX)
  237 + set(JUFFED_PLUGINS_DIR ${LIB_INSTALL_DIR}/juffed/plugins)
  238 +endif (UNIX)
  239 +if (APPLE)
  240 + set(JUFFED_PLUGINS_DIR ${APPLE_PREFIX}/plugins)
  241 +endif (APPLE)
  242 +if (WIN32)
  243 + set(JUFFED_PLUGINS_DIR ${CMAKE_INSTALL_PREFIX}/plugins)
  244 +endif(WIN32)
  245 +set(JUFFED_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
  246 +set(JUFFED_LIBRARY ${JUFFLIB})
  247 +add_subdirectory(plugins)
248 248
249 249 #set ( juffed_RCS
250 250 # src/app/juffed.rc
@@ -261,7 +261,7 @@ endif ()
261 261 ####################
262 262 # Installs
263 263 ####################
264   -if (NOT APPLEBUNDLE)
  264 +if (NOT APPLE)
265 265
266 266 install ( TARGETS ${JUFFED} DESTINATION ${BIN_INSTALL_DIR} )
267 267 install ( TARGETS ${JUFFLIB} DESTINATION ${LIB_INSTALL_DIR} )
@@ -277,7 +277,7 @@ if (NOT APPLEBUNDLE)
277 277 configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY )
278 278 add_custom_target ( uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
279 279
280   -else (NOT APPLEBUNDLE)
  280 +else (NOT APPLE)
281 281
282 282 install(CODE "message(STATUS \"Cleaning previously installed bundle (rm -r)\")")
283 283 install(CODE "execute_process(COMMAND rm -r ${CMAKE_INSTALL_PREFIX}/${JUFFED}.app)")
@@ -293,9 +293,11 @@ else (NOT APPLEBUNDLE)
293 293
294 294 # helper stuff to create real apple bundle.
295 295 # Black magic is summoned here...
296   - add_subdirectory( macosx )
  296 + # create a "transportable" bundle - all libs into the bundle: "make bundle" after make install
  297 + configure_file(macosx/bundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/bundle.cmake @ONLY)
  298 + add_custom_target(bundle ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/bundle.cmake)
297 299
298   -endif (NOT APPLEBUNDLE)
  300 +endif (NOT APPLE)
299 301
300 302
301 303 # make dist custom target
4 macosx/CMakeLists.txt
... ... @@ -1,4 +0,0 @@
1   -if (APPLEBUNDLE_STANDALONE)
2   - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/bundle.cmake @ONLY)
3   - install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/bundle.cmake)
4   -endif (APPLEBUNDLE_STANDALONE)
12 macosx/bundle.cmake.in
@@ -48,13 +48,13 @@ fixup_bundle(@CMAKE_INSTALL_PREFIX@/@JUFFED@.app "${inplugs}" @CMAKE_INSTALL_PRE
48 48
49 49 # FIXUP_BUNDLE copies it into MacOS dir. But we need it in plugins *tree*,
50 50 # not a flat dir.
51   -foreach (item IN LISTS inplugs)
  51 +#foreach (item IN LISTS inplugs)
52 52 #message(STATUS "IN: ${item}")
53   - get_filename_component(fname ${item} NAME)
54   - message(STATUS "Moving ${fname} back to plugins tree: ${item}")
  53 +# get_filename_component(fname ${item} NAME)
  54 +# message(STATUS "Moving ${fname} back to plugins tree: ${item}")
55 55 #message(STATUS " ${fname}")
56 56 #message(STATUS " src: @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/MacOS/${fname}")
57 57 #message(STATUS " tgt: ${item}")
58   - execute_process(COMMAND mv @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/MacOS/${fname} ${item})
59   -endforeach()
60   -
  58 +# execute_process(COMMAND mv @CMAKE_INSTALL_PREFIX@/@JUFFED@.app/Contents/MacOS/${fname} ${item})
  59 +#endforeach()
  60 +
13 macosx/strip_bundle.sh
... ... @@ -0,0 +1,13 @@
  1 +#!/bin/bash
  2 +
  3 +#
  4 +# Usage: strip_bundle.sh path/to/directory arch-to-keep
  5 +# Example: strip_bundle.sh ./release/TOra.app x86_64
  6 +# will provide x86_64 only content of the MacOS directory in the same place
  7 +#
  8 +
  9 +echo "Generating new single-architecture bundle for arch: $2"
  10 +echo "Into: $1.$2 (rename required)"
  11 +
  12 +ditto --rsrc --arch $2 $1 $1.$2
  13 +
37 plugins/terminal/terminal/TerminalPlugin.cpp
@@ -10,23 +10,22 @@
10 10
11 11 #include "qtermwidget.h"
12 12
13   -Preferences::Preferences(QTermWidget * term, const QObject * parent,
14   - int colorIX, const QString & emulation,
15   - const QFont & font)
  13 +
  14 +Preferences::Preferences(const QObject *parent,
  15 + const QString &color,
  16 + const QString &emulation,
  17 + const QFont &font)
16 18 : QWidget()
17 19 {
18 20 setupUi(this);
19 21
20   - QStringList colorSchemes;
21   - colorSchemes << "White On Black" << \
22   - "Green On Black" << \
23   - "Black On Light Yellow";
24   - colorSchemaCombo->addItems(colorSchemes);
25   - colorSchemaCombo->setCurrentIndex(colorIX);
26   - connect(colorSchemaCombo, SIGNAL(currentIndexChanged(int)),
27   - parent, SLOT(colorSchemaChanged(int)));
  22 + colorSchemaCombo->addItems(QTermWidget::availableColorSchemes());
  23 + int cix = colorSchemaCombo->findText(color);
  24 + colorSchemaCombo->setCurrentIndex(cix != -1 ? cix : 0);
  25 + connect(colorSchemaCombo, SIGNAL(currentIndexChanged(const QString&)),
  26 + parent, SLOT(colorSchemaChanged(const QString &)));
28 27
29   -// emulationComboBox->addItems(term->availableKeyBindings());
  28 + emulationComboBox->addItems(QTermWidget::availableKeyBindings());
30 29 int eix = emulationComboBox->findText(emulation);
31 30 emulationComboBox->setCurrentIndex(eix != -1 ? eix : 0 );
32 31 connect(emulationComboBox, SIGNAL(currentIndexChanged(const QString&)),
@@ -43,7 +42,6 @@ Preferences::Preferences(QTermWidget * term, const QObject * parent,
43 42
44 43
45 44 TerminalPlugin::TerminalPlugin() : QObject(), JuffPlugin() {
46   -// w_ = new QWidget();
47 45 w_ = new QTermWidget();
48 46 w_->setScrollBarPosition(QTermWidget::ScrollBarRight);
49 47 w_->setWindowTitle(tr("Terminal"));
@@ -58,11 +56,11 @@ void TerminalPlugin::init()
58 56 {
59 57 prefFont.fromString(PluginSettings::getString(this, "TerminalFont"));
60 58 prefFontSize = prefFont.pointSize();
61   - prefColorScheme = PluginSettings::getInt(this, "TerminalColorScheme");
  59 + prefColorScheme = PluginSettings::getString(this, "TerminalColorScheme");
62 60 prefEmulation = PluginSettings::getString(this, "TerminalEmulation");
63 61 w_->setColorScheme(prefColorScheme);
64 62 w_->setTerminalFont(prefFont);
65   -// w_->setKeyBindings(prefEmulation);
  63 + w_->setKeyBindings(prefEmulation);
66 64 }
67 65
68 66 TerminalPlugin::~TerminalPlugin() {
@@ -98,7 +96,7 @@ Juff::ActionList TerminalPlugin::mainMenuActions(Juff::MenuID id) const
98 96
99 97 QWidget * TerminalPlugin::settingsPage() const
100 98 {
101   - return new Preferences(w_, this, prefColorScheme, prefEmulation, prefFont);
  99 + return new Preferences(this, prefColorScheme, prefEmulation, prefFont);
102 100 }
103 101
104 102 void TerminalPlugin::applySettings()
@@ -109,12 +107,12 @@ void TerminalPlugin::applySettings()
109 107 PluginSettings::set(this, "TerminalColorScheme", prefColorScheme);
110 108 w_->setColorScheme(prefColorScheme);
111 109 w_->setTerminalFont(prefFont);
112   -// w_->setKeyBindings(prefEmulation);
  110 + w_->setKeyBindings(prefEmulation);
113 111 }
114 112
115   -void TerminalPlugin::colorSchemaChanged(int val)
  113 +void TerminalPlugin::colorSchemaChanged(const QString & val)
116 114 {
117   - prefColorScheme = val + 1;
  115 + prefColorScheme = val;
118 116 }
119 117
120 118 void TerminalPlugin::emulationChanged(const QString & val)
@@ -153,3 +151,4 @@ void TerminalPlugin::showTerminal()
153 151 }
154 152
155 153 Q_EXPORT_PLUGIN2(terminal, TerminalPlugin)
  154 +
14 plugins/terminal/terminal/TerminalPlugin.h
@@ -23,8 +23,9 @@ class Preferences : public QWidget, Ui::Preferences
23 23 Q_OBJECT
24 24
25 25 public:
26   - Preferences(QTermWidget * term, const QObject * parent,
27   - int colorIX, const QString & emulation,
  26 + Preferences(const QObject * parent,
  27 + const QString &color,
  28 + const QString & emulation,
28 29 const QFont & font);
29 30 };
30 31
@@ -48,9 +49,9 @@ Q_INTERFACES(JuffPlugin)
48 49 void applySettings();
49 50
50 51 public slots:
51   - void colorSchemaChanged(int val);
52   - void emulationChanged(const QString & val);
53   - void fontChanged(const QFont & val);
  52 + void colorSchemaChanged(const QString &val);
  53 + void emulationChanged(const QString &val);
  54 + void fontChanged(const QFont &val);
54 55 void fontSizeChanged(int val);
55 56
56 57 private slots:
@@ -61,7 +62,7 @@ private slots:
61 62 QAction* termAct_;
62 63
63 64 QTermWidget * m_term;
64   - int prefColorScheme;
  65 + QString prefColorScheme;
65 66 QString prefEmulation;
66 67 QFont prefFont;
67 68 int prefFontSize;
@@ -70,3 +71,4 @@ private slots:
70 71 };
71 72
72 73 #endif
  74 +

0 comments on commit 3119850

Please sign in to comment.
Something went wrong with that request. Please try again.