summaryrefslogtreecommitdiffstats
path: root/keduca
diff options
context:
space:
mode:
authorgregory guy <[email protected]>2019-06-27 16:35:25 +0200
committerSlávek Banko <[email protected]>2019-06-28 13:45:47 +0200
commitaca01d5a8b7d3de53fa34696e18c91db720a5ab6 (patch)
tree6b9b83c599cc5db58df8041ca5cf812e00bbd25e /keduca
parent88af19c041ad4f1139f6f0a35cd1a4fe2018425f (diff)
downloadtdeedu-aca01d5a8b7d3de53fa34696e18c91db720a5ab6.tar.gz
tdeedu-aca01d5a8b7d3de53fa34696e18c91db720a5ab6.zip
Conversion to the cmake building system.
Add includes to UI files to resolve FTBFS. Signed-off-by: gregory guy <[email protected]> Signed-off-by: Slávek Banko <[email protected]> (cherry picked from commit d4a1613e9f119ae68c695ab60f8d9856d1a54a52)
Diffstat (limited to 'keduca')
-rw-r--r--keduca/CMakeLists.txt9
-rw-r--r--keduca/keduca-shrinker154
-rw-r--r--keduca/keduca/CMakeLists.txt74
-rw-r--r--keduca/keducabuilder/CMakeLists.txt45
-rw-r--r--keduca/keducabuilder/kcontroladdeditbase.ui21
-rw-r--r--keduca/keducabuilder/kcontrolheaderbase.ui13
-rw-r--r--keduca/keducabuilder/keducaeditorstartdialogbase.ui10
-rw-r--r--keduca/libkeduca/CMakeLists.txt29
-rw-r--r--keduca/resources/CMakeLists.txt20
-rw-r--r--keduca/resources/icons/CMakeLists.txt1
-rw-r--r--keduca/resources/pics/CMakeLists.txt6
11 files changed, 356 insertions, 26 deletions
diff --git a/keduca/CMakeLists.txt b/keduca/CMakeLists.txt
new file mode 100644
index 00000000..da35483b
--- /dev/null
+++ b/keduca/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_subdirectory( libkeduca )
+add_subdirectory( keduca )
+add_subdirectory( keducabuilder )
+add_subdirectory( resources )
+
+install(
+ PROGRAMS keduca-shrinker
+ DESTINATION ${BIN_INSTALL_DIR}
+)
diff --git a/keduca/keduca-shrinker b/keduca/keduca-shrinker
new file mode 100644
index 00000000..188b3e0e
--- /dev/null
+++ b/keduca/keduca-shrinker
@@ -0,0 +1,154 @@
+#!/usr/bin/perl
+#
+# Copyright (c) 2005 Mathieu Roy <yeupou--gnu.org>
+# http://yeupou.coleumes.org
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+# $Id: keduca-shrinker.pl,v 1.3 2005/04/23 11:30:50 yeupou Exp $
+
+use Getopt::Long;
+
+my $getopt;
+my $debug;
+my $help;
+
+my $input;
+my $output;
+my $number = "20";
+
+
+########### Get options, give help
+
+eval {
+ $getopt = GetOptions("debug" => \$debug,
+ "help" => \$help,
+ "number=s" => \$number,
+ "input=s" => \$input,
+ "output=s" => \$ouput);
+};
+
+if ($help) {
+ print STDERR <<EOF;
+Usage: $0 [OPTION] --input [FILE]
+
+A small program that take a kdeduca test file (.edu) as input with say 100
+question and output a kdeduca test file with 20 questions selected randomly.
+
+ -i, --input=FILE Input keduca file.
+ -o, --output=FILE Output keduca file, shrinked.
+ (By default, the suffix -shrinked will be added)
+ -n, --number=NUMBER Number expected of questions, in the shrinked
+ version.
+ ($number by default)
+
+Project Homepage: https://gna.org/projects/keduca-shrinker/
+EOF
+exit(1);
+}
+
+# Test input file existence
+unless ($input) {
+ print "No input file.\n";
+}
+unless (-r $input) {
+ print "Input file not readable.\n";
+ exit;
+}
+open(INPUT, "< $input");
+
+# Test output writability
+unless ($output) {
+ $output = $input;
+ $output =~ s/.edu$//;
+ $output .= "-shrinked.edu";
+}
+if (-e $output && ! -w $output) {
+ print "Output file not writable.\n";
+ exit;
+
+}
+open(OUTPUT, "> $output");
+
+########### Define subs
+
+sub fisher_yates_shuffle {
+ my $table = shift;
+ my $i;
+ for ($i = @$table; --$i;) {
+ my $j = int rand($i+1);
+ next if $i == $j;
+ @$table[$i,$j] = @$table[$j,$i];
+ }
+}
+
+
+########### Grab the file header, store questions in an array.
+# I know, it's XML, it may be simple to call an xml parser.
+# But in fact, we have nothing to parse here, we do not care about
+# the real content, so...
+my $structure = "header";
+my $header;
+my $footer;
+my @questions;
+my $newquestion;
+
+while (<INPUT>) {
+ ## Grab the structure (footer and header)
+ # the header last when data begins
+ # the footer begin when data ends
+
+ $header .= $_ if $structure eq "header";
+
+ $structure = "content" if /\<Data\>/m;
+ $structure = "footer" if /\<\/Data\>/m;
+
+ $footer .= $_ if $structure eq "footer";
+
+ ## Grab the questions
+ if ($structure eq "content") {
+ $newquestion .= $_;
+
+ # If we found the string </question>, that the end of a question
+ if (/\<\/question\>/m) {
+ push(@questions, $newquestion);
+ $newquestion = "";
+ }
+
+ }
+}
+
+########### Select the number of questions we want
+# warn the user if there's nothing to do
+if (scalar(@questions) < $number) {
+ print "There are only ".scalar(@questions)." questions in the input file, less than $number.\n";
+ # Copy & exit
+ system("cp", $input, $output);
+ exit;
+} else {
+ # Shuffle
+ fisher_yates_shuffle(\@questions);
+ # Keeps only the desired amount (number-1, as 0 is counted)
+ $#questions = ($number-1);
+}
+
+########### Final output
+print OUTPUT $header;
+print OUTPUT @questions;
+print OUTPUT $footer;
+
+close(INPUT);
+close(OUTPUT);
diff --git a/keduca/keduca/CMakeLists.txt b/keduca/keduca/CMakeLists.txt
new file mode 100644
index 00000000..988a64e1
--- /dev/null
+++ b/keduca/keduca/CMakeLists.txt
@@ -0,0 +1,74 @@
+include_directories(
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_BINARY_DIR}/keduca/libkeduca
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+ ${TDE_LIB_DIR}
+)
+
+
+##### keduca (executable)
+
+tde_add_executable( keduca AUTOMOC
+
+ SOURCES
+ main.cpp
+ keduca.cpp
+ LINK
+ tdecore-shared
+ tdeui-shared
+ tdeio-shared
+ tdeparts-shared
+ keduca-static
+
+ DESTINATION ${BIN_INSTALL_DIR}
+)
+
+
+##### libkeducapart (kpart)
+
+tde_add_kpart( libkeducapart AUTOMOC
+
+ SOURCES
+ configdialogbase.ui
+ keduca_part.cpp
+ tderadioeduca.cpp
+ kquestion.cpp
+ kgroupeduca.cpp
+ keducaview.cpp
+ keducaprefs.cpp
+ kcheckeduca.cpp
+ settings.kcfgc
+ LINK
+ tdecore-shared
+ tdeui-shared
+ tdeio-shared
+ tdeparts-shared
+ keduca-static
+
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
+
+
+##### other data
+
+install(
+ FILES keducaui.rc keduca_partui.rc
+ DESTINATION ${DATA_INSTALL_DIR}/keduca
+)
+
+install(
+ FILES keduca.kcfg
+ DESTINATION ${KCFG_INSTALL_DIR}
+)
+
+install(
+ FILES keduca_part.desktop
+ DESTINATION ${SERVICES_INSTALL_DIR}
+)
diff --git a/keduca/keducabuilder/CMakeLists.txt b/keduca/keducabuilder/CMakeLists.txt
new file mode 100644
index 00000000..92e6d7e3
--- /dev/null
+++ b/keduca/keducabuilder/CMakeLists.txt
@@ -0,0 +1,45 @@
+include_directories(
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_BINARY_DIR}/keduca/libkeduca
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+ ${TDE_LIB_DIR}
+)
+
+
+##### keducabuilder (executable)
+
+tde_add_executable( keducabuilder AUTOMOC
+
+ SOURCES
+ kcontroladdeditbase.ui
+ keducaeditorstartdialogbase.ui
+ keducaeditorstartdialog.cpp
+ ktagcombobox.cpp
+ klangcombo.cpp
+ kcontrolheader.cpp
+ keducabuilder.cpp
+ kcontroladdedit.cpp
+ main.cpp
+ LINK
+ tdecore-shared
+ tdeui-shared
+ tdeio-shared
+ keduca-static
+
+ DESTINATION ${BIN_INSTALL_DIR}
+)
+
+
+##### other data
+
+install(
+ FILES keducabuilderui.rc
+ DESTINATION ${DATA_INSTALL_DIR}/keduca
+)
diff --git a/keduca/keducabuilder/kcontroladdeditbase.ui b/keduca/keducabuilder/kcontroladdeditbase.ui
index 1eb9e877..18c65770 100644
--- a/keduca/keducabuilder/kcontroladdeditbase.ui
+++ b/keduca/keducabuilder/kcontroladdeditbase.ui
@@ -864,17 +864,12 @@
<forwards>
<forward>class TQListViewItem;</forward>
</forwards>
-<includehints>
- <includehint>kurlrequester.h</includehint>
- <includehint>klineedit.h</includehint>
- <includehint>kpushbutton.h</includehint>
- <includehint>kcombobox.h</includehint>
- <includehint>knuminput.h</includehint>
- <includehint>knuminput.h</includehint>
- <includehint>knuminput.h</includehint>
- <includehint>knuminput.h</includehint>
- <includehint>knuminput.h</includehint>
- <includehint>knuminput.h</includehint>
- <includehint>tdelistview.h</includehint>
-</includehints>
+<includes>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">kpushbutton.h</include>
+ <include location="global" impldecl="in implementation">kurlrequester.h</include>
+ <include location="global" impldecl="in implementation">knuminput.h</include>
+ <include location="global" impldecl="in implementation">tdelistview.h</include>
+ <include location="global" impldecl="in implementation">kcombobox.h</include>
+</includes>
</UI>
diff --git a/keduca/keducabuilder/kcontrolheaderbase.ui b/keduca/keducabuilder/kcontrolheaderbase.ui
index 1c94005d..8e7a5ae4 100644
--- a/keduca/keducabuilder/kcontrolheaderbase.ui
+++ b/keduca/keducabuilder/kcontrolheaderbase.ui
@@ -460,13 +460,8 @@
<tabstop>buttonCancel</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
-<includehints>
- <includehint>klineedit.h</includehint>
- <includehint>klineedit.h</includehint>
- <includehint>klineedit.h</includehint>
- <includehint>kpushbutton.h</includehint>
- <includehint>klineedit.h</includehint>
- <includehint>klineedit.h</includehint>
- <includehint>klineedit.h</includehint>
-</includehints>
+<includes>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">kpushbutton.h</include>
+</includes>
</UI>
diff --git a/keduca/keducabuilder/keducaeditorstartdialogbase.ui b/keduca/keducabuilder/keducaeditorstartdialogbase.ui
index 79d6a2e0..22bf815b 100644
--- a/keduca/keducabuilder/keducaeditorstartdialogbase.ui
+++ b/keduca/keducabuilder/keducaeditorstartdialogbase.ui
@@ -313,8 +313,10 @@
<tabstop>openRecentDocumentRB</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
-<includehints>
- <includehint>klineedit.h</includehint>
- <includehint>kpushbutton.h</includehint>
-</includehints>
+<includes>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">kpushbutton.h</include>
+ <include location="global" impldecl="in implementation">kcombobox.h</include>
+ <include location="global" impldecl="in implementation">kurlrequester.h</include>
+</includes>
</UI>
diff --git a/keduca/libkeduca/CMakeLists.txt b/keduca/libkeduca/CMakeLists.txt
new file mode 100644
index 00000000..7d605e64
--- /dev/null
+++ b/keduca/libkeduca/CMakeLists.txt
@@ -0,0 +1,29 @@
+include_directories(
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+ ${TDE_LIB_DIR}
+)
+
+
+##### keduca (static)
+
+tde_add_library( keduca STATIC_PIC AUTOMOC
+
+ SOURCES
+ kgallerydialogbase.ui
+ fileread.cpp
+ kgallerydialog.cpp
+ LINK
+ tdecore-shared
+ tdeui-shared
+ tdeio-shared
+ tdeprint-shared
+)
diff --git a/keduca/resources/CMakeLists.txt b/keduca/resources/CMakeLists.txt
new file mode 100644
index 00000000..32000370
--- /dev/null
+++ b/keduca/resources/CMakeLists.txt
@@ -0,0 +1,20 @@
+add_subdirectory( pics )
+add_subdirectory( icons )
+
+
+##### icons
+
+tde_install_icons( )
+
+
+##### other data
+
+install(
+ FILES x-edu.desktop x-edugallery.desktop
+ DESTINATION ${MIME_INSTALL_DIR}/application
+)
+
+install(
+ FILES keduca.desktop keducabuilder.desktop
+ DESTINATION ${XDG_APPS_INSTALL_DIR}
+)
diff --git a/keduca/resources/icons/CMakeLists.txt b/keduca/resources/icons/CMakeLists.txt
new file mode 100644
index 00000000..3685661d
--- /dev/null
+++ b/keduca/resources/icons/CMakeLists.txt
@@ -0,0 +1 @@
+tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/keduca/icons )
diff --git a/keduca/resources/pics/CMakeLists.txt b/keduca/resources/pics/CMakeLists.txt
new file mode 100644
index 00000000..e1c4b28e
--- /dev/null
+++ b/keduca/resources/pics/CMakeLists.txt
@@ -0,0 +1,6 @@
+file( GLOB _pics RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.png )
+
+install(
+ FILES ${_pics}
+ DESTINATION ${DATA_INSTALL_DIR}/keduca/pics
+)