mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 19:02:53 +00:00
kdeplasma-addons: remove unused kdeobservatory data engine
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
17ee1d1b85
commit
973dbca0c5
14 changed files with 0 additions and 1285 deletions
|
@ -1,4 +1,3 @@
|
||||||
add_subdirectory(potd)
|
add_subdirectory(potd)
|
||||||
add_subdirectory(kdeobservatory)
|
|
||||||
add_subdirectory(kimpanel)
|
add_subdirectory(kimpanel)
|
||||||
add_subdirectory(konsoleprofiles)
|
add_subdirectory(konsoleprofiles)
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
project(plasma-kdeobservatoryengine)
|
|
||||||
|
|
||||||
include_directories(
|
|
||||||
${CMAKE_SOURCE_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(kdeobservatory_engine_SRCS
|
|
||||||
src/kdepresets.cpp
|
|
||||||
src/kdeobservatoryengine.cpp
|
|
||||||
src/kdeobservatoryservice.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
kde4_add_plugin(plasma_engine_kdeobservatory ${kdeobservatory_engine_SRCS})
|
|
||||||
|
|
||||||
target_link_libraries(plasma_engine_kdeobservatory
|
|
||||||
${QT_QTNETWORK_LIBRARY}
|
|
||||||
${KDE4_KDECORE_LIBS}
|
|
||||||
${KDE4_KIO_LIBS}
|
|
||||||
${KDE4_SOLID_LIBS}
|
|
||||||
${KDE4_PLASMA_LIBS})
|
|
||||||
|
|
||||||
install(TARGETS plasma_engine_kdeobservatory
|
|
||||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
|
||||||
|
|
||||||
install(FILES plasma-engine-kdeobservatory.desktop
|
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
|
||||||
|
|
||||||
install(FILES src/kdeobservatory.operations
|
|
||||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/plasma/services)
|
|
|
@ -1,104 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=KDE Observatory Data Engine
|
|
||||||
Name[ar]=محرك بيانات مرقاب كدي
|
|
||||||
Name[bs]=Pogon podataka za KDE opservatorij
|
|
||||||
Name[ca]=Motor de dades de l'observatori del KDE
|
|
||||||
Name[ca@valencia]=Motor de dades de l'observatori del KDE
|
|
||||||
Name[cs]=Datový nástroj KDE Observatory
|
|
||||||
Name[da]=Datamotor til KDE-observatorium
|
|
||||||
Name[de]=Datenmodul für das KDE-Observatorium
|
|
||||||
Name[el]=Μηχανή δεδομένων του παρατηρητηρίου KDE
|
|
||||||
Name[en_GB]=KDE Observatory Data Engine
|
|
||||||
Name[es]=Motor de datos del Observatorio de KDE
|
|
||||||
Name[et]=KDE ülevaataja andmemootor
|
|
||||||
Name[fi]=KDE-observatorion tietomoottori
|
|
||||||
Name[fr]=Moteur de données pour un observatoire de KDE
|
|
||||||
Name[ga]=Inneall Sonraí Réadlann KDE
|
|
||||||
Name[gl]=Motor de datos do observatorio de KDE
|
|
||||||
Name[hr]=Podatkovni mehanizam KDE-ovog opservatorija
|
|
||||||
Name[hu]=KDE obszervatórium-adatmotor
|
|
||||||
Name[it]=Motore dati Osservatorio di KDE
|
|
||||||
Name[ja]=KDE 展望台データエンジン
|
|
||||||
Name[kk]=KDE бақылау бекетінің деректер тетігі
|
|
||||||
Name[km]=ម៉ាស៊ីនទិន្នន័យអង្កេតរបស់ KDE
|
|
||||||
Name[ko]=KDE 전망대 데이터 엔진
|
|
||||||
Name[lv]=KDE observatorijas datu dzinējs
|
|
||||||
Name[mr]=केडीई वेधशाळा डेटा इंजिन
|
|
||||||
Name[nb]=Data-motor for KDE-observatorium
|
|
||||||
Name[nds]=Datenkarn för KDE-Projektkieker
|
|
||||||
Name[nl]=Gegevens-engine voor KDE Sterrenwacht
|
|
||||||
Name[pa]=KDE ਖਾਗੋਲਸ਼ਾਲਾ ਡਾਟਾ ਇੰਜਣ
|
|
||||||
Name[pl]=Silnik danych Obserwatorium KDE
|
|
||||||
Name[pt]=Motor de Dados do Observatório do KDE
|
|
||||||
Name[pt_BR]=Mecanismo de dados do observatório do KDE
|
|
||||||
Name[ro]=Motor de date pentru Observatorul KDE
|
|
||||||
Name[ru]=Источник данных для виджета KDE Observatory (разнообразная информация по проекту KDE в целом)
|
|
||||||
Name[sk]=Dátový nástroj observatória KDE
|
|
||||||
Name[sl]=Podatkovni pogon Opazovanje KDE-ja
|
|
||||||
Name[sr]=Датомотор опсерваторије КДЕ‑а
|
|
||||||
Name[sr@ijekavian]=Датомотор опсерваторије КДЕ‑а
|
|
||||||
Name[sr@ijekavianlatin]=Datomotor opservatorije KDE‑a
|
|
||||||
Name[sr@latin]=Datomotor opservatorije KDE‑a
|
|
||||||
Name[sv]=Datagränssnitt för KDE-observatorium
|
|
||||||
Name[tr]=KDE Gözlem Evi Veri Motoru
|
|
||||||
Name[uk]=Рушій даних Спостережного пункту KDE
|
|
||||||
Name[x-test]=xxKDE Observatory Data Enginexx
|
|
||||||
Name[zh_CN]=KDE 观测台数据引擎
|
|
||||||
Name[zh_TW]=KDE 觀測資料引擎
|
|
||||||
Comment=A Data Engine for acquiring consolidated data about KDE projects
|
|
||||||
Comment[ar]=محرك بيانات للحصول على بيانات موحدة عن مشاريع كدي
|
|
||||||
Comment[bs]=Pogon podataka za sticanje pročiščenih podataka o KDE projektima
|
|
||||||
Comment[ca]=Un motor de dades de captura de dades consolidades quant als projectes del KDE
|
|
||||||
Comment[ca@valencia]=Un motor de dades de captura de dades consolidades quant als projectes del KDE
|
|
||||||
Comment[cs]=Datový nástroj pro získávání sloučených údajů o projektech KDE
|
|
||||||
Comment[da]=En datamotor til at hente samlede data om KDE-projekter
|
|
||||||
Comment[de]=Ein Datenmodul zum Holen von zusammengefassten Daten über KDE-Projekte.
|
|
||||||
Comment[el]=Μία μηχανή δεδομένων για την απόκτηση συγκεντρωτικών στοιχείων για έργα του KDE
|
|
||||||
Comment[en_GB]=A Data Engine for acquiring consolidated data about KDE projects
|
|
||||||
Comment[es]=Un motor de datos para adquirir datos consolidados acerca de proyectos de KDE
|
|
||||||
Comment[et]=Andmemootor, mis hangib konsolideeritud andmeid KDE projektide kohta
|
|
||||||
Comment[fi]=Tietomoottori, jolla haetaan yhdistettyjä tietoja KDE-projekteista
|
|
||||||
Comment[fr]=Un moteur de données permettant l'obtention d'informations à propos des projets KDE
|
|
||||||
Comment[gl]=Un motor de datos para obter datos consolidados sobre os proxectos de KDE.
|
|
||||||
Comment[hr]=Podatkovni mehanizam za prikupljanje objedinjenih podataka o projektima KDE-a
|
|
||||||
Comment[hu]=Adatmotor összevont adatok beszerzéséhez a KDE projektekről
|
|
||||||
Comment[it]=Un motore di dati per l'acquisizione di dati consolidati sui progetti di KDE
|
|
||||||
Comment[kk]=KDE жобалар туралы біріктірген деректерді жинайтын тетігі
|
|
||||||
Comment[km]=ម៉ាស៊ីនទិន្នន័យ ដើម្បីការទាមទារទិន្នន័យដែលបានបង្រួមអំពីគម្រោងរបស់ KDE
|
|
||||||
Comment[ko]=KDE 프로젝트의 데이터를 가져오는 데이터 엔진
|
|
||||||
Comment[lv]=Datu dzinējs KDE projektu datu konsolidētai saņemšanai
|
|
||||||
Comment[mr]=केडिई परियोजना बद्दलची एकत्रित माहिती घेण्याकरिता डेटा इंजिन
|
|
||||||
Comment[nb]=En datamotor som skaffer sammensluttede data om KDE-prosjekter
|
|
||||||
Comment[nds]=En Datenkarn för't Halen vun tohoopstellt Daten över KDE-Projekten
|
|
||||||
Comment[nl]=Een gegevens-engine voor het ophalen van geconsolideerde gegevens over KDE-projecten
|
|
||||||
Comment[pl]=Silnik danych do pobierania skonsolidowanych danych o projektach KDE
|
|
||||||
Comment[pt]=Um motor de dados para adquirir dados consolidados acerca dos projectos do KDE
|
|
||||||
Comment[pt_BR]=Um mecanismo de dados para obtenção de informações sobre os projetos do KDE
|
|
||||||
Comment[ru]=Источник сводных данных о проектах KDE
|
|
||||||
Comment[sk]=Dátový nástroj pre získavanie zlúčených údajov o projektoch KDE
|
|
||||||
Comment[sl]=Podatkovni pogon za pridobivanje podatkov o KDE-jevih projektih
|
|
||||||
Comment[sr]=Датомотор за добављање систематизованих података о пројектима КДЕ‑а
|
|
||||||
Comment[sr@ijekavian]=Датомотор за добављање систематизованих података о пројектима КДЕ‑а
|
|
||||||
Comment[sr@ijekavianlatin]=Datomotor za dobavljanje sistematizovanih podataka o projektima KDE‑a
|
|
||||||
Comment[sr@latin]=Datomotor za dobavljanje sistematizovanih podataka o projektima KDE‑a
|
|
||||||
Comment[sv]=Ett datagränssnitt för att inhämta samlad data om KDE-projekt
|
|
||||||
Comment[tr]=KDE projeleri hakkında veri çekmeye yarayan veri motoru
|
|
||||||
Comment[uk]=Рушій даних для отримання загальних даних щодо внесків до проектів KDE
|
|
||||||
Comment[x-test]=xxA Data Engine for acquiring consolidated data about KDE projectsxx
|
|
||||||
Comment[zh_CN]=获取有关 KDE 项目统筹数据的数据引擎
|
|
||||||
Comment[zh_TW]=用於取得 KDE 專案的聯合資料的資料引擎
|
|
||||||
Type=Service
|
|
||||||
Icon=kdeobservatory
|
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/DataEngine
|
|
||||||
X-KDE-Library=plasma_engine_kdeobservatory
|
|
||||||
X-Plasma-EngineName=kdeobservatory
|
|
||||||
X-KDE-PluginInfo-Author=Sandro Andrade
|
|
||||||
X-KDE-PluginInfo-Email=sandroandrade@kde.org
|
|
||||||
X-KDE-PluginInfo-Name=kdeobservatory
|
|
||||||
X-KDE-PluginInfo-Version=0.1
|
|
||||||
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
|
||||||
X-KDE-PluginInfo-Category=Development Tools
|
|
||||||
X-KDE-PluginInfo-Depends=
|
|
||||||
X-KDE-PluginInfo-License=GPL
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
|
@ -1,174 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
use LWP::Simple;
|
|
||||||
use DBI;
|
|
||||||
|
|
||||||
if (@ARGV == 0)
|
|
||||||
{
|
|
||||||
print "Usage: load_commits.pl <YYYY-MM-DD>\n";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$hostname = "";
|
|
||||||
$database = "";
|
|
||||||
$user = "";
|
|
||||||
$password = "";
|
|
||||||
|
|
||||||
$driver = "mysql";
|
|
||||||
$dsn = "DBI:$driver:database=$database;host=$hostname";
|
|
||||||
$dbh = DBI->connect($dsn, $user, $password)
|
|
||||||
or die "Couldn't connect to database: " . DBI->errstr;
|
|
||||||
$dbh->{AutoCommit} = 0;
|
|
||||||
|
|
||||||
# In some cases a duplicated entry error will be raised because of just appeared commits
|
|
||||||
# that make the last commit in one page pass to the first one in previous page. I use the
|
|
||||||
# REPLACE statement to prevent such errors. Anyway, commits won't be missed.
|
|
||||||
my $commits_handle = $dbh->prepare_cached('REPLACE INTO commits VALUES (?,?,?,?)')
|
|
||||||
or die "Couldn't create commit handle";
|
|
||||||
|
|
||||||
my $develselect_handle = $dbh->prepare_cached('SELECT COUNT(*) FROM developers WHERE svn_account = ?')
|
|
||||||
or die "Couldn't create develselect handle";
|
|
||||||
|
|
||||||
my $develinsert_handle = $dbh->prepare_cached('INSERT INTO developers VALUES (?,?,?,?)')
|
|
||||||
or die "Couldn't create develinsert handle";
|
|
||||||
|
|
||||||
my $develupdate_handle = $dbh->prepare_cached('UPDATE developers SET last_commit = IF (? > last_commit, ?, last_commit), first_commit = IF (? < first_commit, ?, first_commit) WHERE svn_account = ?')
|
|
||||||
or die "Couldn't create develupdate handle";
|
|
||||||
|
|
||||||
my $year = substr $ARGV[0], 0, 4;
|
|
||||||
my $month = substr $ARGV[0], 5, 2;
|
|
||||||
|
|
||||||
my $r = 1;
|
|
||||||
my $commitCounter = 0;
|
|
||||||
my $invalidCounter = 0;
|
|
||||||
|
|
||||||
my $foundData = 0;
|
|
||||||
my $finished = 0;
|
|
||||||
|
|
||||||
while (!$finished)
|
|
||||||
{
|
|
||||||
my $url = 'http://lists.kde.org/?l=kde-commits&r=' . $r . '&b=' . $year . $month . '&w=4';
|
|
||||||
my $foundCommit = 0;
|
|
||||||
|
|
||||||
print "Getting url $url\n";
|
|
||||||
my $content = get $url;
|
|
||||||
if (!defined $content)
|
|
||||||
{
|
|
||||||
print "Failed to get url. 2nd attempt !\n";
|
|
||||||
$content = get $url;
|
|
||||||
}
|
|
||||||
if (!defined $content)
|
|
||||||
{
|
|
||||||
print "Failed to get url. 3rd attempt !\n";
|
|
||||||
$content = get $url;
|
|
||||||
}
|
|
||||||
die "Couldn't get $url" unless defined $content;
|
|
||||||
|
|
||||||
my @lines = split('\n', $content);
|
|
||||||
|
|
||||||
foreach my $line (@lines)
|
|
||||||
{
|
|
||||||
if ($line =~ /^\s*(\d+)\.\s(\d\d\d\d-\d\d-\d\d)\s\s<a href="(.+?)">(.+?)<\/a>\s*<a href="\?l=kde-commits&w=4">kde-commits<\/a>\s\s(.+)/)
|
|
||||||
{
|
|
||||||
$foundCommit = 1;
|
|
||||||
my ($commitNumber, $commitDate, $commitLink, $commitPath, $commitDeveloper) = ($1, $2, $3, $4, $5);
|
|
||||||
|
|
||||||
if ($commitDate eq $ARGV[0])
|
|
||||||
{
|
|
||||||
$foundData = 1;
|
|
||||||
$commitDeveloper =~ s/\s+$//;
|
|
||||||
|
|
||||||
my $commitContent = get "http://lists.kde.org/" . $commitLink;
|
|
||||||
if (!defined $commitContent)
|
|
||||||
{
|
|
||||||
print "Failed to get content url. 2nd attempt !\n";
|
|
||||||
$commitContent = get "http://lists.kde.org/" . $commitLink;
|
|
||||||
}
|
|
||||||
if (!defined $commitContent)
|
|
||||||
{
|
|
||||||
print "Failed to get content url. 3rd attempt !\n";
|
|
||||||
$commitContent = get "http://lists.kde.org/" . $commitLink;
|
|
||||||
}
|
|
||||||
die "Couldn't get content $url" unless defined $commitContent;
|
|
||||||
|
|
||||||
my @contentLines = split('\n', $commitContent);
|
|
||||||
|
|
||||||
my $commitDateTime = "";
|
|
||||||
my $commitSVNAccount = "";
|
|
||||||
my $commitLog = "";
|
|
||||||
my $enteredLogSection = 0;
|
|
||||||
foreach my $contentLine (@contentLines)
|
|
||||||
{
|
|
||||||
if ($contentLine =~ /Date:\s{7}<a href="\?l=kde-commits&r=\d+&w=4&b=\d{6}">(\d\d\d\d)-(\d\d)-(\d\d)\s(\d{1,2}):(\d\d):(\d\d)<\/a>/)
|
|
||||||
{
|
|
||||||
my ($year, $month, $day, $hour, $min, $sec) = ($1, $2, $3, $4, $5, $6);
|
|
||||||
$commitDateTime = sprintf ("%04d-%02d-%02d %02d:%02d:%02d", $year, $month, $day, $hour, $min, $sec);
|
|
||||||
}
|
|
||||||
elsif ($contentLine =~ /SVN commit \d+ by (.+):/)
|
|
||||||
{
|
|
||||||
$commitSVNAccount = $1;
|
|
||||||
$enteredLogSection = 1;
|
|
||||||
}
|
|
||||||
elsif ($contentLine =~ /^\s_?[AMDUGC]\s*(\+\d+\s*\-\d+)?\s*\S+/)
|
|
||||||
{
|
|
||||||
$enteredLogSection = 0;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
elsif ($enteredLogSection)
|
|
||||||
{
|
|
||||||
if ($commitLog ne "" and $contentLine ne "")
|
|
||||||
{
|
|
||||||
$commitLog = $commitLog . "\n";
|
|
||||||
}
|
|
||||||
$commitLog = $commitLog . $contentLine;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print "\"$commitNumber\"\n";
|
|
||||||
#print "\"$commitNumber\"\n\"$commitDateTime\"\n\"$commitLink\"\n\"$commitPath\"\n\"$commitDeveloper\"\n\"$commitSVNAccount\"\n\"$commitLog\"\n\n";
|
|
||||||
if ($commitSVNAccount ne "")
|
|
||||||
{
|
|
||||||
$commitCounter++;
|
|
||||||
|
|
||||||
$develselect_handle->execute($commitSVNAccount)
|
|
||||||
or die "Couldn't select developer: " . $dbh->errstr;
|
|
||||||
|
|
||||||
if ($develselect_handle->fetchrow() eq 0)
|
|
||||||
{
|
|
||||||
print "Devel nao existe, inserindo\n";
|
|
||||||
$develinsert_handle->execute($commitSVNAccount, $commitDeveloper, $commitDateTime, $commitDateTime)
|
|
||||||
or die "Couldn't insert developer: " . $dbh->errstr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "Devel ja existe, atualizando\n";
|
|
||||||
$develupdate_handle->execute($commitDateTime, $commitDateTime, $commitDateTime, $commitDateTime, $commitSVNAccount)
|
|
||||||
or die "Couldn't update developer: " . $dbh->errstr;
|
|
||||||
}
|
|
||||||
|
|
||||||
$commits_handle->execute($commitDateTime, $commitSVNAccount, $commitPath, $commitLog)
|
|
||||||
or die "Couldn't insert commit: " . $dbh->errstr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$invalidCounter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elsif ($foundData)
|
|
||||||
{
|
|
||||||
$finished = 1;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$foundCommit)
|
|
||||||
{
|
|
||||||
$finished = 1;
|
|
||||||
}
|
|
||||||
$r++;
|
|
||||||
}
|
|
||||||
$dbh->commit
|
|
||||||
or die "Couldn't commit: " . $dbh->errstr;
|
|
||||||
|
|
||||||
print "$commitCounter commits inserted\n";
|
|
||||||
print "$invalidCounter invalid commits\n";
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
# Finding today (Mocha) date which is yesterday's KDE server date ...
|
|
||||||
my ($year, $month, $day) = (localtime(time))[5,4,3];
|
|
||||||
$month++;
|
|
||||||
$year += 1900;
|
|
||||||
$date = sprintf ("%04d-%02d-%02d", $year, $month, $day);
|
|
||||||
|
|
||||||
print "Running /home/sandros/scripts/load_commits.pl $date\n";
|
|
||||||
exec "/home/sandros/scripts/load_commits.pl $date";
|
|
|
@ -1,219 +0,0 @@
|
||||||
import java.io.*;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.lang.reflect.*;
|
|
||||||
import javax.servlet.*;
|
|
||||||
import javax.servlet.http.*;
|
|
||||||
|
|
||||||
public class KdeCommitsServlet extends HttpServlet
|
|
||||||
{
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
|
||||||
{
|
|
||||||
String operation = null;
|
|
||||||
Class[] paramTypes = null;
|
|
||||||
Object[] paramValues = null;
|
|
||||||
|
|
||||||
PrintWriter out = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
out = response.getWriter();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
System.out.println("Error acquiring writer:" + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (request.getParameterMap().size() == 0)
|
|
||||||
{
|
|
||||||
response.setContentType("text/html");
|
|
||||||
out.println("No operation supplied !");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String dbHost = "";
|
|
||||||
String dbName = "";
|
|
||||||
String username = "";
|
|
||||||
String password = "";
|
|
||||||
|
|
||||||
Class.forName("com.mysql.jdbc.Driver");
|
|
||||||
|
|
||||||
String url ="jdbc:mysql://" + dbHost + ":3306/" + dbName;
|
|
||||||
|
|
||||||
Connection conn = DriverManager.getConnection(url, username, password);
|
|
||||||
|
|
||||||
response.setContentType("text/plain");
|
|
||||||
operation = request.getParameter("op");
|
|
||||||
paramTypes = new Class[request.getParameterMap().size()+1];
|
|
||||||
paramValues = new Object[paramTypes.length];
|
|
||||||
|
|
||||||
paramTypes[0] = PrintWriter.class;
|
|
||||||
paramValues[0] = out;
|
|
||||||
paramTypes[1] = Connection.class;
|
|
||||||
paramValues[1] = conn;
|
|
||||||
|
|
||||||
for (int i = 0; i < paramValues.length - 2; ++i)
|
|
||||||
{
|
|
||||||
paramTypes[i+2] = String.class;
|
|
||||||
paramValues[i+2] = request.getParameter("p" + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
Method method = getClass().getDeclaredMethod(operation, paramTypes);
|
|
||||||
method.invoke(this, paramValues);
|
|
||||||
conn.close();
|
|
||||||
}
|
|
||||||
catch(ClassNotFoundException e)
|
|
||||||
{
|
|
||||||
System.out.println("Error loading driver:" + e.getMessage());
|
|
||||||
}
|
|
||||||
catch(SQLException e)
|
|
||||||
{
|
|
||||||
String err1Msg = e.getMessage();
|
|
||||||
}
|
|
||||||
catch (NoSuchMethodException e)
|
|
||||||
{
|
|
||||||
response.setContentType("text/html");
|
|
||||||
out.println("Unsupported operation " + operation + " with " + paramTypes.length + " String parameters !");
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
response.setContentType("text/html");
|
|
||||||
out.println("Exception: " + e.getClass().getName() + " " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void allProjectsInfo(PrintWriter out, Connection conn) throws Exception
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String query = "select name, commit_subject, krazy_report, krazy_identifier, icon, add_in_view from projects";
|
|
||||||
Statement stmt = conn.createStatement();
|
|
||||||
ResultSet res = stmt.executeQuery(query);
|
|
||||||
printResultSet(out, res);
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
out.println("Exception: " + e.getClass().getName() + " " + e.getMessage());
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void topActiveProjects(PrintWriter out, Connection conn, String n, String fromDate, String toDate) throws Exception
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String query = "select p.name, count(*) from projects p, commits c where INSTR(c.path, p.commit_subject) > 0";
|
|
||||||
|
|
||||||
if (!fromDate.equals(""))
|
|
||||||
query = query + " and date(c.date_time) >= '" + fromDate + "'";
|
|
||||||
|
|
||||||
if (!toDate.equals(""))
|
|
||||||
query = query + " and date(c.date_time) <= '" + toDate + "'";
|
|
||||||
|
|
||||||
query = query + " group by p.commit_subject order by count(*) desc";
|
|
||||||
|
|
||||||
if (!n.equals("0"))
|
|
||||||
query = query + " limit 0 , " + n;
|
|
||||||
|
|
||||||
Statement stmt = conn.createStatement();
|
|
||||||
ResultSet res = stmt.executeQuery(query);
|
|
||||||
printResultSet(out, res);
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
out.println("Exception: " + e.getClass().getName() + " " + e.getMessage());
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void topProjectDevelopers(PrintWriter out, Connection conn, String project, String n, String fromDate, String toDate) throws Exception
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String query;
|
|
||||||
if (!project.equals(""))
|
|
||||||
query = "select d.full_name, d.svn_account, d.first_commit, d.last_commit, count(*) from projects p, commits c, developers d where INSTR(c.path, p.commit_subject) > 0 and d.svn_account = c.svn_account and p.name = '" + project + "'";
|
|
||||||
else
|
|
||||||
query = "select d.full_name, d.svn_account, d.first_commit, d.last_commit, count(*) from commits c, developers d where d.svn_account = c.svn_account";
|
|
||||||
|
|
||||||
if (!fromDate.equals(""))
|
|
||||||
query = query + " and date(c.date_time) >= '" + fromDate + "'";
|
|
||||||
|
|
||||||
if (!toDate.equals(""))
|
|
||||||
query = query + " and date(c.date_time) <= '" + toDate + "'";
|
|
||||||
|
|
||||||
if (!project.equals(""))
|
|
||||||
query = query + " group by d.full_name, p.name order by count(*) desc";
|
|
||||||
else
|
|
||||||
query = query + " group by d.full_name order by count(*) desc";
|
|
||||||
|
|
||||||
if (!n.equals("0"))
|
|
||||||
query = query + " limit 0 , " + n;
|
|
||||||
|
|
||||||
Statement stmt = conn.createStatement();
|
|
||||||
ResultSet res = stmt.executeQuery(query);
|
|
||||||
printResultSet(out, res);
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
out.println("Exception: " + e.getClass().getName() + " " + e.getMessage());
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void commitHistory(PrintWriter out, Connection conn, String project, String n, String fromDate, String toDate) throws Exception
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String query;
|
|
||||||
if (!project.equals(""))
|
|
||||||
query = "select date(c.date_time) date, count(*) from projects p, commits c where INSTR(c.path, p.commit_subject) > 0 and p.name = '" + project + "'";
|
|
||||||
else
|
|
||||||
query = "select date(c.date_time) date, count(*) from commits c";
|
|
||||||
|
|
||||||
if (!fromDate.equals(""))
|
|
||||||
query = query + " and date(c.date_time) >= '" + fromDate + "'";
|
|
||||||
|
|
||||||
if (!toDate.equals(""))
|
|
||||||
query = query + " and date(c.date_time) <= '" + toDate + "'";
|
|
||||||
|
|
||||||
if (!project.equals(""))
|
|
||||||
query = query + " group by date order by date asc";
|
|
||||||
|
|
||||||
if (!n.equals("0"))
|
|
||||||
query = query + " limit 0 , " + n;
|
|
||||||
|
|
||||||
Statement stmt = conn.createStatement();
|
|
||||||
ResultSet res = stmt.executeQuery(query);
|
|
||||||
printResultSet(out, res);
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
out.println("Exception: " + e.getClass().getName() + " " + e.getMessage());
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printResultSet(PrintWriter out, ResultSet res) throws Exception
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int count = res.getMetaData().getColumnCount();
|
|
||||||
while(res.next())
|
|
||||||
{
|
|
||||||
for (int i = 1; i < count; ++i)
|
|
||||||
out.print(res.getObject(i) + ";");
|
|
||||||
out.println(res.getObject(count));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
out.println("printResultSet Exception: " + e.getClass().getName() + " " + e.getMessage());
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
#! /usr/bin/env bash
|
|
||||||
$XGETTEXT *.cpp -o $podir/plasma_engine_kdeobservatory.pot
|
|
|
@ -1,59 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
|
|
||||||
<kcfg>
|
|
||||||
<group name="allProjectsInfo">
|
|
||||||
</group>
|
|
||||||
<group name="topActiveProjects">
|
|
||||||
<entry name="appletId" type="uint">
|
|
||||||
<label>Applet Id</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="commitFrom" type="String">
|
|
||||||
<label>Initial date</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="commitTo" type="String">
|
|
||||||
<label>Final date</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
<group name="topProjectDevelopers">
|
|
||||||
<entry name="appletId" type="uint">
|
|
||||||
<label>Applet Id</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="project" type="String">
|
|
||||||
<label>The project from which to acquire developers</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="commitFrom" type="String">
|
|
||||||
<label>Initial date</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="commitTo" type="String">
|
|
||||||
<label>Final date</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
<group name="commitHistory">
|
|
||||||
<entry name="appletId" type="uint">
|
|
||||||
<label>Applet Id</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="project" type="String">
|
|
||||||
<label>The project from which to acquire commits</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="commitFrom" type="String">
|
|
||||||
<label>Initial date</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="commitTo" type="String">
|
|
||||||
<label>Final date</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
<group name="krazyReport">
|
|
||||||
<entry name="appletId" type="uint">
|
|
||||||
<label>Applet Id</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="project" type="String">
|
|
||||||
<label>The project from which to acquire krazy errors</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="krazyReport" type="String">
|
|
||||||
<label>Krazy url</label>
|
|
||||||
</entry>
|
|
||||||
<entry name="krazyFilePrefix" type="String">
|
|
||||||
<label>Prefix for recursive looking for krazy reports</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
</kcfg>
|
|
|
@ -1,65 +0,0 @@
|
||||||
/*************************************************************************
|
|
||||||
* Copyright 2010 Sandro Andrade sandroandrade@kde.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) version 3 or any later version *
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved *
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy *
|
|
||||||
* defined in Section 14 of version 3 of the license. *
|
|
||||||
* *
|
|
||||||
* 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, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* ***********************************************************************/
|
|
||||||
|
|
||||||
#include "kdeobservatoryengine.h"
|
|
||||||
|
|
||||||
#include "kdepresets.h"
|
|
||||||
#include "kdeobservatoryservice.h"
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_DATAENGINE(kdeobservatory, KdeObservatoryEngine)
|
|
||||||
|
|
||||||
KdeObservatoryEngine::KdeObservatoryEngine(QObject *parent, const QVariantList &args)
|
|
||||||
: Plasma::DataEngine(parent, args)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryEngine::init()
|
|
||||||
{
|
|
||||||
setData("topActiveProjects", "");
|
|
||||||
setData("topProjectDevelopers", "");
|
|
||||||
setData("commitHistory", "");
|
|
||||||
setData("krazyReport", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KdeObservatoryEngine::sourceRequestEvent (const QString &source)
|
|
||||||
{
|
|
||||||
if (source == "allProjectsInfo")
|
|
||||||
{
|
|
||||||
setData("allProjectsInfo", "views", KdePresets::viewsPreset());
|
|
||||||
setData("allProjectsInfo", "viewsActive", KdePresets::viewsActivePreset());
|
|
||||||
setData("allProjectsInfo", "automaticallyInViews", KdePresets::automaticallyInViews());
|
|
||||||
setData("allProjectsInfo", "projectNames", KdePresets::preset(KdePresets::ProjectName));
|
|
||||||
setData("allProjectsInfo", "projectCommitSubjects", KdePresets::preset(KdePresets::ProjectCommitSubject));
|
|
||||||
setData("allProjectsInfo", "projectKrazyReports", KdePresets::preset(KdePresets::ProjectKrazyReport));
|
|
||||||
setData("allProjectsInfo", "projectKrazyFilePrefixes", KdePresets::preset(KdePresets::ProjectKrazyFilePrefix));
|
|
||||||
setData("allProjectsInfo", "projectIcons", KdePresets::preset(KdePresets::ProjectIcon));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Plasma::Service *KdeObservatoryEngine::serviceForSource(const QString &source)
|
|
||||||
{
|
|
||||||
Q_UNUSED(source);
|
|
||||||
KdeObservatoryService *service = new KdeObservatoryService(this);
|
|
||||||
service->setParent(this);
|
|
||||||
return service;
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*************************************************************************
|
|
||||||
* Copyright 2010 Sandro Andrade sandroandrade@kde.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) version 3 or any later version *
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved *
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy *
|
|
||||||
* defined in Section 14 of version 3 of the license. *
|
|
||||||
* *
|
|
||||||
* 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, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* ***********************************************************************/
|
|
||||||
|
|
||||||
#ifndef KDEOBSERVATORYENGINE_HEADER
|
|
||||||
#define KDEOBSERVATORYENGINE_HEADER
|
|
||||||
|
|
||||||
#include <Plasma/DataEngine>
|
|
||||||
|
|
||||||
typedef QMultiMap<int, QString> RankValueMap;
|
|
||||||
typedef QList< QPair<QString, int> > DateCommitList;
|
|
||||||
|
|
||||||
// FileType TestName FileName Error
|
|
||||||
typedef QMap< QString, QMap<QString, QMap<QString, QList<QString> > > > KrazyReportMap;
|
|
||||||
|
|
||||||
class KdeObservatoryEngine : public Plasma::DataEngine
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
KdeObservatoryEngine(QObject *parent, const QVariantList &args);
|
|
||||||
|
|
||||||
void init();
|
|
||||||
|
|
||||||
bool sourceRequestEvent (const QString &source);
|
|
||||||
Plasma::Service *serviceForSource(const QString &source);
|
|
||||||
|
|
||||||
friend class KdeObservatoryService;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void engineReady();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QHash< QString, QPair <QMap<QString, QVariant>, QVariant> > m_dataCache;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(RankValueMap)
|
|
||||||
Q_DECLARE_METATYPE(DateCommitList)
|
|
||||||
Q_DECLARE_METATYPE(KrazyReportMap)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,367 +0,0 @@
|
||||||
/*************************************************************************
|
|
||||||
* Copyright 2010 Sandro Andrade sandroandrade@kde.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) version 3 or any later version *
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved *
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy *
|
|
||||||
* defined in Section 14 of version 3 of the license. *
|
|
||||||
* *
|
|
||||||
* 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, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* ***********************************************************************/
|
|
||||||
|
|
||||||
#include "kdeobservatoryservice.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <KDebug>
|
|
||||||
#include <KUrl>
|
|
||||||
#include <KIO/Job>
|
|
||||||
#include <KIO/StoredTransferJob>
|
|
||||||
|
|
||||||
#include "kdepresets.h"
|
|
||||||
|
|
||||||
KdeObservatoryService::KdeObservatoryService(KdeObservatoryEngine *engine)
|
|
||||||
: Plasma::Service()
|
|
||||||
{
|
|
||||||
setName("kdeobservatory");
|
|
||||||
m_engine = engine;
|
|
||||||
|
|
||||||
connect(Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
|
|
||||||
this, SLOT(networkStatusChanged(Solid::Networking::Status)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Plasma::ServiceJob *KdeObservatoryService::createJob(const QString &operation, QMap<QString, QVariant> ¶meters)
|
|
||||||
{
|
|
||||||
if (Solid::Networking::status() != Solid::Networking::Connected && Solid::Networking::status() != Solid::Networking::Unknown)
|
|
||||||
{
|
|
||||||
emit engineError("fatal", i18n("No active network connection"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (m_engine->m_dataCache.contains(operation) && m_engine->m_dataCache[operation].first == parameters)
|
|
||||||
{
|
|
||||||
if (operation == "topActiveProjects")
|
|
||||||
{
|
|
||||||
m_engine->setData("topActiveProjects", "topActiveProjects", m_engine->m_dataCache[operation].second);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QString project = parameters["project"].toString();
|
|
||||||
m_engine->setData(operation, "project", project);
|
|
||||||
m_engine->setData(operation, project, m_engine->m_dataCache[operation].second);
|
|
||||||
}
|
|
||||||
m_engine->forceImmediateUpdateOfAllVisualizations();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (operation == "allProjectsInfo")
|
|
||||||
allProjectsInfo();
|
|
||||||
else if (operation == "topActiveProjects")
|
|
||||||
topActiveProjects(parameters);
|
|
||||||
else if (operation == "topProjectDevelopers")
|
|
||||||
topProjectDevelopers(parameters);
|
|
||||||
else if (operation == "commitHistory")
|
|
||||||
commitHistory(parameters);
|
|
||||||
else if (operation == "krazyReport")
|
|
||||||
krazyReport(parameters["project"].toString(), parameters["krazyReport"].toString(), parameters["krazyFilePrefix"].toString());
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::allProjectsInfo()
|
|
||||||
{
|
|
||||||
KIO::StoredTransferJob *job = KIO::storedGet(KUrl("http://sandroandrade.org/servlets/KdeCommitsServlet?op=allProjectsInfo"), KIO::NoReload, KIO::HideProgressInfo);
|
|
||||||
connect(job, SIGNAL(result(KJob*)), this, SLOT(resultServlet(KJob*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::topActiveProjects(QMap<QString, QVariant> ¶meters)
|
|
||||||
{
|
|
||||||
QString commitFrom = parameters["commitFrom"].toString();
|
|
||||||
QString commitTo = parameters["commitTo" ].toString();
|
|
||||||
|
|
||||||
KIO::StoredTransferJob *job = KIO::storedGet(KUrl("http://sandroandrade.org/servlets/KdeCommitsServlet?op=topActiveProjects&p0=0&p1=" + commitFrom + "&p2=" + commitTo), KIO::NoReload, KIO::HideProgressInfo);
|
|
||||||
m_jobParametersMap[job] = parameters;
|
|
||||||
connect(job, SIGNAL(result(KJob*)), this, SLOT(resultServlet(KJob*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::topProjectDevelopers(QMap<QString, QVariant> ¶meters)
|
|
||||||
{
|
|
||||||
QString project = parameters["project" ].toString();
|
|
||||||
QString commitFrom = parameters["commitFrom"].toString();
|
|
||||||
QString commitTo = parameters["commitTo" ].toString();
|
|
||||||
|
|
||||||
KIO::StoredTransferJob *job = KIO::storedGet(KUrl("http://sandroandrade.org/servlets/KdeCommitsServlet?op=topProjectDevelopers&p0=" + project + "&p1=0&p2=" + commitFrom + "&p3=" + commitTo), KIO::NoReload, KIO::HideProgressInfo);
|
|
||||||
m_jobParametersMap[job] = parameters;
|
|
||||||
connect(job, SIGNAL(result(KJob*)), this, SLOT(resultServlet(KJob*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::commitHistory(QMap<QString, QVariant> ¶meters)
|
|
||||||
{
|
|
||||||
QString project = parameters["project" ].toString();
|
|
||||||
QString commitFrom = parameters["commitFrom"].toString();
|
|
||||||
QString commitTo = parameters["commitTo" ].toString();
|
|
||||||
|
|
||||||
KIO::StoredTransferJob *job = KIO::storedGet(KUrl("http://sandroandrade.org/servlets/KdeCommitsServlet?op=commitHistory&p0=" + project + "&p1=0&p2=" + commitFrom + "&p3=" + commitTo), KIO::NoReload, KIO::HideProgressInfo);
|
|
||||||
m_jobParametersMap[job] = parameters;
|
|
||||||
connect(job, SIGNAL(result(KJob*)), this, SLOT(resultServlet(KJob*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::krazyReport(const QString &project, const QString &krazyReport, const QString &krazyFilePrefix)
|
|
||||||
{
|
|
||||||
KIO::StoredTransferJob *job;
|
|
||||||
|
|
||||||
m_projectKrazyReportMap[project].clear();
|
|
||||||
|
|
||||||
if (krazyReport.contains("reports"))
|
|
||||||
{
|
|
||||||
m_projectCounterMap[project] = 1;
|
|
||||||
job = KIO::storedGet(KUrl("http://www.englishbreakfastnetwork.org/krazy/" + krazyReport), KIO::NoReload, KIO::HideProgressInfo);
|
|
||||||
}
|
|
||||||
else if (krazyReport.contains("component="))
|
|
||||||
{
|
|
||||||
m_projectCounterMap[project] = 0;
|
|
||||||
job = KIO::storedGet(KUrl("http://www.englishbreakfastnetwork.org/krazy/index.php?" + krazyReport), KIO::NoReload, KIO::HideProgressInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_krazyJobMap[job] = QPair<QString, QString>(project, krazyFilePrefix);
|
|
||||||
|
|
||||||
connect(job, SIGNAL(result(KJob*)), this, SLOT(resultEBN(KJob*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::networkStatusChanged(Solid::Networking::Status status)
|
|
||||||
{
|
|
||||||
kDebug() << "Network status changed to" << status;
|
|
||||||
if (status == Solid::Networking::Connected)
|
|
||||||
startOperationCall(operationDescription("allProjectsInfo"));
|
|
||||||
else if (status == Solid::Networking::Unconnected)
|
|
||||||
emit engineError("fatal", i18n("No active network connection"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::resultServlet(KJob *job)
|
|
||||||
{
|
|
||||||
KIO::StoredTransferJob *storedJob = qobject_cast<KIO::StoredTransferJob*>(job);
|
|
||||||
|
|
||||||
QString url = QUrl::fromPercentEncoding(storedJob->url().prettyUrl().toUtf8());
|
|
||||||
QString mimeType = storedJob->mimetype();
|
|
||||||
|
|
||||||
QString source = "";
|
|
||||||
QRegExp regexp1("\\?op=(.*)(\\&|$)");
|
|
||||||
regexp1.setMinimal(true);
|
|
||||||
if (regexp1.indexIn(url, 0) != -1)
|
|
||||||
source = regexp1.cap(1);
|
|
||||||
|
|
||||||
if (job->error())
|
|
||||||
{
|
|
||||||
emit engineError(source, job->errorString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QString data (storedJob->data());
|
|
||||||
|
|
||||||
if (!data.isEmpty() && mimeType.contains("text/plain"))
|
|
||||||
{
|
|
||||||
QString project = "";
|
|
||||||
QRegExp regexp2("\\&p0=(.*)\\&p1");
|
|
||||||
if (regexp2.indexIn(url, 0) != -1)
|
|
||||||
project = regexp2.cap(1);
|
|
||||||
|
|
||||||
if (source == "allProjectsInfo")
|
|
||||||
{
|
|
||||||
KdePresets::init(data);
|
|
||||||
emit engineReady();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (source == "topActiveProjects")
|
|
||||||
{
|
|
||||||
RankValueMap topActiveProjects;
|
|
||||||
foreach (const QString &row, data.split('\n'))
|
|
||||||
{
|
|
||||||
if (!row.isEmpty())
|
|
||||||
{
|
|
||||||
QStringList list = row.split(';');
|
|
||||||
QString commits = list.at(1);
|
|
||||||
topActiveProjects.insert(commits.remove('\r').toInt(), list.at(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_engine->setData("topActiveProjects", "topActiveProjects", QVariant::fromValue<RankValueMap>(topActiveProjects));
|
|
||||||
// m_engine->m_dataCache.insert("topActiveProjects", QPair<QMap<QString, QVariant>, QVariant>(m_jobParametersMap[storedJob], QVariant::fromValue<RankValueMap>(topActiveProjects)));
|
|
||||||
}
|
|
||||||
else if (source == "topProjectDevelopers")
|
|
||||||
{
|
|
||||||
RankValueMap projectTopDevelopers;
|
|
||||||
foreach (const QString &row, data.split('\n'))
|
|
||||||
{
|
|
||||||
if (!row.isEmpty())
|
|
||||||
{
|
|
||||||
QStringList list = row.split(';');
|
|
||||||
QString commits = list.at(4);
|
|
||||||
projectTopDevelopers.insert(commits.remove('\r').toInt(), list.at(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_engine->setData("topProjectDevelopers", "project", project);
|
|
||||||
m_engine->setData("topProjectDevelopers", project, QVariant::fromValue<RankValueMap>(projectTopDevelopers));
|
|
||||||
// m_engine->m_dataCache.insert("topProjectDevelopers", QPair<QMap<QString, QVariant>, QVariant>(m_jobParametersMap[storedJob], QVariant::fromValue<RankValueMap>(projectTopDevelopers)));
|
|
||||||
}
|
|
||||||
else if (source == "commitHistory")
|
|
||||||
{
|
|
||||||
DateCommitList commitHistory;
|
|
||||||
foreach (const QString &row, data.split('\n'))
|
|
||||||
{
|
|
||||||
if (!row.isEmpty())
|
|
||||||
{
|
|
||||||
QStringList list = row.split(';');
|
|
||||||
QString commits = list.at(1);
|
|
||||||
commitHistory.append(QPair<QString, int>(list.at(0), commits.remove('\r').toInt()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_engine->setData("commitHistory", "project", project);
|
|
||||||
m_engine->setData("commitHistory", project, QVariant::fromValue<DateCommitList>(commitHistory));
|
|
||||||
// m_engine->m_dataCache.insert("commitHistory", QPair<QMap<QString, QVariant>, QVariant>(m_jobParametersMap[storedJob], QVariant::fromValue<DateCommitList>(commitHistory)));
|
|
||||||
}
|
|
||||||
m_engine->setData(source, "appletId", m_jobParametersMap[storedJob]["appletId"]);
|
|
||||||
m_engine->forceImmediateUpdateOfAllVisualizations();
|
|
||||||
m_jobParametersMap.remove(storedJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (source == "allProjectsInfo")
|
|
||||||
source = "fatal";
|
|
||||||
kDebug() << "Error:" << data;
|
|
||||||
emit engineError(source, i18n("Empty data or incorrect returned MIME type"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::resultEBN(KJob *job)
|
|
||||||
{
|
|
||||||
KIO::StoredTransferJob *storedJob = qobject_cast<KIO::StoredTransferJob*>(job);
|
|
||||||
|
|
||||||
if (job->error())
|
|
||||||
{
|
|
||||||
emit engineError("krazyReport", job->errorText());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QString data (storedJob->data());
|
|
||||||
|
|
||||||
if (!data.isEmpty())
|
|
||||||
{
|
|
||||||
if (data.contains("<h1>Not Found</h1>"))
|
|
||||||
{
|
|
||||||
emit engineError("krazyReport", i18n("Krazy report '%1' not found.", QUrl::fromPercentEncoding(storedJob->url().prettyUrl().toUtf8())));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.contains("<table style=\"clear: right;\" class=\"sortable\" id=\"reportTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">"))
|
|
||||||
{
|
|
||||||
processModule(data, storedJob);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parseReport(data, storedJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
emit engineError("krazyReport", i18n("Empty data or incorrect returned MIME type"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::processModule(const QString &data, KIO::StoredTransferJob *storedJob)
|
|
||||||
{
|
|
||||||
QRegExp exp("<a href=\"(reports.*)\".*<td.*>.*(\\d+).*</td>");
|
|
||||||
exp.setMinimal(true);
|
|
||||||
|
|
||||||
QString project = m_krazyJobMap[storedJob].first;
|
|
||||||
|
|
||||||
m_projectCounterMap[project] = 0;
|
|
||||||
m_projectKrazyReportMap[project].clear();
|
|
||||||
|
|
||||||
int pos = 0;
|
|
||||||
while ((pos = exp.indexIn(data, pos)) != -1)
|
|
||||||
{
|
|
||||||
if (exp.cap(2).toInt() > 0)
|
|
||||||
{
|
|
||||||
++m_projectCounterMap[project];
|
|
||||||
|
|
||||||
KIO::StoredTransferJob *job = KIO::storedGet(KUrl("http://www.englishbreakfastnetwork.org/krazy/" + exp.cap(1)), KIO::NoReload, KIO::HideProgressInfo);
|
|
||||||
connect(job, SIGNAL(result(KJob*)), this, SLOT(resultEBN(KJob*)));
|
|
||||||
|
|
||||||
m_krazyJobMap[job] = m_krazyJobMap[storedJob];
|
|
||||||
}
|
|
||||||
|
|
||||||
pos += exp.matchedLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_krazyJobMap.remove(storedJob);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeObservatoryService::parseReport(const QString &data, KIO::StoredTransferJob *storedJob)
|
|
||||||
{
|
|
||||||
QRegExp regExp1("<li><b><u>(.*)</u></b><ol>");
|
|
||||||
QRegExp regExp2("<li><span class=\"toolmsg\">(.*)<b>");
|
|
||||||
QRegExp regExp3("<li><a href=\"http://lxr.kde.org/source/[^<>]*" + m_krazyJobMap[storedJob].second + "(.*)\">.*</a>:\\s*(.*)\\s*</li>");
|
|
||||||
regExp1.setMinimal(true);
|
|
||||||
regExp2.setMinimal(true);
|
|
||||||
regExp3.setMinimal(true);
|
|
||||||
|
|
||||||
int pos = 0, pos1, pos2, pos3;
|
|
||||||
QString fileType;
|
|
||||||
QString testName;
|
|
||||||
pos1 = regExp1.indexIn(data, pos);
|
|
||||||
pos2 = regExp2.indexIn(data, pos);
|
|
||||||
pos3 = regExp3.indexIn(data, pos);
|
|
||||||
|
|
||||||
QString project = m_krazyJobMap[storedJob].first;
|
|
||||||
|
|
||||||
while (pos1 != -1 || pos2 != -1 || pos3 != -1)
|
|
||||||
{
|
|
||||||
pos = pos1;
|
|
||||||
if ((pos == -1) || (pos2 != -1 && pos2 < pos))
|
|
||||||
pos = pos2;
|
|
||||||
if ((pos == -1) || (pos3 != -1 && pos3 < pos))
|
|
||||||
pos = pos3;
|
|
||||||
if (pos == pos1)
|
|
||||||
{
|
|
||||||
fileType = regExp1.cap(1);
|
|
||||||
pos += regExp1.matchedLength();
|
|
||||||
}
|
|
||||||
else if (pos == pos2)
|
|
||||||
{
|
|
||||||
testName = regExp2.cap(1);
|
|
||||||
pos += regExp2.matchedLength();
|
|
||||||
}
|
|
||||||
else if (pos == pos3)
|
|
||||||
{
|
|
||||||
m_projectKrazyReportMap[project][fileType][testName][regExp3.cap(1)].append(regExp3.cap(2));
|
|
||||||
pos += regExp3.matchedLength();
|
|
||||||
}
|
|
||||||
pos1 = regExp1.indexIn(data, pos);
|
|
||||||
pos2 = regExp2.indexIn(data, pos);
|
|
||||||
pos3 = regExp3.indexIn(data, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
--m_projectCounterMap[project];
|
|
||||||
if (m_projectCounterMap[project] == 0)
|
|
||||||
{
|
|
||||||
m_engine->setData("krazyReport", "project", project);
|
|
||||||
m_engine->setData("krazyReport", project, QVariant::fromValue<KrazyReportMap>(m_projectKrazyReportMap[project]));
|
|
||||||
m_engine->forceImmediateUpdateOfAllVisualizations();
|
|
||||||
m_projectCounterMap.remove(project);
|
|
||||||
m_projectKrazyReportMap.remove(project);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_krazyJobMap.remove(storedJob);
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
/*************************************************************************
|
|
||||||
* Copyright 2010 Sandro Andrade sandroandrade@kde.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) version 3 or any later version *
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved *
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy *
|
|
||||||
* defined in Section 14 of version 3 of the license. *
|
|
||||||
* *
|
|
||||||
* 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, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* ***********************************************************************/
|
|
||||||
|
|
||||||
#ifndef KDEOBSERVATORYSERVICE_HEADER
|
|
||||||
#define KDEOBSERVATORYSERVICE_HEADER
|
|
||||||
|
|
||||||
#include "kdeobservatoryengine.h"
|
|
||||||
|
|
||||||
#include <Plasma/Service>
|
|
||||||
#include <solid/networking.h>
|
|
||||||
|
|
||||||
class KJob;
|
|
||||||
|
|
||||||
namespace KIO
|
|
||||||
{
|
|
||||||
class StoredTransferJob;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
class ServiceJob;
|
|
||||||
}
|
|
||||||
|
|
||||||
class KdeObservatoryService : public Plasma::Service
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
KdeObservatoryService(KdeObservatoryEngine *engine);
|
|
||||||
Plasma::ServiceJob *createJob(const QString &operation, QMap<QString, QVariant> ¶meters);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void allProjectsInfo();
|
|
||||||
void topActiveProjects(QMap<QString, QVariant> ¶meters);
|
|
||||||
void topProjectDevelopers(QMap<QString, QVariant> ¶meters);
|
|
||||||
void commitHistory(QMap<QString, QVariant> ¶meters);
|
|
||||||
void krazyReport(const QString &project, const QString &krazyReport, const QString &krazyFilePrefix);
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void engineReady();
|
|
||||||
void engineError(const QString &source, const QString &error);
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void networkStatusChanged(Solid::Networking::Status status);
|
|
||||||
void resultServlet(KJob *job);
|
|
||||||
void resultEBN(KJob *job);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void processModule(const QString &data, KIO::StoredTransferJob *storedJob);
|
|
||||||
void parseReport(const QString &data, KIO::StoredTransferJob *storedJob);
|
|
||||||
|
|
||||||
KdeObservatoryEngine *m_engine;
|
|
||||||
QMap< KIO::StoredTransferJob *, QPair<QString, QString> > m_krazyJobMap;
|
|
||||||
QMap<QString, KrazyReportMap> m_projectKrazyReportMap;
|
|
||||||
QMap<QString, int> m_projectCounterMap;
|
|
||||||
QMap< KIO::StoredTransferJob *, QMap<QString, QVariant> > m_jobParametersMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,74 +0,0 @@
|
||||||
/*************************************************************************
|
|
||||||
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.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) version 3 or any later version *
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved *
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy *
|
|
||||||
* defined in Section 14 of version 3 of the license. *
|
|
||||||
* *
|
|
||||||
* 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, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* ***********************************************************************/
|
|
||||||
|
|
||||||
#include "kdepresets.h"
|
|
||||||
|
|
||||||
#include <KLocale>
|
|
||||||
|
|
||||||
QList<QStringList> KdePresets::presets;
|
|
||||||
|
|
||||||
void KdePresets::init(const QString &data)
|
|
||||||
{
|
|
||||||
if (!data.isEmpty())
|
|
||||||
{
|
|
||||||
foreach (const QString &row, data.split('\n'))
|
|
||||||
{
|
|
||||||
if (!row.isEmpty())
|
|
||||||
{
|
|
||||||
QStringList list;
|
|
||||||
foreach (const QString &token, row.split(';'))
|
|
||||||
{
|
|
||||||
QString newToken = token;
|
|
||||||
list << newToken.remove('\r');
|
|
||||||
}
|
|
||||||
presets << list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList KdePresets::preset(PresetInfo info)
|
|
||||||
{
|
|
||||||
QStringList list;
|
|
||||||
int count = presets.count();
|
|
||||||
for (int i = 0; i < count; ++i)
|
|
||||||
list << presets.at(i).at(info);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QVariant> KdePresets::automaticallyInViews()
|
|
||||||
{
|
|
||||||
QList<QVariant> list;
|
|
||||||
int count = presets.count();
|
|
||||||
for (int i = 0; i < count; ++i)
|
|
||||||
list << ((presets.at(i).last() == "false") ? false:true);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList KdePresets::viewsPreset()
|
|
||||||
{
|
|
||||||
return QStringList() << i18n("Top Active Projects") << i18n("Commit History") << i18n("Top Developers") << i18n("Krazy Report");
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QVariant> KdePresets::viewsActivePreset()
|
|
||||||
{
|
|
||||||
return QList<QVariant>() << true << true << true << true;
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
/*************************************************************************
|
|
||||||
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.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) version 3 or any later version *
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved *
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy *
|
|
||||||
* defined in Section 14 of version 3 of the license. *
|
|
||||||
* *
|
|
||||||
* 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, see <http://www.gnu.org/licenses/>. *
|
|
||||||
* ***********************************************************************/
|
|
||||||
|
|
||||||
#ifndef KDEPRESETS_HEADER
|
|
||||||
#define KDEPRESETS_HEADER
|
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
class KdePresets
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void init(const QString &data);
|
|
||||||
|
|
||||||
enum PresetInfo
|
|
||||||
{
|
|
||||||
ProjectName = 0,
|
|
||||||
ProjectCommitSubject,
|
|
||||||
ProjectKrazyReport,
|
|
||||||
ProjectKrazyFilePrefix,
|
|
||||||
ProjectIcon
|
|
||||||
};
|
|
||||||
|
|
||||||
static QStringList preset(PresetInfo info);
|
|
||||||
static QList<QVariant> automaticallyInViews();
|
|
||||||
static QStringList viewsPreset();
|
|
||||||
static QList<QVariant> viewsActivePreset();
|
|
||||||
|
|
||||||
private:
|
|
||||||
static QList<QStringList> presets;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Add table
Reference in a new issue