Commit 1b7772ff authored by David Gil's avatar David Gil
Browse files

First step to port to KF5

It builds and it works fairly well. But:
--There still are some KDE4 classes to port away from.
--Some toolbar buttons don't show up.

REVIEW: 114581
parent 165bf4cf
project(kgeography)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
# minimal cmake requirement
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
# minimal Qt requirement
set (QT_MIN_VERSION "5.2.0")
# ECM
find_package (ECM 0.0.9 REQUIRED NO_MODULE)
# where to look first for cmake modules
set (CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package (Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets
)
find_package (KF5 CONFIG REQUIRED COMPONENTS
CoreAddons I18n KDE4Support WidgetsAddons XmlGui ConfigWidgets ItemViews Service ItemModels Emoticons
)
include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)
include(FeatureSummary)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${QT4_INCLUDES})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
# global include directories
include_directories (${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory( doc )
add_subdirectory( src )
......
########### install files ###############
#
#
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kgeography)
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kgeography)
......@@ -36,11 +36,17 @@ kde4_add_kcfg_files(kgeography_SRCS settings.kcfgc )
#kde4_add_app_icon(kgeography_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../icons/ox*-apps-kgeography.png")
kde4_add_app_icon(kgeography_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../icons/hi*-apps-kgeography.png")
kde4_add_executable(kgeography ${kgeography_SRCS})
add_executable(kgeography ${kgeography_SRCS})
target_link_libraries(kgeography ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY})
install(TARGETS kgeography ${INSTALL_TARGETS_DEFAULT_ARGS} )
target_link_libraries(kgeography KF5::XmlGui
KF5::WidgetsAddons
KF5::CoreAddons
KF5::ConfigWidgets
KF5::ItemViews
KF5::Service
)
install(TARGETS kgeography EXPORT KGeography ${INSTALL_TARGETS_DEFAULT_ARGS} )
########### install files ###############
......
......@@ -10,7 +10,7 @@
#include "answersdialog.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <qlabel.h>
#include <qlayout.h>
......
......@@ -10,7 +10,7 @@
#include "askwidget.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <kmessagebox.h>
#include <qapplication.h>
......
......@@ -13,8 +13,7 @@
#include <stdlib.h> // for RAND_MAX
#include <kacceleratormanager.h>
#include <klocale.h>
#include <kpushbutton.h>
#include <klocalizedstring.h>
#include <krandom.h>
#include <qbuttongroup.h>
......@@ -23,6 +22,7 @@
#include <qlabel.h>
#include <qlayout.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
#include "map.h"
#include "settings.h"
......@@ -48,7 +48,7 @@ boxAsker::boxAsker(QWidget *parent, KGmap *m, QWidget *w, uint count) : askWidge
p_radioButtons[i] -> installEventFilter(this);
connect(p_radioButtons[i], SIGNAL(toggled(bool)), this, SLOT(atLeastOneSelected()));
}
p_accept = new KPushButton();
p_accept = new QPushButton();
layoutGroupBox();
layoutAligned();
......
......@@ -13,8 +13,7 @@
#include "askwidget.h"
class KPushButton;
class QPushButton;
class QGroupBox;
class QLabel;
class QRadioButton;
......@@ -60,11 +59,11 @@ Q_OBJECT
QVBoxLayout *p_lay;
QGridLayout *p_groupLayout;
KPushButton *p_accept;
QPushButton *p_accept;
QWidget *p_headWidget;
QLabel *p_label;
QGroupBox *p_groupBox;;
QGroupBox *p_groupBox;
QVector<QLabel*> p_answerLabels;
};
......
......@@ -10,7 +10,7 @@
#include "capitaldivisionasker.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <qradiobutton.h>
......
......@@ -10,7 +10,7 @@
#include "divisioncapitalasker.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <krandom.h>
#include <qradiobutton.h>
......
......@@ -10,7 +10,7 @@
#include "divisionflagasker.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <qimage.h>
#include <qradiobutton.h>
......
......@@ -10,7 +10,7 @@
#include "flagdivisionasker.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <qimage.h>
#include <qlayout.h>
......
......@@ -10,7 +10,7 @@
#include "integerinputdialog.h"
#include <KIntSpinBox>
#include <QSpinBox>
#include <qboxlayout.h>
#include <qlabel.h>
......@@ -38,7 +38,7 @@ IntegerInputDialog::IntegerInputDialog(QWidget *parent, const QString &title, co
connect(_slider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int)));
hbox->addWidget(_slider);
_spinBox = new KIntSpinBox();
_spinBox = new QSpinBox();
_spinBox->setRange(from, upto);
_spinBox->setValue(value);
connect(_spinBox, SIGNAL(valueChanged(int)), this, SLOT(spinboxValueChanged(int)));
......
......@@ -13,7 +13,7 @@
#include <kdialog.h>
class KIntSpinBox;
class QSpinBox;
class QSlider;
class IntegerInputDialog : public KDialog
......@@ -35,7 +35,7 @@ Q_OBJECT
void spinboxValueChanged(int newValue);
private:
KIntSpinBox *_spinBox;
QSpinBox *_spinBox;
QSlider *_slider;
};
......
......@@ -10,24 +10,22 @@
#include "kgeography.h"
#include <kaction.h>
#include <kdialog.h>
#include <klocale.h>
#include <kconfigdialog.h>
#include <kinputdialog.h>
#include <kmessagebox.h>
#include <kpushbutton.h>
#include <kstandardaction.h>
#include <ktoggleaction.h>
#include <ktoolbar.h>
#include <kmenubar.h>
#include <kicon.h>
#include <kactioncollection.h>
#include <qmenubar.h>
#include <qfile.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qsize.h>
#include <qtimer.h>
#include <qpushbutton.h>
#include "answersdialog.h"
#include "capitaldivisionasker.h"
......@@ -60,21 +58,21 @@ kgeography::kgeography() : KXmlGuiWindow(), p_firstShow(true), p_mustShowResults
p_currentMap = new QLabel(leftWidget);
p_currentMap -> setAlignment(Qt::AlignCenter);
p_consult = new KPushButton(i18n("E&xplore Map"), leftWidget);
p_consult = new QPushButton(i18n("E&xplore Map"), leftWidget);
p_consult->setWhatsThis(i18n("In this section left click on any part of the map to learn about the divisions" ));
QLabel * testYourselfLabel = new QLabel( i18n("Test Yourself:"), this );
testYourselfLabel->setAlignment( Qt::AlignHCenter );
p_askMap = new KPushButton(i18n("&Location of Regions"), leftWidget);
p_askMap = new QPushButton(i18n("&Location of Regions"), leftWidget);
p_askMap->setWhatsThis(i18n("In this challenge you are given a division name on the left under the menu and you must find it on the map and click on it"));
p_askPlaceMap = new KPushButton(i18n("&Place Regions in the Map"), leftWidget);
p_askPlaceMap = new QPushButton(i18n("&Place Regions in the Map"), leftWidget);
p_askPlaceMap->setWhatsThis(i18n("In this challenge you are given the shape of a region and you must place it on the map"));
p_askCapitalDivisions = new KPushButton(i18n("&Regions by Capital"), leftWidget);
p_askCapitalDivisions = new QPushButton(i18n("&Regions by Capital"), leftWidget);
p_askCapitalDivisions->setWhatsThis(i18n("In this quiz you have to guess the division name given its capital"));
p_askDivisionCapitals = new KPushButton(i18n("&Capitals of Regions"), leftWidget);
p_askDivisionCapitals = new QPushButton(i18n("&Capitals of Regions"), leftWidget);
p_askDivisionCapitals->setWhatsThis(i18n("In this quiz you have to guess the capital of a given division name"));
p_askFlagDivisions = new KPushButton(i18n("Re&gions by Flag"), leftWidget);
p_askFlagDivisions = new QPushButton(i18n("Re&gions by Flag"), leftWidget);
p_askFlagDivisions->setWhatsThis(i18n("In this quiz you have to guess the division name given its flag"));
p_askDivisionFlags = new KPushButton(i18n("&Flags of Regions"), leftWidget);
p_askDivisionFlags = new QPushButton(i18n("&Flags of Regions"), leftWidget);
p_askDivisionFlags->setWhatsThis(i18n("In this quiz you have to guess the flag of a division given its name"));
p_underLeftWidget = new QWidget(leftWidget);
// where the number of answers will be shown
......@@ -167,7 +165,8 @@ void kgeography::showPreferencesDialog()
// create it :
KConfigDialog* dialog = new KConfigDialog(this, "settings",
kgeographySettings::self());
dialog->setHelp("configuration", "kgeography");
// FIXME: Waiting for the answer from Kévin about what to do with it
// dialog->setHelp("configuration", "kgeography");
QWidget *w = new QWidget();
Ui::Options confWdg;
confWdg.setupUi(w);
......
......@@ -13,10 +13,10 @@
#include <kxmlguiwindow.h>
class KPushButton;
class KToggleAction;
class QLabel;
class QPushButton;
class KGmap;
class askWidget;
......@@ -66,13 +66,13 @@ Q_OBJECT
QWidget *p_bigWidget;
QWidget *p_underLeftWidget;
KPushButton *p_consult;
KPushButton *p_askCapitalDivisions;
KPushButton *p_askDivisionCapitals;
KPushButton *p_askMap;
KPushButton *p_askPlaceMap;
KPushButton *p_askFlagDivisions;
KPushButton *p_askDivisionFlags;
QPushButton *p_consult;
QPushButton *p_askCapitalDivisions;
QPushButton *p_askDivisionCapitals;
QPushButton *p_askMap;
QPushButton *p_askPlaceMap;
QPushButton *p_askFlagDivisions;
QPushButton *p_askDivisionFlags;
KToggleAction *p_zoom;
KToggleAction *p_move;
KToggleAction *p_zoomAutomatic;
......
......@@ -12,7 +12,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KButtonGroup" name="kcfg_questionPlacingScheme">
<widget class="QGroupBox" name="kcfg_questionPlacingScheme">
<property name="title">
<string>&amp;Question Alignment</string>
</property>
......@@ -104,7 +104,7 @@
</widget>
</item>
<item>
<widget class="KButtonGroup" name="kcfg_colorDisguise">
<widget class="QGroupBox" name="kcfg_colorDisguise">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -147,14 +147,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KButtonGroup</class>
<extends>QGroupBox</extends>
<header>kbuttongroup.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -9,20 +9,29 @@
***************************************************************************/
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kapplication.h>
#include <klocalizedstring.h>
#include <qapplication.h>
#include <qcommandlineparser.h>
#include "kgeography.h"
int main(int argc, char *argv[])
{
KAboutData about("kgeography", 0, ki18n("KGeography"), "0.8.1", ki18n("A geography learning program"), KAboutData::License_GPL, ki18n("© 2004-2005 Albert Astals Cid"), KLocalizedString(), "http://userbase.kde.org/KGeography");
about.addAuthor(ki18n("Albert Astals Cid"), ki18n("Programmer and designer"), "aacid@kde.org");
about.addCredit(ki18n("Sodipodi flags collection"), ki18n("Got some flags from it"), 0, "http://www.sodipodi.com/index.php3?section=clipart/flags");
KCmdLineArgs::init(argc, argv, &about);
KApplication app;
QApplication app(argc, argv);
KAboutData about("kgeography", 0, i18n("KGeography"), "0.8.1", i18n("A Geography learning program"), KAboutData::License_GPL, i18n("© 2004-2005 Albert Astals Cid"), QString(), "http://userbase.kde.org/KGeography");
about.addAuthor(i18n("Albert Astals Cid"), i18n("Programmer and designer"), "aacid@kde.org");
about.addCredit(i18n("Sodipodi flags collection"), i18n("Got some flags from it"), 0, "http://www.sodipodi.com/index.php3?section=clipart/flags");
app.setTopWidget(new kgeography());
QCoreApplication::setApplicationName(about.catalogName());
QCoreApplication::setApplicationVersion(about.version());
QCoreApplication::setOrganizationDomain("kde.org");
QCommandLineParser parser;
parser.addVersionOption();
about.setupCommandLine(&parser);
parser.process(app);
about.processCommandLine(&parser);
new kgeography();
return app.exec();
}
......@@ -12,7 +12,7 @@
#include <stdlib.h> // for RAND_MAX
#include <klocale.h>
#include <klocalizedstring.h>
#include <krandom.h>
#include <qfile.h>
......
......@@ -10,9 +10,9 @@
#include "mapasker.h"
#include <klocale.h>
#include <kmessagebox.h>
#include <krandom.h>
#include <klocalizedstring.h>
#include <qlabel.h>
#include <qlayout.h>
......@@ -26,17 +26,16 @@
static QString guessWikipediaDomain()
{
const QString &lang = KGlobal::locale() -> language();
QString code;
if ( lang.isEmpty() || lang == "POSIX" || lang == "C" )
code = "en";
else {
QString dummy;
KLocale::splitLocale(lang, code, dummy, dummy, dummy);
}
QLocale systemLocale = QLocale::system();
QString languageCode;
QLocale::Language systemLanguage = systemLocale.language();
if ( systemLanguage == QLocale::AnyLanguage || systemLanguage == QLocale::C ) {
languageCode = "en";
} else {
languageCode = systemLocale.name().split('_').first();
}
return QString( "http://%1.wikipedia.org/wiki/" ).arg( code );
return QString( "http://%1.wikipedia.org/wiki/" ).arg( languageCode );
}
mapAsker::mapAsker(QWidget *parent, KGmap *m, QWidget *w, bool asker, uint count) : askWidget(parent, m, w, count, asker), p_asker(asker), p_firstShow(true)
......
......@@ -10,7 +10,7 @@
#include "mapchooser.h"
#include <klocale.h>
#include <klocalizedstring.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
......@@ -48,7 +48,7 @@ mapChooser::mapChooser(QWidget *parent) : KDialog(parent)
list = KGlobal::dirs() -> findAllResources("appdata", "*.kgm");
p_listBox = new QListWidget(mainHB);
line = new KListWidgetSearchLine(mainHB, p_listBox);
line->setClickMessage(i18n("Filter Maps"));
line->setPlaceholderText(i18n("Filter Maps"));
listFilterLayout = new QVBoxLayout();
listFilterLayout -> setMargin(0);
listFilterLayout -> setSpacing(KDialog::spacingHint());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment