Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Chakra
Akabei
Akabei frontend
Commits
0779d6e7
Commit
0779d6e7
authored
Apr 01, 2011
by
Lukas Appelhans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually make it build and initialize our lib
parent
41ddf217
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
218 additions
and
30 deletions
+218
-30
CMakeLists.txt
CMakeLists.txt
+8
-2
apm.cpp
apm.cpp
+22
-7
apm.h
apm.h
+23
-2
cmake/modules/FindAkabeiClient.cmake
cmake/modules/FindAkabeiClient.cmake
+63
-0
cmake/modules/FindAkabeiCore.cmake
cmake/modules/FindAkabeiCore.cmake
+63
-0
main.cpp
main.cpp
+39
-19
No files found.
CMakeLists.txt
View file @
0779d6e7
project
(
akabei
)
cmake_minimum_required
(
VERSION 2.6
)
set
(
CMAKE_MODULE_PATH
"
${
CMAKE_SOURCE_DIR
}
/cmake/modules"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
KDE4_ENABLE_EXCEPTIONS
}
"
)
find_package
(
KDE4 REQUIRED
)
find_package
(
AkabeiClient REQUIRED
)
find_package
(
AkabeiCore REQUIRED
)
include
(
KDE4Defaults
)
include
(
MacroLibrary
)
include_directories
(
${
QT_INCLUDES
}
${
CMAKE_CURRENT_BINARY_DIR
}
${
KDE4_INCLUDE_DIR
}
)
${
KDE4_INCLUDE_DIR
}
${
AKABEICLIENT_INCLUDE_DIR
}
${
AKABEICORE_INCLUDE_DIR
}
)
set
(
apm_SRCS apm.cpp main.cpp
)
#qt4_automoc(${guzuta_SRCS})
kde4_add_executable
(
akabei
${
apm_SRCS
}
)
target_link_libraries
(
akabei
${
KDE4_KDEUI_LIBRARY
}
akabeiclient
)
target_link_libraries
(
akabei
${
KDE4_KDEUI_LIBRARY
}
${
AKABEICLIENT_LIBRARIES
}
)
apm.cpp
View file @
0779d6e7
...
...
@@ -9,6 +9,8 @@
*/
#include "apm.h"
#include <akabeiclient/akabeiclientbackend.h>
#include <kdebug.h>
#include <QStringList>
#include <QTextStream>
...
...
@@ -20,6 +22,25 @@ APM::APM(OperationType type, QList<Operation> operations, QStringList args, QObj
m_operationType
(
type
),
m_operations
(
operations
),
m_args
(
args
)
{
//QTimer::singleShot(0, AkabeiClient::Backend::instance(), SLOT(initialize()));
//QCoreApplication::instance()->quit();
//QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit()));
connect
(
AkabeiClient
::
Backend
::
instance
(),
SIGNAL
(
statusChanged
(
Akabei
::
Backend
::
Status
)),
SLOT
(
statusChanged
(
Akabei
::
Backend
::
Status
)));
AkabeiClient
::
Backend
::
instance
()
->
initialize
();
}
APM
::~
APM
()
{}
void
APM
::
statusChanged
(
Akabei
::
Backend
::
Status
status
)
{
if
(
status
==
Akabei
::
Backend
::
StatusReady
)
start
();
}
void
APM
::
start
()
{
QTextStream
out
(
stdout
);
//out << endl;
...
...
@@ -28,13 +49,7 @@ APM::APM(OperationType type, QList<Operation> operations, QStringList args, QObj
out
.
flush
();
kDebug
()
<<
"Start"
;
printf
(
"Start
\n
"
);
kDebug
()
<<
"Type"
<<
type
<<
"Operations"
<<
operations
<<
"Args"
<<
args
;
//QTimer::singleShot(0, AkabeiClient::Backend::instance(), SLOT(initialize()));
//QCoreApplication::instance()->quit();
QTimer
::
singleShot
(
0
,
QCoreApplication
::
instance
(),
SLOT
(
quit
()));
kDebug
()
<<
"Type"
<<
m_operationType
<<
"Operations"
<<
m_operations
<<
"Args"
<<
m_args
;
}
APM
::~
APM
()
{}
#include "apm.moc"
apm.h
View file @
0779d6e7
...
...
@@ -10,6 +10,8 @@
#ifndef APM_H
#define APM_H
#include <akabeibackend.h>
#include <QtCore/QObject>
#include <QStringList>
...
...
@@ -27,12 +29,31 @@ public:
};
enum
Operation
{
NoOperation
=
0
,
UpdateDatabases
=
1
,
UpdateSystem
=
2
///Query operations
ShowChangelog
,
ShowInstalledAsDeps
,
ShowInstalledExplicitely
,
ShowPackagesOfGroup
,
ShowInformation
,
CheckFiles
,
ShowLocal
,
ShowOwner
,
QueryPackageFile
,
SearchLocal
,
ShowNotRequired
,
ShowUpgradeable
,
ShowLess
,
///Sync operations
UpdateDatabases
,
UpdateSystem
};
explicit
APM
(
OperationType
type
,
QList
<
Operation
>
operations
,
QStringList
args
,
QObject
*
parent
=
0
);
virtual
~
APM
();
private
slots
:
void
statusChanged
(
Akabei
::
Backend
::
Status
);
void
start
();
private:
OperationType
m_operationType
;
QList
<
Operation
>
m_operations
;
...
...
cmake/modules/FindAkabeiClient.cmake
0 → 100644
View file @
0779d6e7
# - Try to find the akabei core library
# Once done this will define
#
# AKABEICLIENT_FOUND - system has akabei core
# AKABEICLIENT_INCLUDE_DIR - the akabei core include directory
# AKABEICLIENT_LIBRARIES - Link these to use akabei core
# Copyright (c) 2007 Joris Guisson <joris.guisson@gmail.com> (This was based upon FindKTorrent.cmake)
# Copyright (c) 2007 Charles Connell <charles@connells.org> (This was based upon FindKopete.cmake)
# Copyright (c) 2010 Lukas Appelhans <l.appelhans@gmx.de>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if
(
AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES
)
# read from cache
set
(
AKABEICLIENT_FOUND TRUE
)
else
(
AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES
)
FIND_PATH
(
AKABEICLIENT_INCLUDE_DIR
NAMES
akabeiclientbackend.h
PATHS
${
INCLUDE_INSTALL_DIR
}
PATH_SUFFIXES
akabeiclient
)
FIND_LIBRARY
(
AKABEICLIENT_LIBRARIES
NAMES
akabeiclient
PATHS
${
LIB_INSTALL_DIR
}
)
if
(
AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES
)
set
(
AKABEICLIENT_FOUND TRUE
)
endif
(
AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES
)
if
(
AKABEICLIENT_FOUND
)
if
(
NOT AKABEICLIENT_FIND_QUIETLY
)
message
(
STATUS
"Found akabei client:
${
AKABEICLIENT_LIBRARIES
}
"
)
endif
(
NOT AKABEICLIENT_FIND_QUIETLY
)
else
(
AKABEICLIENT_FOUND
)
if
(
AKABEICLIENT_FIND_REQUIRED
)
if
(
NOT AKABEICLIENT_INCLUDE_DIR
)
message
(
FATAL_ERROR
"Could not find akabei client includes."
)
endif
(
NOT AKABEICLIENT_INCLUDE_DIR
)
if
(
NOT AKABEICLIENT_LIBRARIES
)
message
(
FATAL_ERROR
"Could not find akabei client library."
)
endif
(
NOT AKABEICLIENT_LIBRARIES
)
else
(
AKABEICLIENT_FIND_REQUIRED
)
if
(
NOT AKABEICLIENT_INCLUDE_DIR
)
message
(
STATUS
"Could not find akabei client includes."
)
endif
(
NOT AKABEICLIENT_INCLUDE_DIR
)
if
(
NOT AKABEICLIENT_LIBRARIES
)
message
(
STATUS
"Could not find akabei client library."
)
endif
(
NOT AKABEICLIENT_LIBRARIES
)
endif
(
AKABEICLIENT_FIND_REQUIRED
)
endif
(
AKABEICLIENT_FOUND
)
endif
(
AKABEICLIENT_INCLUDE_DIR AND AKABEICLIENT_LIBRARIES
)
cmake/modules/FindAkabeiCore.cmake
0 → 100644
View file @
0779d6e7
# - Try to find the akabei core library
# Once done this will define
#
# AKABEICORE_FOUND - system has akabei core
# AKABEICORE_INCLUDE_DIR - the akabei core include directory
# AKABEICORE_LIBRARIES - Link these to use akabei core
# Copyright (c) 2007 Joris Guisson <joris.guisson@gmail.com> (This was based upon FindKTorrent.cmake)
# Copyright (c) 2007 Charles Connell <charles@connells.org> (This was based upon FindKopete.cmake)
# Copyright (c) 2010 Lukas Appelhans <l.appelhans@gmx.de>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if
(
AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES
)
# read from cache
set
(
AKABEICORE_FOUND TRUE
)
else
(
AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES
)
FIND_PATH
(
AKABEICORE_INCLUDE_DIR
NAMES
akabeibackend.h
PATHS
${
INCLUDE_INSTALL_DIR
}
PATH_SUFFIXES
akabeicore
)
FIND_LIBRARY
(
AKABEICORE_LIBRARIES
NAMES
akabeicore
PATHS
${
LIB_INSTALL_DIR
}
)
if
(
AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES
)
set
(
AKABEICORE_FOUND TRUE
)
endif
(
AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES
)
if
(
AKABEICORE_FOUND
)
if
(
NOT AKABEICORE_FIND_QUIETLY
)
message
(
STATUS
"Found akabei core:
${
AKABEICORE_LIBRARIES
}
"
)
endif
(
NOT AKABEICORE_FIND_QUIETLY
)
else
(
AKABEICORE_FOUND
)
if
(
AKABEICORE_FIND_REQUIRED
)
if
(
NOT AKABEICORE_INCLUDE_DIR
)
message
(
FATAL_ERROR
"Could not find akabei core includes."
)
endif
(
NOT AKABEICORE_INCLUDE_DIR
)
if
(
NOT AKABEICORE_LIBRARIES
)
message
(
FATAL_ERROR
"Could not find akabei core library."
)
endif
(
NOT AKABEICORE_LIBRARIES
)
else
(
AKABEICORE_FIND_REQUIRED
)
if
(
NOT AKABEICORE_INCLUDE_DIR
)
message
(
STATUS
"Could not find akabei core includes."
)
endif
(
NOT AKABEICORE_INCLUDE_DIR
)
if
(
NOT AKABEICORE_LIBRARIES
)
message
(
STATUS
"Could not find akabei core library."
)
endif
(
NOT AKABEICORE_LIBRARIES
)
endif
(
AKABEICORE_FIND_REQUIRED
)
endif
(
AKABEICORE_FOUND
)
endif
(
AKABEICORE_INCLUDE_DIR AND AKABEICORE_LIBRARIES
)
main.cpp
View file @
0779d6e7
...
...
@@ -31,6 +31,19 @@ int main(int argc, char** argv)
options
.
add
(
"D"
,
ki18n
(
"Database operation"
));
options
.
add
(
"Q"
,
ki18n
(
"Query operation"
));
options
.
add
(
"c"
,
ki18n
(
"Shows changelog of the package"
));
options
.
add
(
"d"
,
ki18n
(
"Shows packages which got installed as dependencies"
));
options
.
add
(
"e"
,
ki18n
(
"Shows packages which got installed explicitely"
));
options
.
add
(
"g"
,
ki18n
(
"Shows all packages in a package group"
));
options
.
add
(
"i"
,
ki18n
(
"Shows package information"
));
options
.
add
(
"k"
,
ki18n
(
"Check if the files of the package are available"
));
options
.
add
(
"m"
,
ki18n
(
"Shows packages which were not found in the Sync-db(s)"
));
options
.
add
(
"o"
,
ki18n
(
"Returns the package which contains the file"
));
options
.
add
(
"p"
,
ki18n
(
"Queries a package file instead of the database"
));
options
.
add
(
"s"
,
ki18n
(
"Searches locally installed packages"
));
options
.
add
(
"t"
,
ki18n
(
"Returns packages who are not required by others"
));
options
.
add
(
"u"
,
ki18n
(
"Returns upgradable packages"
));
options
.
add
(
"q"
,
ki18n
(
"Shows less information in queries and searches"
));
options
.
add
(
"R"
,
ki18n
(
"Remove operation"
));
...
...
@@ -61,6 +74,32 @@ int main(int argc, char** argv)
type
=
APM
::
DatabaseOperation
;
}
else
if
(
args
->
isSet
(
"Q"
))
{
type
=
APM
::
QueryOperation
;
if
(
args
->
isSet
(
"c"
))
list
.
append
(
APM
::
ShowChangelog
);
if
(
args
->
isSet
(
"d"
))
list
.
append
(
APM
::
ShowInstalledAsDeps
);
if
(
args
->
isSet
(
"e"
))
list
.
append
(
APM
::
ShowInstalledExplicitely
);
if
(
args
->
isSet
(
"g"
))
list
.
append
(
APM
::
ShowPackagesOfGroup
);
if
(
args
->
isSet
(
"i"
))
list
.
append
(
APM
::
ShowInformation
);
if
(
args
->
isSet
(
"k"
))
list
.
append
(
APM
::
CheckFiles
);
if
(
args
->
isSet
(
"m"
))
list
.
append
(
APM
::
ShowLocal
);
if
(
args
->
isSet
(
"o"
))
list
.
append
(
APM
::
ShowOwner
);
if
(
args
->
isSet
(
"p"
))
list
.
append
(
APM
::
QueryPackageFile
);
if
(
args
->
isSet
(
"s"
))
list
.
append
(
APM
::
SearchLocal
);
if
(
args
->
isSet
(
"t"
))
list
.
append
(
APM
::
ShowNotRequired
);
if
(
args
->
isSet
(
"u"
))
list
.
append
(
APM
::
ShowUpgradeable
);
if
(
args
->
isSet
(
"q"
))
list
.
append
(
APM
::
ShowLess
);
}
else
if
(
args
->
isSet
(
"R"
))
{
type
=
APM
::
RemoveOperation
;
}
else
if
(
args
->
isSet
(
"S"
))
{
...
...
@@ -86,24 +125,5 @@ int main(int argc, char** argv)
APM
apm
(
type
,
list
,
rest
);
/* // A binary option (on / off)
if (args->isSet("some-option"))
....
// An option which takes an additional argument
QString anotherOptionArg = args->getOption("another-option");
// Arguments (e.g. files to open)
for(int i = 0; i < args->count(); i++) // Counting start at 0!
{
openFile( args->arg(i));
// Or more convenient:
// openUrl( args->url(i));
}
args->clear(); // Free up some memory.
....
}*/
return
app
.
exec
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment