code:
[Global]
IconName=yakuake
Comment=Yakuake
Comment[bg]=Yakuake
Comment[ca]=Yakuake
Comment[ca@valencia]=Yakuake
Comment[cs]=Yakuake
Comment[da]=Yakuake
Comment[de]=Yakuake
Comment[el]=Yakuake
Comment[es]=Yakuake
Comment[et]=Yakuake
Comment[fi]=Yakuake
Comment[ga]=Yakuake
Comment[gl]=Yakuake
Comment[hu]=Yakuake
Comment[it]=Yakuake
Comment[km]=Yakuake
Comment[lt]=Yakuake
Comment[nb]=Yakuake
Comment[nds]=Yakuake
Comment[nl]=Yakuake
Comment[pa]=ਯਾਕੁਕੀ
Comment[pl]=Yakuake
Comment[pt]=Yakuake
Comment[pt_BR]=Yakuake
Comment[ro]=Yakuake
Comment[sk]=Yakuake
Comment[sr]=Јакуаке
Comment[sr@ijekavian]=Јакуаке
Comment[sr@ijekavianlatin]=Yakuake
Comment[sr@latin]=Yakuake
Comment[sv]=Yakuake
Comment[tr]=Yakuake
Comment[ug]=Yakuake
Comment[uk]=Yakuake
Comment[x-test]=xxYakuakexx
Comment[zh_CN]=Yakuake
Comment[zh_TW]=Yakuake

[Event/startup]
Name=Startup
Name[ca]=Inici
Name[ca@valencia]=Inici
Name[cs]=Spuštění
Name[da]=Opstart
Name[de]=Programmstart
Name[el]=Εκκίνηση
Name[es]=Inicio
Name[et]=Käivitamine
Name[fi]=Käynnistys
Name[gl]=Inicio
Name[hu]=Indulás
Name[it]=Avvio
Name[km]=ចាប់ផ្ដើម
Name[lt]=Paleidimas
Name[nb]=Oppstart
Name[nds]=Start
Name[nl]=Opstarten
Name[pa]=ਸ਼ੁਰੂਆਤ
Name[pl]=Uruchamianie
Name[pt]=Arranque
Name[pt_BR]=Inicialização
Name[ro]=Pornire
Name[sk]=Spustenie
Name[sr]=Покретање
Name[sr@ijekavian]=Покретање
Name[sr@ijekavianlatin]=Pokretanje
Name[sr@latin]=Pokretanje
Name[sv]=Start
Name[tr]=Başlangıç
Name[ug]=قوزغىلىش
Name[uk]=Запуск
Name[x-test]=xxStartupxx
Name[zh_CN]=启动
Name[zh_TW]=啟動
Comment=Yakuake has started
Comment[ca]=S'ha engegat el Yakuake
Comment[ca@valencia]=S'ha engegat el Yakuake
Comment[cs]=Yakuake byl spuštěn
Comment[da]=Yakuake er startet
Comment[de]=Yakuake wurde gestartet
Comment[el]=Το Yakuake έχει ξεκινήσει
Comment[es]=Yakuake se ha iniciado
Comment[et]=Yakuake on käivitatud
Comment[fi]=Yakuake on käynnistynyt
Comment[gl]=O Yakuake foi iniciado
Comment[hu]=A Yakuake elindult
Comment[it]=Yakuake è avviato
Comment[km]=Yakuake បានចាប់ផ្ដើម
Comment[lt]=Yakuake paleistas
Comment[nb]=Yakuake har startet
Comment[nds]=Yakuake hett start.
Comment[nl]=Yakuake is opgestart
Comment[pa]=ਯਾਕੂਕੀ ਚਾਲੂ ਹੋਇਆ
Comment[pl]=Yakuake został uruchomiony
Comment[pt]=O Yakuake foi iniciado
Comment[pt_BR]=O Yakuake foi iniciado
Comment[ro]=Yakuake s-a pornit
Comment[sk]=Yakuake bolo spustené
Comment[sr]=Јакуаке је покренут
Comment[sr@ijekavian]=Јакуаке је покренут
Comment[sr@ijekavianlatin]=Yakuake je pokrenut
Comment[sr@latin]=Yakuake je pokrenut
Comment[sv]=Yakuake har startats
Comment[tr]=Yakuake başlatıldı
Comment[uk]=Yakuake запущено
Comment[x-test]=xxYakuake has startedxx
Comment[zh_CN]=Yakuake 已启动
Comment[zh_TW]=Yakuake 已啟動
Action=Popup

[Event/silence]
Name=Silence detected
Name[ca]=S'ha detectat silenci
Name[ca@valencia]=S'ha detectat silenci
Name[cs]=Detekováno ticho
Name[da]=Stilhed detekteret
Name[de]=Keine Aktivität festgestellt
Name[el]=Ανιχνεύθηκε αδράνεια
Name[es]=Silencio detectado
Name[et]=Tuvastati vaikus
Name[fi]=Hiljaisuutta havaittu
Name[gl]=Silencio detectado
Name[hu]=Csend érzékelve
Name[it]=Inattività rilevata
Name[km]=បានរកឃើញភាពស្ងាត់
Name[lt]=Aptikta tyla
Name[nb]=Stillhet oppdaget
Name[nds]=Still opdeckt
Name[nl]=Stilte ontdekt
Name[pa]=ਚੁੱਪ ਖੋਜਿਆ ਗਿਆ
Name[pl]=Wykryto ciszę
Name[pt]=Silêncio detectado
Name[pt_BR]=Silêncio detectado
Name[ro]=Tăcere detectată
Name[sk]=Detekované ticho
Name[sr]=Откривена тишина
Name[sr@ijekavian]=Откривена тишина
Name[sr@ijekavianlatin]=Otkrivena tišina
Name[sr@latin]=Otkrivena tišina
Name[sv]=Tystnad funnen
Name[tr]=Sessizlik belirlendi
Name[uk]=Виявлено бездіяльність
Name[x-test]=xxSilence detectedxx
Name[zh_CN]=探测到静默
Name[zh_TW]=偵測到沉默狀態
Comment=Silence detected in a monitored terminal or session
Comment[ca]=S'ha detectat silenci en un terminal vigilat o sessió
Comment[ca@valencia]=S'ha detectat silenci en un terminal vigilat o sessió
Comment[cs]=Detekováno ticho v monitorovaném terminálu nebo sezení
Comment[da]=Stilhed detekteret i en overvåget terminalsession
Comment[de]=In einem überwachten Terminal oder einer überwachten Sitzung wird keine Aktivität festgestellt
Comment[el]=Ανιχνεύθηκε αδράνεια σε ένα ελεγχόμενο τερματικό ή συνεδρία
Comment[es]=Se ha detectado silencio en una terminal o sesión monitoreada
Comment[et]=Jälgitavas terminalis või seansis tuvastati vaikus
Comment[fi]=Hiljaisuutta havaittu tarkkaillussa päätteessä tai istunnossa
Comment[gl]=Silencio detectado nunha terminal ou sesión monitorizada
Comment[hu]=Csend érzékelve egy figyelt terminálon vagy munkamenetben
Comment[it]=Inattività rilevata in un terminale o sessione monitorata
Comment[km]=បានរកឃើញភាពស្ងាត់នៅក្នុងសម័យ ឬស្ថានីយដែលបានត្រួតពិនិត្យ
Comment[lt]=Stebimoje terminale ar sesijoje pastebėta tyla
Comment[nb]=Det er oppdaget stillhet i en terminal eller økt som er overvåket
Comment[nds]=En beluurt Konsool oder Törn is still
Comment[nl]=Stilte ontdekt in een gevolgde terminal of sessie
Comment[pl]=Wykryto ciszę w monitorowanej sesji terminala
Comment[pt]=Silêncio detectado num terminal ou sessão vigiado
Comment[pt_BR]=Silêncio detectado em um terminal ou sessão monitorado
Comment[ro]=A fost detectată tăcere într-o sesiune sau terminal monitorizat
Comment[sk]=Detekované ticho v monitorovanom termináli alebo sedení
Comment[sr]=Откривена је тишина у надгледаном терминалу или сесији
Comment[sr@ijekavian]=Откривена је тишина у надгледаном терминалу или сесији
Comment[sr@ijekavianlatin]=Otkrivena je tišina u nadgledanom terminalu ili sesiji
Comment[sr@latin]=Otkrivena je tišina u nadgledanom terminalu ili sesiji
Comment[sv]=Tystnad funnen i en bevakad terminal eller session
Comment[tr]=İzlenen uçbirimde ya da oturumda sessizlik belirlendi
Comment[uk]=У сеансі або терміналі, за яким ведеться спостереження виявлено бездіяльність
Comment[x-test]=xxSilence detected in a monitored terminal or sessionxx
Comment[zh_CN]=在监视的终端或会话中探测到静默
Comment[zh_TW]=在一個監控中的終端機或工作階段偵測到沉默狀態
Action=Popup

[Event/activity]
Name=Activity detected
Name[ca]=S'ha detectat activitat
Name[ca@valencia]=S'ha detectat activitat
Name[cs]=Detekována aktivita
Name[da]=Aktivitet detekteret
Name[de]=Aktivität festgestellt
Name[el]=Ανιχνεύθηκε δραστηριότητα
Name[es]=Actividad detectada
Name[et]=Tuvastati aktiivsus
Name[fi]=Aktiivisuutta havaittu
Name[gl]=Actividade detectada
Name[hu]=Aktivitás észlelve
Name[it]=Attività rilevata
Name[km]=សកម្មភាពដែលបានរកឃើញ
Name[lt]=Aptikta veikla
Name[nb]=Aktivitet oppdaget
Name[nds]=Aktiviteet opdeckt
Name[nl]=Activiteit ontdekt
Name[pa]=ਐਕਟਵਿਟੀ ਖੋਜੀ ਗਈ
Name[pl]=Wykryto aktywność
Name[pt]=Actividade detectada
Name[pt_BR]=Atividade detectada
Name[ro]=Activitate detectată
Name[sk]=Detekovaná aktivita
Name[sr]=Откривена активност
Name[sr@ijekavian]=Откривена активност
Name[sr@ijekavianlatin]=Otkrivena aktivnost
Name[sr@latin]=Otkrivena aktivnost
Name[sv]=Aktivitet funnen
Name[tr]=Etkinlik belirlendi
Name[uk]=Виявлено діяльність
Name[x-test]=xxActivity detectedxx
Name[zh_CN]=探测到活动
Name[zh_TW]=偵測到活動
Comment=Activity detected in a monitored terminal or session
Comment[ca]=S'ha detectat activitat en un terminal vigilat o sessió
Comment[ca@valencia]=S'ha detectat activitat en un terminal vigilat o sessió
Comment[cs]=Detekována aktivita v monitorovaném terminálu nebo sezení
Comment[da]=Aktivitet detekteret i en overvåget terminal eller session
Comment[de]=In einem überwachten Terminal oder einer überwachten Sitzung wird Aktivität festgestellt
Comment[el]=Ανιχνεύθηκε δραστηριότητα σε ένα ελεγχόμενο τερματικό ή συνεδρία
Comment[es]=Se ha detectado actividad en una terminal o sesión monitoreada
Comment[et]=Jälgitavas terminalis või seansis tuvastati aktiivsus
Comment[fi]=Aktiivisuutta havaittu tarkkaillussa päätteessä tai istunnossa
Comment[gl]=Actividade detectada nunha terminal ou sesión monitorizada
Comment[hu]=Aktivitás érzékelve egy figyelt terminálon vagy munkamenetben
Comment[it]=Attività rilevata in un terminale o sessione monitorata
Comment[km]=សកម្មភាពដែលបានរកឃើញនៅក្នុងសម័យ ឬស្ថានីយដែលបានត្រួតពិនិត្យ
Comment[lt]=Stebimoje terminale ar sesijoje pastebėta veikla
Comment[nb]=Det er oppdaget aktivitet i en terminal eller økt som er overvåket
Comment[nds]=En beluurt Konsool oder Törn is Aktiviteet
Comment[nl]=Activiteit ontdekt in een gevolgde terminal of sessie
Comment[pl]=Wykryto aktywność w monitorowanej sesji terminala
Comment[pt]=Actividade detectada num terminal ou sessão vigiado
Comment[pt_BR]=Atividade detectada em um terminal ou sessão monitorado
Comment[ro]=A fost detectată activitate într-o sesiune sau terminal monitorizat
Comment[sk]=Detekovaná aktivita v monitorovanom termináli alebo sedení
Comment[sr]=Откривена је активност у надгледаном терминалу или сесији
Comment[sr@ijekavian]=Откривена је активност у надгледаном терминалу или сесији
Comment[sr@ijekavianlatin]=Otkrivena je aktivnost u nadgledanom terminalu ili sesiji
Comment[sr@latin]=Otkrivena je aktivnost u nadgledanom terminalu ili sesiji
Comment[sv]=Aktivitet funnen i en bevakad terminal eller session
Comment[tr]=İzlenen uçbirimde ya da oturumda etkinlik belirlendi
Comment[uk]=У сеансі або терміналі, за яким ведеться спостереження виявлено діяльність
Comment[x-test]=xxActivity detected in a monitored terminal or sessionxx
Comment[zh_CN]=在监视的终端或会话中探测到活动
Comment[zh_TW]=在一個監控中的終端機或工作階段偵測到有活動
Action=Popup

[Event/BellVisible]
Name=Bell in Visible Session
Name[bs]=Zvono u vidljivoj sesiji
Name[ca]=Timbre en una sessió visible
Name[cs]=Zvonek ve viditelném sezení
Name[da]=Bip i synlig session
Name[de]=Signalton in sichtbarer Sitzung
Name[el]=Ηχητικό σήμα σε ορατή συνεδρία
Name[et]=Heli nähtavas seansis
Name[fi]=Äänimerkki näkyvässä istunnossa
Name[ga]=Cloigín i Seisiún Infheicthe
Name[gl]=Badalada na sesión visíbel
Name[hu]=Csengő a látható munkamenetben
Name[it]=Campana in sessione visibile
Name[lt]=Skambutis matomoje sesijoje
Name[nb]=Varsel i synlig økt
Name[nl]=Geluidssignaal in zichtbare sessie
Name[nn]=Bjølle i synleg økt
Name[pl]=Dzwonek w widocznej sesji
Name[pt]=Campainha numa Sessão Visível
Name[pt_BR]=Campainha na sessão visível
Name[ro]=Clopoțel în sesiune vizibilă
Name[se]=Divga oainnus bargovuorus
Name[sk]=Zvonček v zobrazenom sedení
Name[sr]=Звоно у видљивој сесији
Name[sr@ijekavian]=Звоно у видљивој сесији
Name[sr@ijekavianlatin]=Zvono u vidljivoj sesiji
Name[sr@latin]=Zvono u vidljivoj sesiji
Name[sv]=Ljudsignal i synlig session
Name[uk]=Гудок у видимий сеанс
Name[x-test]=xxBell in Visible Sessionxx
Name[zh_CN]=可见会话中的响铃
Name[zh_TW]=可見工作階段響鈴
Comment=Bell emitted within a visible session
Comment[bs]=Oglašeno je zvono unutar vidljive sesije
Comment[ca]=Timbre emès en una sessió visible
Comment[cs]=Zvonek spuštěný ve viditelném sezení
Comment[da]=Bip udsendt indenfor en synlig session
Comment[de]=Signalton, der in einer sichtbaren Sitzung ertönt
Comment[el]=Ηχητικό σήμα εκπέμπεται σε ορατή συνεδρία
Comment[et]=Heli nähtavas seansis
Comment[fi]=Äänimerkki lähetetty näkyvässä istunnossa
Comment[ga]=Baineadh an cloigín i seisiún infheicthe
Comment[gl]=Badalada emitida nunha sesión visíbel
Comment[hu]=Csengetés a látható munkamenetben
Comment[it]=Campana emessa in una sessione visibile
Comment[lt]=Matomos sesijos metu skambutis neveiks
Comment[nb]=Signal sendt ut fra en synlig økt
Comment[nl]=Geluidssignaal aangeroepen in zichtbare sessie
Comment[nn]=Bjøllesignal sendt i ei synleg økt
Comment[pl]=Dzwonek uruchamiany w widocznej sesji
Comment[pt]=Campainha emitida dentro de uma sessão visível
Comment[pt_BR]=Campainha emitida dentro de uma sessão visível
Comment[ro]=Clopoțel emis în cadrul unei sesiuni vizibile
Comment[se]=Divgasignála sáddejuvvui oainnus bargovuorus
Comment[sk]=Zvonček poslaný v zobrazenom sedení
Comment[sr]=Емитовано је звоно унутар видљиве сесије.
Comment[sr@ijekavian]=Емитовано је звоно унутар видљиве сесије.
Comment[sr@ijekavianlatin]=Emitovano je zvono unutar vidljive sesije.
Comment[sr@latin]=Emitovano je zvono unutar vidljive sesije.
Comment[sv]=Ljudsignal avgiven inne i en synlig session
Comment[uk]=Звучить гудок у видимому сеансі
Comment[x-test]=xxBell emitted within a visible sessionxx
Comment[zh_CN]=可见会话中发生的响铃
Comment[zh_TW]=可見工作階段中的響鈴行為
Action=None

[Event/BellInvisible]
Name=Bell in Non-Visible Session
Name[bs]=Zvono u zaklonjenoj sesiji
Name[ca]=Timbre en una sessió no visible
Name[cs]=Zvonek ve skrytém sezení
Name[da]=Bip i ikke-synlig session
Name[de]=Signalton in nicht sichtbarer Sitzung
Name[el]=Ηχητικό σήμα σε μη ορατή συνεδρία
Name[et]=Heli nähtamatus seansis
Name[fi]=Äänimerkki näkymättömässä istunnossa
Name[ga]=Cloigín i Seisiún Dofheicthe
Name[gl]=Badalada nunha sesión non visíbel
Name[hu]=Csengő a nem látható munkamenetben
Name[it]=Campana in sessione non visibile
Name[lt]=Skambutis nematomoje sesijoje
Name[nb]=Varsel i ikke-synlig økt
Name[nl]=Geluidssignaal in niet-zichtbare sessie
Name[nn]=Bjølle i ikkje-synleg økt
Name[pl]=Dzwonek w niewidocznej sesji
Name[pt]=Campainha numa Sessão Invisível
Name[pt_BR]=Campainha na sessão não visível
Name[ro]=Clopoțel în sesiune nevizibilă
Name[se]=Divga oaidnemeahttun bargovuorus
Name[sk]=Zvonček v nezobrazenom sedení
Name[sr]=Звоно у сесији која није видљива
Name[sr@ijekavian]=Звоно у сесији која није видљива
Name[sr@ijekavianlatin]=Zvono u sesiji koja nije vidljiva
Name[sr@latin]=Zvono u sesiji koja nije vidljiva
Name[sv]=Ljudsignal i icke-synlig session
Name[uk]=Гудок у невидимому сеансі
Name[x-test]=xxBell in Non-Visible Sessionxx
Name[zh_CN]=不可见会话中的响铃
Name[zh_TW]=非可見工作階段的響鈴
Comment=Bell emitted within a non-visible session
Comment[bs]=Oglašeno je zvono unutar zaklonjene sesije
Comment[ca]=Timbre emès en una sessió no visible
Comment[cs]=Zvonek spuštěný ve skrytém sezení
Comment[da]=Bip udsendt indenfor en ikke-synlig session
Comment[de]=Signalton, der in einer nicht sichtbaren Sitzung ertönt
Comment[el]=Ηχητικό σήμα εκπέμπεται σε μη ορατή συνεδρία
Comment[et]=Heli nähtamatus seansis
Comment[fi]=Äänimerkki lähetetty näkymättömässä istunnossa
Comment[ga]=Baineadh an cloigín i seisiún dofheicthe
Comment[gl]=Badalada emitida nunha sesión non visíbel
Comment[hu]=Csengetés a nem látható munkamenetben
Comment[it]=Campana emessa in una sessione non visibile
Comment[lt]=Nematomos sesijos metu skambutis neveiks
Comment[nb]=Signal sendt ut i en økt som ikke er synlig
Comment[nl]=Geluidssignaal aangeroepen in niet-zichtbare sessie
Comment[nn]=Bjøllesignal sendt i ei ikkje-synleg økt
Comment[pl]=Dzwonek uruchamiany w niewidocznej sesji
Comment[pt]=Campainha emitida dentro de uma sessão não-visível
Comment[pt_BR]=Campainha emitida dentro de uma sessão não visível
Comment[ro]=Clopoțel emis în cadrul unei sesiuni nevizibile
Comment[se]=Divgasignála sáddejuvvui oaidnemeahttun bargovuorus
Comment[sk]=Zvonček poslaný v nezobrazenom sedení
Comment[sr]=Емитовано је звоно у сесији која није видљива.
Comment[sr@ijekavian]=Емитовано је звоно у сесији која није видљива.
Comment[sr@ijekavianlatin]=Emitovano je zvono u sesiji koja nije vidljiva.
Comment[sr@latin]=Emitovano je zvono u sesiji koja nije vidljiva.
Comment[sv]=Ljudsignal avgiven inne i en icke-synlig session
Comment[uk]=Звучить гудок у невидимому сеансі
Comment[x-test]=xxBell emitted within a non-visible sessionxx
Comment[zh_CN]=不可见会话中发生的响铃
Comment[zh_TW]=非可見工作階段中的響鈴行為
Sound=KDE-Sys-App-Message.ogg
Action=Popup


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>yakuake</Name>
        <Homepage>http://extragear.kde.org/apps/yakuake</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <Icon>yakuake</Icon>
        <IsA>app:gui</IsA>
        <Summary>Very powerful Quake style Konsole for KDE4</Summary>
        <Description>The name comes from Yet Another Kuake (thus YaKuake). Its behaviour is similar to the console of the Quake game.</Description>
        <Archive sha1sum="4abe2401f7745861d44a11f47d036c9c535464a1" type="tarxz">mirrors://kde/stable/yakuake/3.0.4/src/yakuake-3.0.4.tar.xz</Archive>
        <BuildDependencies>
            <Dependency versionFrom="5.7.1">qt5-base-devel</Dependency>
            <Dependency>libX11-devel</Dependency>
            <Dependency versionFrom="5.7.1">qt5-x11extras-devel</Dependency>
            <Dependency>knewstuff-devel</Dependency>
            <Dependency>kio-devel</Dependency>
            <Dependency>kparts-devel</Dependency>
            <Dependency>knotifyconfig-devel</Dependency>
            <Dependency>karchive-devel</Dependency>
            <Dependency>kcoreaddons-devel</Dependency>
            <Dependency>kconfig-devel</Dependency>
            <Dependency>kcrash-devel</Dependency>
            <Dependency>kdbusaddons-devel</Dependency>
            <Dependency>kglobalaccel-devel</Dependency>
            <Dependency>ki18n-devel</Dependency>
            <Dependency>kiconthemes-devel</Dependency>
            <Dependency>knewstuff-devel</Dependency>
            <Dependency>knotifications-devel</Dependency>
            <Dependency>kparts-devel</Dependency>
            <Dependency>kwidgetsaddons-devel</Dependency>
            <Dependency>kwindowsystem-devel</Dependency>
            <Dependency>gettext-devel</Dependency>
            <Dependency>extra-cmake-modules</Dependency>
            <Dependency>kwayland-devel</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>yakuake</Name>
        <RuntimeDependencies>
            <Dependency versionFrom="5.7.1">qt5-base</Dependency>
            <Dependency versionFrom="5.7.1">qt5-x11extras</Dependency>
            <Dependency>kio</Dependency>
            <Dependency>kcrash</Dependency>
            <Dependency>ki18n</Dependency>
            <Dependency>kparts</Dependency>
            <Dependency>kconfig</Dependency>
            <Dependency>kxmlgui</Dependency>
            <Dependency>karchive</Dependency>
            <Dependency>kservice</Dependency>
            <Dependency>knewstuff</Dependency>
            <Dependency>kwayland</Dependency>
            <Dependency>kcoreaddons</Dependency>
            <Dependency>kdbusaddons</Dependency>
            <Dependency>kiconthemes</Dependency>
            <Dependency>kglobalaccel</Dependency>
            <Dependency>knotifyconfig</Dependency>
            <Dependency>kwindowsystem</Dependency>
            <Dependency>kconfigwidgets</Dependency>
            <Dependency>knotifications</Dependency>
            <Dependency>kwidgetsaddons</Dependency>
            <Dependency>libX11</Dependency>
            <Dependency>libgcc</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc/xdg</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="library">/usr/lib/qt5</Path>
            <Path fileType="data">/usr/share</Path>
            <Path fileType="localedata">/usr/share/locale</Path>
            <Path fileType="doc">/usr/share/doc</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/usr/share/kde4/apps/yakuake/yakuake.notifyrc">yakuake.notifyrc</AdditionalFile>
        </AdditionalFiles>
    </Package>

    <History>
        <Update release="4">
            <Date>2017-09-16</Date>
            <Version>3.0.4</Version>
            <Comment>Rebuild for new Toolchain.</Comment>
            <Name>Mustafa Cinasal</Name>
            <Email>muscnsl@gmail.com</Email>
        </Update>
        <Update release="3">
            <Date>2017-03-02</Date>
            <Version>3.0.2</Version>
            <Comment>Rebuild for new Toolchain.</Comment>
            <Name>Stefan Gronewold(groni)</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-23</Date>
            <Version>3.0.2</Version>
            <Comment>Release bump</Comment>
            <Name>Stefan Gronewold(groni)</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-03-07</Date>
            <Version>3.0.2</Version>
            <Comment>First release</Comment>
            <Name>Stefan Gronewold(groni)</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
    </History>
</PISI>

repo_name: ayhanyalcinsoy/main


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>yakuake</Name>
        <Summary xml:lang="tr">KDE5 için Quake tarzı oldukça güçlü bir Konsole</Summary>
        <Description xml:lang="tr">İsmi Bir Başka Kuake (Yet Another Kuake - YaKuake) sözcüklerinden gelmektedir. Quake oyunundaki konsola benzer.</Description>
    </Source>
</PISI>


code:
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get

def build():
    pisitools.dosed("Makefile", "MANDIR = /usr/man", "MANDIR = /usr/share/man")
    autotools.make("-C po update-po")
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    pisitools.remove("/usr/sbin/ntsysv")
    pisitools.remove("/sbin/chkconfig")
    pisitools.remove("/usr/share/man/man8/chkconfig.8")
    pisitools.remove("/usr/share/man/man8/ntsysv.8")
    pisitools.removeDir("/usr/share/man/man5")
    pisitools.removeDir("/sbin")

    pisitools.dodoc("COPYING")


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>alternatives</Name>
        <Homepage>http://git.fedorahosted.org/git/?p=chkconfig.git;a=summary</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>app:console</IsA>
        <Summary>Alternative management system</Summary>
        <Description>alternatives creates, removes, maintains and displays information about the symbolic links comprising the alternatives system. Alternatives system determines the defaults when several programs fulfilling the same or similar functions to be installed on a single system at the same time.</Description>
        <Archive sha1sum="d2111640833792e96859559113c89467ea0f9a80" type="targz">https://github.com/fedora-sysv/chkconfig/archive/chkconfig-1.3.63.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>popt-devel</Dependency>
            <Dependency>newt-devel</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>alternatives</Name>
        <Files>
            <Path fileType="config">/etc</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="localedata">/usr/share/locale</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="data">/var</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-01-26</Date>
            <Version>1.3.63</Version>
            <Comment>Rebuild for new toolchain.</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-02</Date>
            <Version>1.3.63</Version>
            <Comment>Rebuild</Comment>
            <Name>Ayhan Yalçınsoy</Name>
            <Email>ayhanyalcinsoy@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-03-05</Date>
            <Version>1.3.63</Version>
            <Comment>First release</Comment>
            <Name>Ayhan Yalçınsoy</Name>
            <Email>ayhanyalcinsoy@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>alternatives</Name>
        <Summary xml:lang="tr">Alternatif yönetim sistemi</Summary>
        <Description xml:lang="tr">alternatives, alternatives sisteminin parçası olan sembolik bağlantıları oluşturan, silen, yöneten ve bunlar hakkında bilgi gösteren araçtır. Alternatives sistemi, birbirine benzer ya da aynı işlevleri sunan programların aynı anda aynı sisteme kurulduğu zamanlarda öntanımlıları belirler.</Description>
    </Source>
</PISI>


code:
<PISI>
    <Name>x11.util</Name>
</PISI>


code:
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get

def setup():
    autotools.configure("--with-mapdir=/usr/share/fonts/util")

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    pisitools.dodoc("ChangeLog", "COPYING", "README")


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>font-util</Name>
        <Homepage>http://www.x.org/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>MIT</License>
        <IsA>app:console</IsA>
        <Summary>X.Org font utilities</Summary>
        <Description>font-util package contains core font utilities for the Xorg XWindow system.</Description>
        <Archive sha1sum="0b16add3637c64b0bbaf1dd223b71b0421100c20" type="tarbz2">mirrors://xorg/individual/font/font-util-1.3.1.tar.bz2</Archive>
        <BuildDependencies>
            <Dependency>zlib-devel</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>font-util</Name>
        <Files>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="data">/usr/lib/pkgconfig</Path>
            <Path fileType="data">/usr/share/fonts</Path>
            <Path fileType="data">/usr/share/aclocal</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="man">/usr/share/man</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-01-26</Date>
            <Version>1.3.1</Version>
            <Comment>Rebuild</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-02</Date>
            <Version>1.3.1</Version>
            <Comment>Rebuild</Comment>
            <Name>Burak Ertürk</Name>
            <Email>burakerturk@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2015-05-10</Date>
            <Version>1.3.1</Version>
            <Comment>First release</Comment>
            <Name>Burak Ertürk</Name>
            <Email>burakerturk@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>font-util</Name>
        X.Org font araçları
        Utilitaires de fontes de X.Org
        X.Org Schrift Werkzeuge
    </Source>
</PISI>


code:
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import pisitools
from pisi.actionsapi import pythonmodules

def install():
    pythonmodules.install("--install-lib=/usr/lib/pardus")

    pisitools.dosym("zorg-cli", "/usr/bin/zorg")

    # This is now provided by xorg-server package.
    pisitools.remove("/usr/share/X11/DriversDB")


code:
# -*- coding: utf-8 -*-

from pisi.version import Version

def postInstall(fromVersion, fromRelease, toVersion, toRelease):
    if fromVersion and Version("0.90") <= Version(fromVersion) <= Version("0.96"):
        from zorg import config

        busId = call("zorg", "Xorg.Display", "activeDeviceID")
        device = config.getDeviceInfo(busId)

        if device:
            config.saveDeviceInfo(device)
            config.saveXorgConfig(device)

    if fromRelease and int(fromRelease) < 81:
        from zorg import config

        layout, variant = config.getKeymapOld()
        config.saveKeymap(layout, variant)


code:
# -*- coding: utf-8 -*-

import os

import comar
from pardus.sysutils import *

from zorg.config import *
from zorg.consts import *
from zorg.probe import *
from zorg.utils import *

kernel_module_file = os.path.join(config_dir, "kernel_module")

def getDevice():
    bus = configuredBus()
    if not bus:
        return None

    return getDeviceInfo(bus)

def getDeviceOutput(output):
    dev = getDevice()
    if not dev:
        return None, None

    if output not in dev.outputs:
        dev.outputs[output] = Output(output)

    return dev, dev.outputs[output]

# Model methods

def ready(boot):
    opts = {}

    if boot:
        opts = get_kernel_option("xorg")

    if "keymap" in opts:
        keymap = opts["keymap"].split("/", 1)
        setKeymap(*keymap)

    if "safe" in opts:
        return False

    driver = opts.get("driver")

    if driver or "probe" in opts:
        return initialConfig(driver)

    busId = configuredBus()
    if not busId:
        return initialConfig()

    if boot:
        # Check if the active card is changed
        try:
            device = getDeviceInfo(busId)
        except IOError:
            # Device is not present on specified bus.
            # Check if the new device is configured before.
            newBus = getPrimaryCard()
            if newBus:
                device = getDeviceInfo(VideoDevice(newBus).bus_id)
                if device and not device.isChanged():
                    # Yes, it is configured before.
                    # Reenable driver and write xorg.conf.
                    device.enableDriver()
                    saveXorgConfig(device)
                else:
                    # This is a different card.
                    return initialConfig()
            else:
                # No card is present. Return True in order to
                # start with a manually edited xorg.conf.
                return True
        else:
            if not device or device.isChanged():
                return initialConfig()

    # Check kernel module. Later, this should be done
    # with Xorg.Driver.ready method.
    if os.path.exists(kernel_module_file):
        kernelModule = file(kernel_module_file).read()
        if run("/sbin/modprobe", "-i", kernelModule) and kernelModule != "fglrx":
            return False

    return True

def initialConfig(preferredDriver=None):
    bus = getPrimaryCard()

    if bus:
        device = VideoDevice(bus)
    else:
        # This machine might be a terminal server with no video cards.
        # We start X and leave the decision to the user.
        log_debug("No video card found.")
        return True

    if preferredDriver is None:
        preferredDriver = device.preferredDriver()

    device.setDriver(preferredDriver)

    saveDeviceInfo(device)
    saveXorgConfig(device)

    return True

def safeConfig():
    bus = getPrimaryCard()

    if bus:
        device = VideoDevice(bus)
    else:
        # See the comment in initialConfig
        return True

    device.setDriver("vesa")
    device.depth = 16
    device.outputs["default"] = Output("default")
    device.monitors["default"] = Monitor()

    saveDeviceInfo(device)
    saveXorgConfig(device)

    return True

# FIXME Confusing method name
def activeDeviceID():
    return configuredBus()

def listDrivers():
    drivers = listAvailableDrivers()

    link = comar.Link()
    packages = list(link.Xorg.Driver)
    for package in packages:
        try:
            info = link.Xorg.Driver[package].getInfo()
        except dbus.DBusException:
            continue
        alias = str(info["alias"])
        driver = str(info["xorg-module"])
        drivers.append(alias)
        if driver in drivers:
            drivers.remove(driver)

    return sorted(drivers)

def setDriver(driver):
    dev = getDevice()
    if dev:
        dev.setDriver(driver)
        saveDeviceInfo(dev)

def setDepth(depth):
    dev = getDevice()
    if dev:
        dev.depth = depth
        saveDeviceInfo(dev)

def setOutput(output, enabled, ignored):
    dev, out = getDeviceOutput(output)

    if dev:
        out.setEnabled(enabled)
        out.setIgnored(ignored)

        saveDeviceInfo(dev)

def setMode(output, resolution, rate):
    dev, out = getDeviceOutput(output)

    if dev:
        out.setMode(resolution, rate)

        saveDeviceInfo(dev)

def setOrientation(output, rotation, reflection):
    dev, out = getDeviceOutput(output)

    if dev:
        out.setOrientation(rotation, reflection)

        saveDeviceInfo(dev)

def setPosition(output, position, arg):
    dev, out = getDeviceOutput(output)

    if dev:
        out.setPosition(position, arg)

        saveDeviceInfo(dev)

def setMonitor(output, vendor, model, horizSync, vertRefresh):
    dev, out = getDeviceOutput(output)

    if dev:
        if model:
            mon = Monitor()
            mon.vendor  = vendor
            mon.model   = model
            mon.hsync   = horizSync
            mon.vref    = vertRefresh
            dev.monitors[output] = mon
        elif output in dev.monitors:
            del dev.monitors[output]
        else:
            return

        saveDeviceInfo(dev)

def syncConfigs():
    dev = getDevice()
    if dev:
        saveXorgConfig(dev)

def setKeymap(layout, variant=""):
    saveKeymap(layout, variant)


code:
Index: zorg-2.0.4/zorg/config.py
===================================================================
--- zorg-2.0.4.orig/zorg/config.py
+++ zorg-2.0.4/zorg/config.py
@@ -11,6 +11,21 @@ from zorg.parser import *
 from zorg.probe import VideoDevice, Monitor, Output
 from zorg.utils import *

+KEYMAP_CONF_TEMPLATE="""\
+# This file is generated by zorg. If you want to change settings
+# in this file, edit the file 10-keyboard.conf in the same
+# directory.
+
+Section "InputClass"
+    Identifier      "Configured Keymap"
+    MatchIsKeyboard "on"
+    MatchTag        "use_configured_keymap"
+
+    %(comment_layout)sOption          "xkb_layout"    "%(layout)s"
+    %(comment_variant)sOption          "xkb_variant"   "%(variant)s"
+EndSection
+"""
+
 def saveXorgConfig(card):
     parser = XorgParser()

@@ -265,7 +280,7 @@ def saveDeviceInfo(card):
     f = open(consts.config_file, "w")
     f.write(doc.toPrettyString().replace("\n\n", ""))

-def getKeymap():
+def getKeymapOld():
     layout = None
     variant = ""

@@ -297,24 +312,44 @@ def getKeymap():

     return layout, variant

-def saveKeymap(layout, variant=""):
-    if not os.path.exists(consts.config_dir):
-        os.mkdir(consts.config_dir, 0755)
+def getKeymap():
+    layout = None
+    variant = ""

     try:
-        doc = piksemel.parse(consts.config_file)
+        p = XorgParser()
+        p.parseFile(consts.keymap_conf)
+        section = p.getSections("InputClass")[0]
+        layout = section.get("xkb_layout")
+        variant = section.get("xkb_variant", "")
+
     except OSError:
-        doc = piksemel.newDocument("ZORG")
+        pass
+
+    if not layout:
+        from pardus.localedata import languages

-    keyboardTag = doc.getTag("Keyboard")
+        try:
+            language = file("/etc/mudur/language").read().strip()
+        except IOError:
+            language = "en"
+
+        if not languages.has_key(language):
+            language = "en"

-    if keyboardTag:
-        keyboardTag.hide()
+        keymap = languages[language].keymaps[0]
+        layout = keymap.xkb_layout
+        variant = keymap.xkb_variant

-    keyboardTag = doc.insertTag("Keyboard")
-    keyboardTag.insertTag("Layout").insertData(layout)
-    if variant:
-        keyboardTag.insertTag("Variant").insertData(variant)
+    return layout, variant

-    f = file(consts.config_file, "w")
-    f.write(doc.toPrettyString().replace("\n\n", ""))
+def saveKeymap(layout, variant=""):
+    opts = {"layout": layout,
+            "variant": variant,
+            "comment_layout": "" if layout else "#",
+            "comment_variant": "" if variant else "#"}
+
+    with open(consts.keymap_conf, "w") as f:
+        f.write(KEYMAP_CONF_TEMPLATE % opts)
+        f.flush()
+        os.fsync(f.fileno())
Index: zorg-2.0.4/zorg/consts.py
===================================================================
--- zorg-2.0.4.orig/zorg/consts.py
+++ zorg-2.0.4/zorg/consts.py
@@ -8,6 +8,7 @@ data_dir    = "/usr/share/X11"
 modules_dir = "/usr/lib/xorg/modules"

 xorg_conf_file      = "/etc/X11/xorg.conf"
+keymap_conf         = "/etc/X11/xorg.conf.d/00-configured-keymap.conf"
 config_file         = join(config_dir,  "config.xml")
 configured_bus_file = join(config_dir,  "configured_bus")
 drivers_file        = join(data_dir,    "DriversDB")


code:
Index: zorg-cli
===================================================================
--- zorg-cli	(revision 31546)
+++ zorg-cli	(revision 31547)
@@ -94,8 +94,12 @@
         setDriver(opts.driver)

     elif opts.keymap:
-        keymap = opts.keymap.split("/", 1)
-        link.Xorg.Display["zorg"].setKeymap(*keymap)
+        if "/" in opts.keymap:
+            layout, variant = opts.keymap.split("/", 1)
+        else:
+            layout, variant = opts.keymap, ""

+        link.Xorg.Display["zorg"].setKeymap(layout, variant)
+
     else:
         parser.print_help()


code:
Section "Module"
    SubSection "extmod"
        Option  "omit xfree86-dga" "true"
    EndSubSection
EndSection

Section "ServerFlags"
    Option  "BlankTime" "0"
    Option  "OffTime" "0"
    Option  "SuspendTime" "0"
    Option  "AllowMouseOpenFail" "true"
    Option  "StandbyTime" "0"
EndSection

Section "Device"
    Identifier  "VideoCard"
    Driver  "vesa"
EndSection

Section "Screen"
    Identifier  "Screen"
    Device  "VideoCard"
    Monitor "Default Monitor"
    DefaultDepth    16
    SubSection "Display"
        Depth   16
        Modes "800x600" "640x480"
    EndSubSection
EndSection

Section "ServerLayout"
    Identifier  "Layout"
    Screen  "Screen"
EndSection

Section "Monitor"
    Identifier  "Default Monitor"
    HorizSync   31.5 - 50
    VertRefresh 50 - 70
EndSection


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>zorg</Name>
        <Homepage>http://www.pisilinux.org</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>app:console</IsA>
        <Summary>Çomar's X configuration tools</Summary>
        <Description>zorg is a set of X configuration tools and monitor and display adapter database files.</Description>
        <Archive sha1sum="e643f28430d9c6f190a5164e87960ae0094f0cd0" type="targz">https://github.com/forYali/zorg/archive/2.0.4.tar.gz</Archive>
        <Patches>
            <Patch level="1">keyboard-config.patch</Patch>
            <!--Patch>setkeymap-signature.patch</Patch-->
        </Patches>
    </Source>

    <Package>
        <Name>zorg</Name>
        <Files>
            <Path fileType="executable">/sbin</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="data">/usr/share/X11</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="data">/var/lib/zorg</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/usr/share/X11/xorg-safe.conf">xorg-safe.conf</AdditionalFile>
        </AdditionalFiles>
        <Provides>
            <COMAR script="xorg.display.py">Xorg.Display</COMAR>
            <COMAR script="package.py">System.Package</COMAR>
        </Provides>
    </Package>

    <History>
        <Update release="1">
            <Date>2017-03-05</Date>
            <Version>2.0.4</Version>
            <Comment>First release</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>zorg</Name>
        Çomar'ın X yapılandırma araçları
        <Description xml:lang="tr">X yapılandırma araçları, monitör ve ekran kartı veritabanları</Description>
        <Description xml:lang="fr">outils de configuration de X, fichiers de base de données des écrans et des cartes vidéo.</Description>
        Çomar's X-Konfigurationtools
    </Source>
</PISI>


code:
Minetest mod "Stamina"
=====================

(C) 2015 - BlockMen
(C) 2016 - Auke Kok <sofar@foo-projects.org>

About this mod:
---------------
This mod adds a stamina, or "hunger" mechanic to Minetest. Actions like
crafting, walking, digging or fighting make the player exhausted. When
enough exhaustion has been accumulated, the player gets more hungry,
and loses stamina.

If a player is low on stamina, they start taking periodical damage,
and ultimately will die if they do not eat food.

Eating food no longer heals the player. Instead, it increases the
stamina of the player. The stamina bar shows how well fed the player
is. More bread pieces means more stamina.

Q&A time: Why won't I move the stamina bar to the right?

Answer: this conflicts with the builtin breath bar. To move the
builtin breath bar, I basically have to entirely re-implement it
in lua including timers to catch breath changes for each online
player, which is all a waste of time, just to move a few pixels
around.

For Modders:
------------
This mod intercepts minetest.item_eat(), and applies the hp_change
as stamina change. The value can be positive (increase stamina) or
negative (periodically damage the player by 1 hp).

Callbacks that are registered via minetest.register_on_item_eat()
are called after this mod, so the itemstack will have changed already
when callbacks are called. You can get the original itemstack as 6th
parameter of your function then.

License:
--------
Code:
- all code LGPL-2.1+
Textures:
- stamina_hud_poison.png - BlockMen (CC-BY 3.0)
- stamina_hud_fg.png - PilzAdam (WTFPL), modified by BlockMen
- stamina_hud_bg.png - PilzAdam (WTFPL), modified by BlockMen
Sounds:
- stamina_eat.*.ogg - http://www.freesound.org/people/sonictechtonic/sounds/242215/ CC-BY-3.0

repo_name: Awkanimus/stamina

license: unknown


code:
default
3d_armor?


code: Adds stamina and hunger effects.


code:
stamina = {}

local stamina_players = {}

STAMINA_TICK = 800		-- time in seconds after that 1 stamina point is taken
STAMINA_TICK_MIN = 4		-- stamina ticks won't reduce stamina below this level
STAMINA_HEALTH_TICK = 4		-- time in seconds after player gets healed/damaged
STAMINA_MOVE_TICK = 0.5		-- time in seconds after the movement is checked

STAMINA_EXHAUST_DIG = 3		-- exhaustion increased this value after digged node
STAMINA_EXHAUST_PLACE = 1	-- .. after digging node
STAMINA_EXHAUST_MOVE = 1.5	-- .. if player movement detected
STAMINA_EXHAUST_JUMP = 5	-- .. if jumping
STAMINA_EXHAUST_CRAFT = 20	-- .. if player crafts
STAMINA_EXHAUST_PUNCH = 40	-- .. if player punches another player
STAMINA_EXHAUST_LVL = 160	-- at what exhaustion player saturation gets lowered

STAMINA_HEAL = 1		-- number of HP player gets healed after STAMINA_HEALTH_TICK
STAMINA_HEAL_LVL = 5		-- lower level of saturation needed to get healed
STAMINA_STARVE = 1		-- number of HP player gets damaged by stamina after STAMINA_HEALTH_TICK
STAMINA_STARVE_LVL = 3		-- level of staturation that causes starving

STAMINA_VISUAL_MAX = 20		-- hud bar extends only to 20

SPRINT_SPEED = 0.8 		-- how much faster player can run if satiated
SPRINT_JUMP = 0.1 		-- how much higher player can jump if satiated
SPRINT_DRAIN = 0.35 		-- how fast to drain satation while sprinting (0-1)

local function stamina_read(player)
	local inv = player:get_inventory()
	if not inv then
		return nil
	end

	-- itemstack storage is offest by 1 to make the math work
	local v = inv:get_stack("stamina", 1):get_count()
	if v == 0 then
		v = 21
		inv:set_stack("stamina", 1, ItemStack({name = ":", count = v}))
	end

	return v - 1
end

local function stamina_save(player)
	local inv = player:get_inventory()
	if not inv then
		return nil
	end
	local name = player:get_player_name()
	local level = stamina_players[name].level

	level = math.max(level, 0)

	inv:set_stack("stamina", 1, ItemStack({name = ":", count = level + 1}))
	return true
end

local function stamina_update(player, level)
	local name = player:get_player_name()
	if not name then
		return false
	end
	local old = stamina_players[name].level
	if level == old then
		return
	end
	stamina_players[name].level = level

	player:hud_change(stamina_players[name].hud_id, "number", math.min(STAMINA_VISUAL_MAX, level))
	stamina_save(player)
end

local function exhaust_player(player, v)
	if not player or not player:is_player() then
		return
	end

	local name = player:get_player_name()
	if not name then
		return
	end

	local s = stamina_players[name]
	if not s then
		return
	end

	local e = s.exhaust
	if not e then
		s.exhaust = 0
	end

	e = e + v

	if e > STAMINA_EXHAUST_LVL then
		e = 0
		local h = tonumber(stamina_players[name].level)
		if h > 0 then
			stamina_update(player, h - 1)
		end
	end

	s.exhaust = e
end

-- Sprint settings and function
local enable_sprint = minetest.setting_getbool("sprint") ~= false
local enable_sprint_particles = minetest.setting_getbool("sprint_particles") ~= false
local armor_mod = minetest.get_modpath("3d_armor")

function set_sprinting(name, sprinting)

	if stamina_players[name] then

		local player = minetest.get_player_by_name(name)
		local def = {}
		if armor_mod and armor and armor.def then
			def = armor.def[name] -- get player physics from armor
		end

		def.speed = def.speed or 1
		def.jump = def.jump or 1
		def.gravity = def.gravity or 1

		if sprinting == true then

			player:set_physics_override({
				speed = def.speed + SPRINT_SPEED,
				jump = def.jump + SPRINT_JUMP,
				gravity = def.gravity
			})

--print ("Speed:", def.speed + SPRINT_SPEED, "Jump:", def.jump + SPRINT_JUMP, "Gravity:", def.gravity)

		elseif sprinting == false then

			player:set_physics_override({
				speed = def.speed,
				jump = def.jump,
				gravity = def.gravity
			})

--print ("Speed:", def.speed, "Jump:", def.jump, "Gravity:", def.gravity)

		end

		return true
	end

	return false
end

-- Time based stamina functions
local stamina_timer = 0
local health_timer = 0
local action_timer = 0

local function stamina_globaltimer(dtime)
	stamina_timer = stamina_timer + dtime
	health_timer = health_timer + dtime
	action_timer = action_timer + dtime

	if action_timer > STAMINA_MOVE_TICK then
		for _,player in ipairs(minetest.get_connected_players()) do
			local controls = player:get_player_control()
			-- Determine if the player is walking
			if controls.jump then
				exhaust_player(player, STAMINA_EXHAUST_JUMP)
			elseif controls.up or controls.down or controls.left or controls.right then
				exhaust_player(player, STAMINA_EXHAUST_MOVE)
			end

			--- START sprint
			if enable_sprint then

				local name = player:get_player_name()

				-- check if player can sprint (stamina must be over 6 points)
				if controls.aux1 and controls.up
				and not minetest.check_player_privs(player, {fast = true})
				and stamina_players[name].level > 6 then

					set_sprinting(name, true)

					-- create particles behind player when sprinting
					if enable_sprint_particles then

						local pos = player:getpos()
						local node = minetest.get_node({
							x = pos.x, y = pos.y - 1, z = pos.z})

						if node.name ~= "air" then

						minetest.add_particlespawner({
							amount = 5,
							time = 0.01,
							minpos = {x = pos.x - 0.25, y = pos.y + 0.1, z = pos.z - 0.25},
							maxpos = {x = pos.x + 0.25, y = pos.y + 0.1, z = pos.z + 0.25},
							minvel = {x = -0.5, y = 1, z = -0.5},
							maxvel = {x = 0.5, y = 2, z = 0.5},
							minacc = {x = 0, y = -5, z = 0},
							maxacc = {x = 0, y = -12, z = 0},
							minexptime = 0.25,
							maxexptime = 0.5,
							minsize = 0.5,
							maxsize = 1.0,
							vertical = false,
							collisiondetection = false,
							texture = "default_dirt.png",
						})

						end
					end

					-- Lower the player's stamina when sprinting
					local level = tonumber(stamina_players[name].level)
					stamina_update(player, level - (SPRINT_DRAIN * STAMINA_MOVE_TICK))
				else
					set_sprinting(name, false)
				end
			end
			-- END sprint

		end
		action_timer = 0
	end

	-- lower saturation by 1 point after STAMINA_TICK second(s)
	if stamina_timer > STAMINA_TICK then
		for _,player in ipairs(minetest.get_connected_players()) do
			local name = player:get_player_name()
			local tab = stamina_players[name]
			if tab then
				local h = tab.level
				if h > STAMINA_TICK_MIN then
					stamina_update(player, h - 1)
				end
			end
		end
		stamina_timer = 0
	end

	-- heal or damage player, depending on saturation
	if health_timer > STAMINA_HEALTH_TICK then
		for _,player in ipairs(minetest.get_connected_players()) do
			local name = player:get_player_name()
			local tab = stamina_players[name]
			if tab then
				local air = player:get_breath() or 0
				local hp = player:get_hp()

				-- don't heal if drowning or dead
				-- TODO: don't heal if poisoned?
				local h = tonumber(tab.level)
				if h >= STAMINA_HEAL_LVL and h >= hp and hp > 0 and air > 0
				and tab.poison == false then
					player:set_hp(hp + STAMINA_HEAL)
					stamina_update(player, h - 1)
				end

				-- or damage player by 1 hp if saturation is < 2 (of 30)
				if tonumber(tab.level) < STAMINA_STARVE_LVL then
					player:set_hp(hp - STAMINA_STARVE)
				end
			end
		end

		health_timer = 0
	end
end

local function poison_player(ticks, time, elapsed, user)
	local name = user:get_player_name()
	if elapsed <= ticks then
		minetest.after(time, poison_player, ticks, time, elapsed + 1, user)
		stamina_players[name].poison = true
	else
		user:hud_change(stamina_players[name].hud_id, "text", "stamina_hud_fg.png")
		stamina_players[name].poison = false
	end
	local hp = user:get_hp() -1 or 0
	if hp > 0 then
		user:set_hp(hp)
	end
end

-- override core.do_item_eat() so we can redirect hp_change to stamina
core.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
	local old_itemstack = itemstack
	itemstack = stamina.eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
	for _, callback in pairs(core.registered_on_item_eats) do
		local result = callback(hp_change, replace_with_item, itemstack, user, pointed_thing, old_itemstack)
		if result then
			return result
		end
	end
	return itemstack
end

-- not local since it's called from within core context
function stamina.eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
	if not itemstack then
		return itemstack
	end

	if not user then
		return itemstack
	end

	local name = user:get_player_name()
	if not stamina_players[name] then
		return itemstack
	end

	local level = tonumber(stamina_players[name].level or 0)
	if level >= STAMINA_VISUAL_MAX then
		return itemstack
	end

	if hp_change > 0 then
		level = level + hp_change
		stamina_update(user, level)
	else
		-- assume hp_change < 0.
		user:hud_change(stamina_players[name].hud_id, "text", "stamina_hud_poison.png")
		poison_player(2.0, -hp_change, 0, user)
	end

	minetest.sound_play("stamina_eat", {to_player = name, gain = 0.7})

	if replace_with_item then
		if itemstack:is_empty() then
			itemstack:add_item(replace_with_item)
		else
			local inv = user:get_inventory()
			if inv:room_for_item("main", {name=replace_with_item}) then
				inv:add_item("main", replace_with_item)
			else
				local pos = user:getpos()
				pos.y = math.floor(pos.y + 0.5)
				core.add_item(pos, replace_with_item)
			end
		end
	else
		itemstack:take_item()
	end

	return itemstack
end

-- stamina is disabled if damage is disabled
if minetest.setting_getbool("enable_damage") and minetest.is_yes(minetest.setting_get("enable_stamina") or "1") then
	minetest.register_on_joinplayer(function(player)
		local inv = player:get_inventory()
		inv:set_size("stamina", 1)

		local name = player:get_player_name()
		stamina_players[name] = {}
		stamina_players[name].level = stamina_read(player)
		stamina_players[name].exhaust = 0
		stamina_players[name].poison = false
		local level = math.min(stamina_players[name].level, STAMINA_VISUAL_MAX)
		local id = player:hud_add({
			name = "stamina",
			hud_elem_type = "statbar",
			position = {x = 0.5, y = 1},
			size = {x = 24, y = 24},
			text = "stamina_hud_fg.png",
			number = level,
			alignment = {x = -1, y = -1},
			offset = {x = -266, y = -110},
			max = 0,
		})
		stamina_players[name].hud_id = id
	end)

	minetest.register_globalstep(stamina_globaltimer)

	minetest.register_on_placenode(function(pos, oldnode, player, ext)
		exhaust_player(player, STAMINA_EXHAUST_PLACE)
	end)
	minetest.register_on_dignode(function(pos, oldnode, player, ext)
		exhaust_player(player, STAMINA_EXHAUST_DIG)
	end)
	minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
		exhaust_player(player, STAMINA_EXHAUST_CRAFT)
	end)
	minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
		exhaust_player(hitter, STAMINA_EXHAUST_PUNCH)
	end)

	minetest.register_on_respawnplayer(function(player)
		stamina_update(player, STAMINA_VISUAL_MAX)
	end)
end


code:
[Desktop Entry]
Type=Application
Name=Dama
Exec=/usr/bin/dama
Icon=dama

repo_name: snapshot/dama


code:
#include "bob.h"

Bob::Bob(int id, int plid, QColor col, QWidget *parent) :
    QLabel(parent)
{
    this->id = id;
    this->plid = plid;
    this->col = col;

//    qDebug() << "cols" << col << col.lighter(150) << col.darker(150);

    nest = 0;
    state = unused;

    grad = new QRadialGradient();
    grad->setColorAt(0., col.lighter(150));
    grad->setColorAt(.35,col);
    grad->setColorAt(.80,col.darker(150));
    grad->setColorAt(.82,QColor(0,0,0,255));
    grad->setColorAt(.90,QColor(0,0,0,72));
    grad->setColorAt(1.,QColor(0,0,0,0));

    grad->setSpread(QGradient::PadSpread);

    resize(Nest::sz);
}

void Bob::resizeEvent(QResizeEvent *e) {
    if (!e->size().isEmpty()) {
        QPixmap pxm(e->size());
        pxm.fill(QColor(0,0,0,0));
        QPainter p(&pxm);
        int rad = qMin(pxm.width(),pxm.height())/2-1;

        grad->setCenter(pxm.rect().center());
        grad->setRadius(rad);

//        grad->setFocalPoint(pxm.width()*0.3,pxm.height()*0.4);
        grad->setFocalPoint(pxm.rect().center()-rad*QPointF(0.2,0.3));

        p.setBrush(QBrush(*grad));
        p.setPen(Qt::NoPen);
        p.drawEllipse(pxm.rect().center(),rad,rad);
        p.end();
        setPixmap(pxm);
//        qDebug() << "good bob size" << e->size() << rad << "grad"
//                 << grad->center() << grad->radius() << grad->focalPoint() ;
//    } else {
//        qDebug() << "bad bob size" << e->size();
    }

}

void Bob::mousePressEvent(QMouseEvent *ev) {
//    qDebug() << this << "picked";
    if (state != taken) emit got_me(this);
}

//void Bob::animmove()


code:
#ifndef BOB_H
#define BOB_H

#include <QtGui>
#include "nest.h"

class Bob : public QLabel
{
    Q_OBJECT
public:
    explicit Bob(int id, int plid, QColor col, QWidget *parent = 0);
    enum States {
        unused,
        ingame,
        taken
    };
    States state;
    int id;
    int plid;
    QColor col;
    Nest* nest;

    QRadialGradient* grad;

signals:
    void got_me(Bob*);

public slots:
    void mousePressEvent(QMouseEvent *ev);
    void resizeEvent(QResizeEvent *e);
//    void dragEnterEvent(QDragEnterEvent *);
//    void dragMoveEvent(QDragMoveEvent *);

};

#endif // BOB_H


code:
#include "bord.h"

Bord::Bord(QColor bcol, QWidget *parent) :
    QLabel(parent)
{

    this->bcol = bcol;
    lcol = QColor(0,0,0,255); //208,208,128,255);

//    grad = new QLinearGradient;
//    grad->setColorAt(0., QColor(0,0,0,0));
//    grad->setColorAt(.2, QColor(0,0,0,255));
//    grad->setColorAt(.5, lcol);
//    grad->setColorAt(.8, QColor(0,0,0,255));
//    grad->setColorAt(1., QColor(0,0,0,0));
//    grad->setColorAt(0., lcol);
//    grad->setColorAt(.05, lcol);
//    grad->setColorAt(.5, lcol);
//    grad->setColorAt(.95, lcol);
//    grad->setColorAt(1., QColor(0,0,0,255));

//    grad->setSpread(QGradient::PadSpread);
//    grad->setCoordinateMode(QGradient::ObjectBoundingMode);

    as.reserve(8);
    as << QPoint(1,0) << QPoint(1,1) << QPoint(0,1) << QPoint(-1,1) << QPoint(-1,0) << QPoint(-1,-1) << QPoint(0,-1) << QPoint(1,-1);

    nests.reserve(nn);
    for (int r=0; r<3; ++r) {
        for (int a=0; a<8; ++a) {
            nests << new Nest(r,a, 8*r + a, bcol, lcol, this);
        }
    }

    nests[ 0]->neighs << nests[ 1] << nests[ 7] << nests[ 8];
    nests[ 1]->neighs << nests[ 0] << nests[ 2];
    nests[ 2]->neighs << nests[ 1] << nests[ 3] << nests[10];
    nests[ 3]->neighs << nests[ 2] << nests[ 4];
    nests[ 4]->neighs << nests[ 3] << nests[ 5] << nests[12];
    nests[ 5]->neighs << nests[ 4] << nests[ 6];
    nests[ 6]->neighs << nests[ 5] << nests[ 7] << nests[14];
    nests[ 7]->neighs << nests[ 6] << nests[ 0];
    nests[ 8]->neighs << nests[ 0] << nests[ 9] << nests[15] << nests[16];
    nests[ 9]->neighs << nests[ 8] << nests[10];
    nests[10]->neighs << nests[ 2] << nests[ 9] << nests[11] << nests[18];
    nests[11]->neighs << nests[10] << nests[12];
    nests[12]->neighs << nests[ 4] << nests[11] << nests[13] << nests[20];
    nests[13]->neighs << nests[12] << nests[14];
    nests[14]->neighs << nests[ 6] << nests[13] << nests[15] << nests[22];
    nests[15]->neighs << nests[14] << nests[ 8];
    nests[16]->neighs << nests[17] << nests[23] << nests[ 8];
    nests[17]->neighs << nests[16] << nests[18];
    nests[18]->neighs << nests[17] << nests[19] << nests[10];
    nests[19]->neighs << nests[18] << nests[20];
    nests[20]->neighs << nests[19] << nests[21] << nests[12];
    nests[21]->neighs << nests[20] << nests[22];
    nests[22]->neighs << nests[21] << nests[23] << nests[14];
    nests[23]->neighs << nests[22] << nests[16];

//    qDebug() << (0 - 8) % 24 << (16+8)% 24;

    //resize(320, 320);

//    resize(320,458);

}

void Bord::mouseMoveEvent(QMouseEvent *ev) {
    ev->accept();
//    qDebug() << ev->pos();
}

void Bord::resizeEvent(QResizeEvent *e) {
    QSize sz = e->size();

    if (sz.isEmpty()) return;

//    qDebug() << "bord resize" << e->size();

//    int m = qMin(sz.width(),sz.height());
//    int nsz = 0.05*m;
//    int nsz2 = 0.05*m/2.;
//    int f = (1.-0.05)*m/(2.*3.);
//    int m2 = m/2;

    int m = qMin(sz.width(),sz.height());

    int nsz = 0.085*m;
    Nest::sz = QSize(nsz,nsz);
    int nsz2 = nsz/2;
    QSize f = (sz - Nest::sz)/(2.*3.);
    QSize sz2 = sz/2;

//    qDebug() << "sz,nsz,nsz2,f,m2" << sz << nsz << nsz2 << f << sz2;

//    QPoint ps;
    int nx, ny;

    for (int i=0; i < nn; ++i) {
        nx =  f.width()  * (nests[i]->r+1) * as[nests[i]->a].x() + sz2.width()  - nsz2;
        ny = -f.height() * (nests[i]->r+1) * as[nests[i]->a].y() + sz2.height() - nsz2;
        nests[i]->setGeometry(nx, ny, nsz, nsz);
    }

    QPixmap pxm(sz);
    pxm.fill(QColor(0,0,0,0));

    QPainter pnt(&pxm);
    pnt.setPen(Qt::NoPen);
    pnt.setBrush(QBrush(bcol));
    pnt.drawRoundedRect(pxm.rect(),5,5,Qt::RelativeSize);

    pnt.setPen(QPen(QBrush(lcol),3,Qt::SolidLine,Qt::FlatCap,Qt::RoundJoin));

    QLine ln;
    for (int i=0; i < nn; ++i) {
        for (int j=0; j < nests[i]->neighs.size(); ++j) {
            ln = QLine(nests[i]->geometry().center(), nests[i]->neighs[j]->geometry().center());

//            qreal len = qSqrt(ln.dx()*ln.dx() + ln.dy()*ln.dy());
//            grad->setStart(-ln.y1()/len + ln.x1(), ln.dx()/len + ln.y1());
//            grad->setFinalStop(ln.y1()/len + ln.x1(), -ln.dx()/len + ln.y1());

//            QPoint pt;

//            if (ln.dx() == 0) {
//                pt = QPoint(1,0);
//            } else if (ln.dy() == 0) {
//                pt = QPoint(0,1);
//            } else {
//                qDebug() << "\n\n\n\n\nnproblem\n\n\n\n\n\n" ;
//            }
//            grad->setStart(ln.p1() - pt*2);
//            grad->setFinalStop(ln.p1() + pt*2);

////            qDebug() << ln << len << QPoint(-ln.y1()/len + ln.x1(), ln.dx()/len + ln.y1()) << QPoint (ln.y1()/len + ln.x1(), -ln.dx()/len + ln.y1());
//            pnt.setPen(QPen(QBrush(*grad),2,Qt::SolidLine,Qt::FlatCap,Qt::RoundJoin));
            pnt.drawLine(ln);

        }
    }

    pnt.end();

//    pxm.save("ikona.png");
    setPixmap(pxm);

//    qDebug() << " nest sz" << Nest::sz;

}

bool Bord::have_line(int nid, int pid) {
    int lnid[2], unid[2];

    if (nid % 2 == 0) {

        lnid[0] = (nid + 16)%24;
        unid[0] = (nid +  8)%24;

        lnid[1] = (nid/8)*8 + (nid + 7)%8;
        unid[1] = (nid/8)*8 + (nid + 1)%8;

    } else {

        lnid[0] = (nid/8)*8 + (nid + 6)%8;
        unid[0] = (nid/8)*8 + (nid + 7)%8;

        lnid[1] = (nid/8)*8 + (nid + 1)%8;
        unid[1] = (nid/8)*8 + (nid + 2)%8;

    }

    bool r = false;

    for (int i=0; i<2; ++i) {
//        qDebug() << (nid%2 == 0) << lnid[i] << nid << unid[i] ;
        if (!(nests[lnid[i]]->empty            || nests[unid[i]]->empty)) {
            if (nests[lnid[i]]->bob->plid == pid && nests[unid[i]]->bob->plid == pid) {
                r = true;
                break;
            }
        }
    }

    return r;

}

//void Bord::paintEvent(QPaintEvent *e) {
//    qDebug() << e->rect() << size();
//    QPainter p(this);
//    p.drawRect(e->rect());
//    p.end();
//}


code:
#ifndef BORD_H
#define BORD_H

#include <QtGui>
#include "nest.h"
#include "bob.h"

class Bord : public QLabel
{
    Q_OBJECT
public:
    explicit Bord(QColor bcol, QWidget *parent = 0);
    QList<Nest*> nests;
    static const int nn = 24;
    QList<QPoint> as;

    bool have_line(int nid, int pid);
    QColor bcol, lcol;
    QLinearGradient* grad;

signals:

public slots:
    void mouseMoveEvent(QMouseEvent *ev);
//    void paintEvent(QPaintEvent *);
    void resizeEvent(QResizeEvent *);
};

#endif // BORD_H


code:
#-------------------------------------------------
#
# Project created by QtCreator 2011-06-22T01:34:00
#
#-------------------------------------------------

QT       += gui

TARGET = dama
TEMPLATE = app

SOURCES += main.cxx\
    bord.cxx \
    nest.cxx \
    bob.cxx \
    player.cpp \
    plbord.cpp \
    holder.cpp

HEADERS  += \
    bord.h \
    nest.h \
    bob.h \
    player.h \
    plbord.h \
    holder.h

OTHER_FILES += \
    qtc_packaging/debian_harmattan/rules \
    qtc_packaging/debian_harmattan/README \
    qtc_packaging/debian_harmattan/copyright \
    qtc_packaging/debian_harmattan/control \
    qtc_packaging/debian_harmattan/compat \
    qtc_packaging/debian_harmattan/changelog \

maemo6 {
    DEFINES+= Q_WS_MAEMO_6
}

target.path = /usr/bin
INSTALLS += target

icon80.path = /usr/share/themes/base/meegotouch/icons
icon80.files = dama.svg

launcher.files = Dama.desktop
launcher.path = /usr/share/applications

INSTALLS += launcher icon80


code:
#include "holder.h"
#include "nest.h"

Holder::Holder(QWidget *parent) :
    QWidget(parent)
{
//#if QT_VERSION >= 0x040704
#ifndef Q_WS_MAEMO_6
    setWindowFlags(Qt::FramelessWindowHint);
#endif

    bgcol = QColor(0,128,0,255);
    bcol = QColor(0,208,0,255);
    this->setPalette(QPalette(bgcol,bgcol));

    bord = new Bord(bcol, this);
    plr << new Player(0, QColor(255,0,0,255), this);
    plr << new Player(1, QColor(0,0,255,255), this);

    cpl = 0;
    sbob = 0;
    snest = 0;

    last_act = illegal;

    for (int i=0; i<2; ++i) {
        for (int j=0; j<Player::pcs; ++j) {
            connect(plr[i]->bobs[j], SIGNAL(got_me(Bob*)), this, SLOT(get_bob(Bob*)));
        }
    }

    for (int i=0; i<Bord::nn; ++i) {
        connect(bord->nests[i], SIGNAL(come_here(Nest*)), this, SLOT(get_nest(Nest*)));
    }

//    button = new QPushButton("Animated Button",this);
//    button->show();
    anim = new QPropertyAnimation(this);
    anim->setPropertyName("geometry");
    anim->setDuration(500);
    anim->setEasingCurve(QEasingCurve::OutCubic);

    connect(anim,SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), this, SLOT(lockkey(QAbstractAnimation::State,QAbstractAnimation::State)));

    pagain = new QPushButton(QString("PLAY"), this);
    nothanks = new QPushButton(QString("EXIT"),this);

    pagain->hide();
    nothanks->hide();

    pagain->setFlat(true);
    nothanks->setFlat(true);

    connect(pagain,SIGNAL(clicked()),this,SLOT(newgame()));
    connect(nothanks,SIGNAL(clicked()),this,SLOT(close()));

}

void Holder::lockkey(QAbstractAnimation::State nstate,QAbstractAnimation::State ostate) {
    if (nstate == QAbstractAnimation::Running && ostate == QAbstractAnimation::Stopped) {
        for (int i=0; i<2; ++i) {
            for (int j=0; j<Player::pcs; ++j) {
                plr[i]->bobs[j]->blockSignals(true);
            }
        }
        for (int i=0; i<Bord::nn; ++i) {
            bord->nests[i]->blockSignals(true);
        }
    }

    if (nstate == QAbstractAnimation::Stopped && ostate == QAbstractAnimation::Running) {
        for (int i=0; i<2; ++i) {
            for (int j=0; j<Player::pcs; ++j) {
                plr[i]->bobs[j]->blockSignals(false);
            }
        }
        for (int i=0; i<Bord::nn; ++i) {
            bord->nests[i]->blockSignals(false);
        }
    }
}

void Holder::get_bob(Bob* bob) {
    if (bob->state != Bob::taken) {
        sbob = bob;
        if (last_act == pointess) {
            bool res = takeaway(sbob->id, sbob->plid);
            if (res) {
                last_act = pointless;
            }
        }
//        qDebug() << "got bob" << sbob;
    }
}

void Holder::get_nest(Nest* nest) {

    for (int i=0; i<2; ++i) {
        for (int j=0; j<Player::pcs; ++j) {
//            qDebug() << "bops" << i << j <<  plr[i]->bobs[j]->isHidden() <<  plr[i]->bobs[j]->state << plr[i]->bobs[j]->geometry();
        }
    }

    if (sbob || (plr[cpl]->used_bobs < Player::pcs)) {

        for (int i=0; i< Player::pcs; ++i) {
            if (plr[cpl]->bobs[i]->state == Bob::unused) {
                sbob = plr[cpl]->bobs[i];
                break;
            }
        }
        if (!sbob) return ;
        if ((last_act == pointless || last_act == illegal) && nest != sbob->nest) {
            snest = nest;
            act_t res = act(sbob->id, snest->id, sbob->plid );
//            qDebug() << res;
            if (res != illegal) {
                last_act = res;
                sbob = 0;
                snest = 0;
            }
            if (res == gameover) endgame();
        }
    }

}

void Holder::resizeEvent(QResizeEvent *e) {
    QSize sz = e->size();
    bord->resize(sz.width()*0.6, sz.height()-20);
//    bord->resize(sz.height()-20, sz.height()-20);
//    bord->resize(64, 64);
//    qDebug() << "bsc,bs" << QSize(sz.width()*0.6, sz.height()-20) << bord->size() << size();
    bord->move((sz.width() - bord->width())/2, (sz.height() - bord->height())/2);

    for (int i=0;i<2;++i) {
        plr[i]->plb->resize(Nest::sz.width()+4, (Nest::sz.height()+4)*Player::pcs);
//        qDebug() << i << plr[i]->plb->size() << Nest::sz;
    }

    plr[0]->plb->move(10,10);
    plr[1]->plb->move(sz.width()-10-plr[1]->plb->width(),10);
//    qDebug() << "resizing holder";
}

Holder::act_t Holder::act(int bid, int nid, int pid) {

    if (    bid < 0 || bid >= Player::pcs
         || nid < 0 || nid >= Bord::nn
         || pid < 0 || pid >= 2 ) return illegal;

    Bob* bob = plr[cpl]->bobs[bid];
    Nest* nest = bord->nests[nid];

    if (    pid != cpl
         || bob->state == Bob::taken
         || !(nest->empty)) return illegal;

    if (    bob->state == Bob::ingame
            && (   !(nest->neighs.contains(bob->nest))
                   || (plr[0]->used_bobs < Player::pcs || plr[1]->used_bobs < Player::pcs))) return illegal;

    if (bob->state == Bob::ingame) {
        bob->nest->bob = 0;
        bob->nest->empty = true;
    }

    bob->nest = nest;
    nest->bob = bob;
    nest->empty = false;

    if (bob->state == Bob::unused) {

        bob->state = Bob::ingame;
        plr[cpl]->used_bobs += 1;

        QRect g = QRect(bob->pos()+plr[cpl]->plb->pos(), bob->size() );

        bob->hide();

//        plr[cpl]->plb->lay->removeWidget(bob);
//        plr[cpl]->plb->lay->update();
        bob->setParent(this);

        plr[cpl]->plb->removebob(bob);

        bob->setGeometry(g);
        bob->show();

//        qDebug() << "lay" << plr[cpl]->plb->lay->count() << plr[cpl]->plb->rect();

    }

    anim->setTargetObject(bob);
    anim->setStartValue(bob->geometry());
    anim->setEndValue(QRect(nest->pos() + bord->pos(), nest->size()));
    anim->start();

//    bob->setGeometry(QRect(nest->pos() + bord->pos(), nest->size()));

    last_act = (bord->have_line(nid,cpl)) ? pointess : pointless;

    if (last_act == pointess) plr[cpl]->pts += 1;

    int ncpl = (cpl+1)%2;

    if (   (last_act == pointess && plr[ncpl]->lost_bobs >= Player::pcs-3)
           || (last_act != pointess && plr[ncpl]->islandlocked())) last_act = gameover;

    if ( last_act != gameover) cpl = ncpl;

//    qDebug() << "\n";
//    for (int i=0; i<2; ++i) {
//        for (int j=0; j<Player::pcs; ++j) {
//            if (plr[i]->bobs[j]->state == Bob::unused) {
//                qDebug() << i << j << plr[i]->bobs[j]->state
//                         << plr[i]->bobs[j]->grad->center()
//                         << plr[i]->bobs[j]->grad->radius()
//                         << plr[i]->bobs[j]->grad->focalPoint()
//                         << plr[i]->bobs[j]->grad->stops();
//            }
//        }
//    }

//    endgame();

    return last_act;

}

bool Holder::takeaway(int bid, int pid) {
//    qDebug() << "take away bid and pid" << bid <<  pid;
    if (last_act != pointess || pid != cpl || bid < 0 || bid >= Player::pcs ) return false;

    Bob* bob = plr[cpl]->bobs[bid];
    if (bob->state != Bob::ingame) return false;

    bob->nest->bob = 0;
    bob->nest->empty = true;
    bob->nest = 0;
    plr[cpl]->lost_bobs += 1;

    int ncpl = (cpl+1)%2;

    connect(anim, SIGNAL(finished()), this, SLOT(bringbobback()));

    anim->setTargetObject(bob);
    anim->setStartValue(bob->geometry());
//    qDebug() << plr[ncpl]->plb->lay->geometry().bottom();
    anim->setEndValue(QRect( plr[ncpl]->plb->geometry().bottomLeft(), bob->size()));
    anim->start();

    bob->state = Bob::taken;

    if (plr[cpl]->islandlocked()) endgame();

    return true;

}

void Holder::bringbobback() {
//    sbob->setParent(plr[(sbob->plid+1)%2]->plb);
//    plr[(sbob->plid+1)%2]->plb->lay->addWidget(sbob);
    plr[(sbob->plid+1)%2]->plb->addbob(sbob);
    disconnect(anim, SIGNAL(finished()), this, SLOT(bringbobback()));
    sbob = 0;
}

void Holder::newgame() {

//    qDebug() << "newgame";
//    return;
    cpl = 0;
    sbob = 0;
    snest = 0;

    last_act = illegal;

    for (int i=0; i<2; ++i) {
        plr[i]->pts = 0;
        plr[i]->used_bobs = 0;
        plr[i]->lost_bobs = 0;

        for (int j=0; j<Player::pcs; ++j) {
            plr[i]->bobs[j]->state = Bob::unused;
            plr[i]->bobs[j]->nest = 0;
            if (plr[i]->bobs[j]->parent() != plr[i]->plb) {
                plr[(i+1)%2]->plb->removebob(plr[i]->bobs[j]);
                plr[i]->bobs[j]->resize(Nest::sz);
                plr[i]->plb->addbob(plr[i]->bobs[j]);

            }
        }

//        qDebug() << "cound" << plr[i]->plb->lay->count() << plr[i]->plb->bobs << plr[i]->col;
    }

    for (int i=0; i<Bord::nn; ++i) {
        bord->nests[i]->empty = true;
        bord->nests[i]->bob = 0;
    }

    pagain->hide();
    nothanks->hide();
}

void Holder::endgame() {

    pagain->setGeometry(width()/9., height()/3., width()/3., height()/3.);
    nothanks->setGeometry(width()*5./9., height()/3., width()/3., height()/3.);

    fnt.setPixelSize(pagain->height()/2.);

    pagain->setFont(fnt);
    nothanks->setFont(fnt);

    if (pagain->isHidden()) pagain->show();
    if (nothanks->isHidden()) nothanks->show();

    pagain->raise();
    nothanks->raise();
//    qDebug() << pagain->geometry() << nothanks->geometry();

}


code:
#ifndef HOLDER_H
#define HOLDER_H

#include <QWidget>

#include "bord.h"
#include "player.h"
class Bob;
class Nest;

class Holder : public QWidget
{
    Q_OBJECT
public:
    explicit Holder(QWidget *parent = 0);
    Bord *bord;
    QHBoxLayout* lyt;
    QList<Player*> plr;

    enum act_t {
        pointless,
        illegal,
        pointess,
        gameover
    };

    int cpl;
    Bob* sbob;
    Nest* snest;
    act_t last_act;
    int pts[2];
    act_t act(int bid, int nid, int pid);
    bool takeaway(int bid, int pid);
    QColor bcol, bgcol;

    QPushButton* pagain;
    QPushButton* nothanks;
    QFont fnt;
    QPropertyAnimation* anim;

signals:

public slots:
    void resizeEvent(QResizeEvent *e);
    void get_bob(Bob* bob);
    void get_nest(Nest* nest);
    void newgame();
    void bringbobback();
    void lockkey(QAbstractAnimation::State,QAbstractAnimation::State);
    void endgame();

};

#endif // HOLDER_H


code:
#include <QtGui>
#include "holder.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Holder hld;
    hld.show();
    hld.resize(854,480);
    return  a.exec();
}


code:
#include "mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    hld = new Holder(this);
    setCentralWidget(hld);

}

MainWindow::~MainWindow()
{

}


code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui>
#include "holder.h"

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
    Holder* hld;

};

#endif // MAINWINDOW_H


code:
#include "nest.h"
#include <QDebug>

Nest::Nest(int r, int a, int id, QColor bcol, QColor lcol, QWidget *parent) :
    QLabel(parent)
{
    this->r = r;
    this->a = a;
    this->id = id;
    this->bcol = bcol;
    this->lcol = lcol;

    empty = true;
    bob =0;
}

void Nest::resizeEvent(QResizeEvent *e) {
    QSize sz = e->size();
    if (sz.isEmpty()) return;

    QPixmap pxm(sz);
    pxm.fill(QColor(0,0,0,0));

    QPainter pnt(&pxm);
    int rad = 0.5*qMin(pxm.width(),pxm.height())/2;
    pnt.setBrush(QBrush(lcol));
//    pnt.setPen(QPen(QBrush(lcol),3,Qt::SolidLine,Qt::FlatCap,Qt::RoundJoin));
    pnt.drawEllipse(pxm.rect().center(), rad, rad);
//    pnt.drawRoundedRect(pxm.rect().adjusted(5,5,-5,-5), rad, rad);
    pnt.end();

    setPixmap(pxm);
//    setText(QString::number(id));

}

void Nest::mousePressEvent(QMouseEvent *ev) {
//    qDebug() << this << "picked";
    if (empty) emit come_here(this);
}

QSize Nest::sz = QSize();


code:
#ifndef NEST_H
#define NEST_H

#include <QtGui>
class Bob;

class Nest : public QLabel
{
    Q_OBJECT
public:
    explicit Nest(int r, int a, int id, QColor bcol, QColor lcol, QWidget *parent = 0);
    int r, a, id;
    QList<Nest*> neighs;
    bool ready, empty;
    static QSize sz;
    Bob* bob;
    QColor bcol, lcol;

signals:
    void come_here(Nest*);

public slots:
    void mousePressEvent(QMouseEvent *ev);
    void resizeEvent(QResizeEvent *);
//    void prepare();
//    void chill();

private:

};

#endif // NEST_H


code:
#include "player.h"

Player::Player(int id, QColor col, QObject *parent) :
    QObject(parent)
{
    this->id = id;
    this->col = col;

    prn = qobject_cast<QWidget*>(parent);

    plb = new PlBord(prn);

    bobs.reserve(pcs);
    for (int i = 0; i < pcs; ++i) {
        bobs << new Bob( i, id, col, plb);
    }

    for (int i = 0; i < pcs; ++i) {
//        plb->lay->addWidget(bobs[i]);
        plb->addbob(bobs[i]);
    }

    used_bobs = 0;
    lost_bobs = 0;
    pts = 0;

}

bool Player::islandlocked() {
    bool r = true;

    for (int i=0; i< Player::pcs; ++i) {
        if (bobs[i]->state == Bob::unused) {
            r = false;
            break;
        } else if (bobs[i]->state == Bob::ingame) {
            for (int j=0; j < bobs[i]->nest->neighs.size(); ++j) {
                if (bobs[i]->nest->neighs[j]->empty) {
                    r = false;
                    break;
                }
            }
            if (!r) break;
        }
    }

    return r;
}


code:
#ifndef PLAYER_H
#define PLAYER_H

#include <QtGui>
#include "bob.h"
#include "plbord.h"

class Player : public QObject
{
    Q_OBJECT
public:
    explicit Player(int id, QColor col, QObject *parent = 0);

    int id;
    QColor col;

    static const int pcs = 9;
    QList<Bob*> bobs;

    PlBord* plb;
    QWidget* prn;

    int used_bobs;
    int lost_bobs;
    int pts;

    bool islandlocked();

signals:

public slots:

};

#endif // PLAYER_H


code:
#include "plbord.h"

PlBord::PlBord(QWidget *parent) :
    QWidget(parent)
{
    lay = new QVBoxLayout(this);
    lay->setContentsMargins(4,4,4,4);
    setLayout(lay);
    bobs = 0;
}

void PlBord::addbob(Bob *bob) {
    QSize bsz = bob->size();
    bob->setParent(this);
    lay->addWidget(bob);
    bobs += 1;
//    if (!bsz.isEmpty()) resize(width()+4,bobs*(bsz.height()+4));
    bob->show();
}

void PlBord::removebob(Bob *bob) {

    QSize bsz = bob->size();
//    bob->hide();
//    bob->setParent(0);
    lay->removeWidget(bob);
    bobs -= 1;
//    if (!bsz.isEmpty()) resize(width(),bobs*(bsz.height()+4));
}


code:
#ifndef PLBORD_H
#define PLBORD_H

#include <QtGui>
#include "bob.h"

class PlBord : public QWidget
{
    Q_OBJECT
public:
    explicit PlBord(QWidget *parent = 0);
    QVBoxLayout* lay;
    int bobs;
signals:

public slots:
    void addbob(Bob*);
    void removebob(Bob*);
};

#endif // PLBORD_H


code:
The Debian Package dama
----------------------------

Comments regarding the Package

 -- Dimitar Pashov <pashov_d@unknown>  Thu, 14 Jul 2011 22:55:31 +0100


code:
dama (0.0.1) unstable; urgency=low

  * Initial Release.

 -- Dimitar Pashov <pashov_d@unknown>  Thu, 14 Jul 2011 22:55:31 +0100


code:
Source: dama
Section: user/other
Priority: optional
Maintainer: Dimitar Pashov <pashov_d@unknown>
Build-Depends: debhelper (>= 5), libqt4-dev
Standards-Version: 3.7.3
Homepage: <insert the upstream URL, if relevant>

Package: dama
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: An old board strategy game for two players
 Move the beans to assemble lines and take away the enemy's forces by strategy.
XSBC-Maemo-Display-Name: dama
XB-Maemo-Icon-26: iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A
 /wD/oL2nkwAAAAlwSFlzAAAQ6wAAEJwBMOoHTQAAAAd0SU1FB9sHEQI7LZRBzYUAAAVpSURBVHja
 7VtdaBxVFP5u2IoUkTZI8aksFYPSUERam4clJLXQEtIifYiboLW7rZLmj4gh2tJq1dJqSEsQtBFD
 sFUIhN1QsGi6VLApQlhLS0NZQ0UpJQTpQxUREZEZHyY3O/9z7p07+4cHhkxy7vn7cs85c+/MZYiA
 Xh3pxGfDU6s/AeAdDbqonnfrwFACkjZy/F/xoKKm92Ny8ZCFjv1TeUEH0cmHjPjWXwB+2w/sOg1c
 PgKwNYex7rH1eDm1BlPHR4JBOPp39QVvp1MP+8fpyzzyV/UDwOn0Wu9YPRlv/lk7AHD68BH3eF3/
 OPxH7QHAaeRRZ8yOPwz9XrsAcBpdZ43b8ssbD9wBOFNvGaOMztTrJr3qHglGTf4OPfCyXYy9zszQ
 NOdlBoAD4jZO9DIDwAFRoXe03gmI2zjXmTB4330WjG2IalLqKp/dfLW+ft997NgGw2DMPAuoNPBr
 eAg+ejwavXDRGxTbajromvvVv2wV6F/2Hity9S8zm16mRO+Azd8BH38dIPjlWe+SMaZ3SU09KOpl
 ABh6l5hSvX1LRmL1BfjLKQYAPfeg64R00LWIqkOZ9Pbcg/7JRrCYSD1wGzceL9533xVz8lwc+BgA
 NgKHBWTH47rJJhPy17MmUHLNbZwZAA4INXfPxZ2AUOTMAHBAqP56jQs9E+z06SbifzOELNUvalwx
 kZykjDt0h+h5g5zsRAPdL10kHSgV121cetGqLL1Ir+AHbbIHibLpRWazycj+eo0LVRN0DUgVDF6q
 IN7T0wWjlaUFZVMFo7WmCkzY30hrghaizcnKBsmVvCa48S5sKVby/QvMk3++0ck/v6V4/8qCXM6X
 pCb48cwA8ICpfDMAHBDRnBeJK9KZYKcvn6HxvyDqVzUTSloTOq8X76e2+vC30vSrqgl1ybyxbpDt
 Dl68ZN6a48k8I/M78zZw8uLVn9odknnoMZHKLDoTOuYZppuAjnlvvpf8i/NYlYUWcXcQWcHJ1oQw
 q8Qwesk1IcqZEPUzhLKaQMmbbEIHoCObcK7YMgljXy+TgBAv2KbhYDYh5g+Fb7/qgvroTLO1n880
 F/t5ttmKaLYZJF6wTdhs0vyh8N2umEy+XmyR44WpDbI2KXZjMvm658rKzU4xXpjawPV+5WfTgx+4
 2xyUL+05az9vzxX7+Z6czZkcSLxgm7DZpPlD4btdrG2W9u7x691A26xaXlQ2Re3+/5wQ9XPCbPvK
 TRuw+5IPH07+5XZjgn7TBuy6xMr/nCCzdjAHyAOm8jkAZkCiWjvoGhDL7QXbeZFWF8I+Feb2yvOj
 WkVeeWHl5Uup9hOenzH9ss+b/+2+0u4nRLaztCNjNbQjQ+e3Zqw1oDXDqndnqXXaPDfd+d91AC3T
 Tn7LNAv9XqEid5Yqdbc59HuHuaSxYptL6sIrxatJY5V5NaleTiSuUDXhWpe1qVzron93NNdl/W/M
 damVK0tN4PT9S/JpISsb9l2k8rfSTZ8TPT8gKXuA7ldJasL2SWsr2z5J/+6oadIGwKRaOZG4Qs+E
 bRNMuso/NwH8cAjYNuG9o+wl59d6hXebVdcE1SvFUuiNAcD118CeHQ9eP2gROVsuvTe6jY85A79j
 1DXgRveqkJJvDStFr6Uw+vXUmz1W9G72qPnWsBL0WtJBNC9v9UUzfaPSG7jbzG8WBsAax2j7Co1j
 4R27PVg6vW614fagx6f+bnmz+axVePNZNXlbbr1mcmzePT1a+ydffhzyOfnC6amR2gVicZhwBopT
 wwe1B8SdtwROw3F68lTtAPHTUYlzkZyeOFn9QPx8LMQJWTNteq/6wPjlbVp80iev4icqD5S7JyI+
 NR+WZECTDUqU/gM3eiL/kGrPCgAAAABJRU5ErkJggg==


code:
This package was debianized by Dimitar Pashov <pashov_d@unknown> on
Thu, 14 Jul 2011 22:55:31 +0100.

It was downloaded from <url://example.com>

Upstream Author(s):

    <put author's name and email here>
    <likewise for another author>

Copyright:

    <Copyright (C) YYYY Name OfAuthor>
    <likewise for another author>

License:

    This package 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 package 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 package; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

The Debian packaging is (C) 2011, Dimitar Pashov <pashov_d@unknown> and
is licensed under the GPL, see above.

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.


code:
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

configure: configure-stamp
configure-stamp:
	dh_testdir
        #qmake PREFIX=/usr# Uncomment this line for use without Qt Creator

	touch configure-stamp

build: build-stamp

build-stamp: configure-stamp
	dh_testdir

	# Add here commands to compile the package.
	#$(MAKE) # Uncomment this line for use without Qt Creator
	#docbook-to-man debian/dama.sgml > dama.1

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	$(MAKE) clean

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/dama.
	$(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/dama install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	# dh_shlibdeps # Uncomment this line for use without Qt Creator
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure


code:
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

configure: configure-stamp
configure-stamp:
	dh_testdir
        #qmake PREFIX=/usr# Uncomment this line for use without Qt Creator

	touch configure-stamp

build: build-stamp

build-stamp: configure-stamp
	dh_testdir

	# Add here commands to compile the package.
        #$(MAKE) # Uncomment this line for use without Qt Creator
	#docbook-to-man debian/dama.sgml > dama.1

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	$(MAKE) clean

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/dama.
	$(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/dama install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	# dh_shlibdeps # Uncomment this line for use without Qt Creator
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure


code:
LIBS = -lGL -lglfw -ldl -lm
INCS = -Iexternal/glad/include -Iexternal/stb
CFLAGS = -std=c99 -O2 -march=znver1 -Wall

SRC_ROTATE = src/main_rotate.c src/file_ops.c external/glad/src/glad.c
SRC_CAMERA = src/main_camera.c src/file_ops.c external/glad/src/glad.c src/camera.c

rotate: $(SRC_ROTATE)
	$(CC) -o $@ $^ $(INCS) $(LIBS) $(CFLAGS)

camera: $(SRC_CAMERA)
	$(CC) -o $@ $^ $(INCS) $(LIBS) $(CFLAGS)

tags:
	ctags `find src -name "*.c"`

clean:
	rm -f rotate camera tags

path: Makefile

license: mit


code:
# 3d-textures-opengl
Example of textures in OpenGL in a 3D world


code:
#version 460 core
out vec4 FragColor;

in vec2 TexCoord;

// texture sampler
uniform sampler2D texture1;

void main()
{
	FragColor = texture(texture1, TexCoord);
}


code:
#version 460 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;

out vec2 TexCoord;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main()
{
	gl_Position = projection * view * model * vec4(aPos, 1.0);
	TexCoord = vec2(aTexCoord.x, aTexCoord.y);
}


code:
#include "camera.h"
#include <math.h>

static void
camera_updatevectors(struct camera *cam)
{
	vec3 front;
	// calculate the new front vector
	front[0] = cos(glm_rad(cam->yaw)) * cos(glm_rad(cam->pitch));
	front[1] = sin(glm_rad(cam->pitch));
	front[2] = sin(glm_rad(cam->yaw)) * cos(glm_rad(cam->pitch));
	glm_vec3_copy(front, cam->front);

	// also re-calculate the right and up vector
	glm_vec3_crossn(cam->front, cam->world_up, cam->right);
	glm_vec3_crossn(cam->right, cam->front, cam->up);
}

void
camera_init(vec3 position, vec3 up, struct camera *dest)
{
	glm_vec3_copy(position, dest->position);
	glm_vec3_copy(up, dest->world_up);
	dest->yaw = YAW;
	dest->pitch = PITCH;
	dest->constrain_pitch = true;
	dest->movement_speed = SPEED;
	dest->mouse_sensitivity = SENSITIVITY;
	dest->zoom = ZOOM;

	camera_updatevectors(dest);
}

void
camera_getviewmatrix(mat4 out, struct camera *cam)
{
	vec3 center;
	glm_vec3_add(cam->position, cam->front, center);
	glm_lookat(cam->position, center, cam->up, out);
}

void
camera_process_keyboard(enum camera_movement direction, float delta_time,
		struct camera *cam)
{
	float velocity = cam->movement_speed * delta_time;
	vec3 position_delta;

	switch (direction) {
	case FORWARD:
		glm_vec3_scale(cam->front, velocity, position_delta);
		glm_vec3_add(cam->position, position_delta, cam->position);
		break;
	case BACKWARD:
		glm_vec3_scale(cam->front, velocity, position_delta);
		glm_vec3_sub(cam->position, position_delta, cam->position);
		break;
	case LEFT:
		glm_vec3_scale(cam->right, velocity, position_delta);
		glm_vec3_sub(cam->position, position_delta, cam->position);
		break;
	case RIGHT:
		glm_vec3_scale(cam->right, velocity, position_delta);
		glm_vec3_add(cam->position, position_delta, cam->position);
		break;
	}
}

void
camera_process_mouse(vec2 offset, struct camera *cam)
{
	glm_vec2_scale(offset, cam->mouse_sensitivity, offset);

	cam->yaw += offset[0];
	cam->pitch += offset[1];

	if (cam->constrain_pitch) {
		if (cam->pitch > 89)
			cam->pitch = 89;
		else if (cam->pitch < -89)
			cam->pitch = -89;
	}

	camera_updatevectors(cam);
}

void
camera_process_mousescroll(short offset, struct camera *cam)
{
	cam->zoom -= offset;

	if (cam->zoom < 1)
		cam->zoom = 1;
	else if (cam->zoom > 45)
		cam->zoom = 45;
}


code:
#ifndef CAMERA_H
#define CAMERA_H

#include <cglm/cglm.h>

// default camera values
#define YAW -90.
#define PITCH 0.
#define SPEED 5.
#define SENSITIVITY .1
#define ZOOM 45

enum camera_movement {
	FORWARD,
	BACKWARD,
	LEFT,
	RIGHT
};

struct camera {
	// camera attributes
	vec3 position;
	vec3 front;
	vec3 up;
	vec3 right;
	vec3 world_up;
	// euler angles
	float yaw;
	float pitch;
	bool constrain_pitch;
	// camera options
	float movement_speed;
	float mouse_sensitivity;
	short zoom;
};

void camera_init(vec3 position, vec3 up, struct camera *dest);
void camera_getviewmatrix(mat4 out, struct camera *cam);
void camera_process_keyboard(enum camera_movement direction, float delta_time,
	struct camera *cam);
void camera_process_mouse(vec2 offset, struct camera *cam);
void camera_process_mousescroll(short offset, struct camera *cam);

#endif


code:
#include "file_ops.h"

char *
file_to_str(const char *file_path)
{
	FILE *fp;
	unsigned int length;
	char *buffer;

	fp = fopen(file_path, "rb");
	if (fp) {
		fseek(fp, 0, SEEK_END);
		length = ftell(fp);
		buffer = malloc(length + 1);
		fseek(fp, 0, SEEK_SET);
		if (fread(buffer, 1, length, fp) != length)
			exit(1);
		fclose(fp);

		buffer[length] = '\0';

		return buffer;
	} else return 0;
}


code:
#ifndef FILE_OPS_H
#define FILE_OPS_H

#include <stdio.h>
#include <stdlib.h>

char *file_to_str(const char *file_path);

inline void file_to_str_free(char *buffer) {
	free(buffer);
}

#endif


code:
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <cglm/cglm.h>

#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>

#include "data.h"
#include "file_ops.h"
#include "camera.h"

unsigned int VAO, VBO, shader_program;

short scr[2] = {800, 800};

float delta_time, last_frame = 0;

struct camera main_camera;

float lastX = 400, lastY = 400; // scr_width / 2
bool first_mouse = true, perspective_changed = true;

void
framebuffer_size_callback(GLFWwindow *window, int w, int h)
{
	glViewport(0, 0, w, h);

	perspective_changed = true;

	scr[0] = w;
	scr[1] = h;
}

void
keyboard_callback(GLFWwindow* window)
{
	if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
		glfwSetWindowShouldClose(window, true);

	if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
		camera_process_keyboard(FORWARD, delta_time,
				&main_camera);
	if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
		camera_process_keyboard(BACKWARD, delta_time,
				&main_camera);
	if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
		camera_process_keyboard(LEFT, delta_time,
				&main_camera);
	if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
		camera_process_keyboard(RIGHT, delta_time,
				&main_camera);
}

void
mouse_callback(GLFWwindow* window, double xpos, double ypos)
{
	if (first_mouse) {
		lastX = xpos;
		lastY = ypos;
		first_mouse = false;
	}

	vec2 offset = {xpos - lastX, lastY - ypos};

	lastX = xpos;
	lastY = ypos;

	camera_process_mouse(offset, &main_camera);
}

void
scroll_callback(GLFWwindow* window, double offsetX, double offsetY)
{
	perspective_changed = true;
	camera_process_mousescroll((short)offsetY, &main_camera);
}

void
set_data(void)
{
	camera_init((vec3){0, 0, 3}, (vec3){0, 1, 0}, &main_camera);

	glGenVertexArrays(1, &VAO);
	glGenBuffers(1, &VBO);

	glBindVertexArray(VAO);

	glBindBuffer(GL_ARRAY_BUFFER, VBO);
	glBufferData(GL_ARRAY_BUFFER, sizeof(triangle), triangle,
			GL_STATIC_DRAW);

	// position
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), 0);
	glEnableVertexAttribArray(0);
	// texture coord
	glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float),
			(void*)(3 * sizeof(float)));
	glEnableVertexAttribArray(1);

	unsigned int texture;
	glGenTextures(1, &texture);
	glBindTexture(GL_TEXTURE_2D, texture);
	// set the texture wrapping parameters
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	// set texture filtering parameters
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
			GL_LINEAR_MIPMAP_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

	int width, height, nr_channels;

	unsigned char *data = stbi_load("data/wall.jpg", &width, &height,
			&nr_channels, 0);

	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
		GL_UNSIGNED_BYTE, data);
	glGenerateMipmap(GL_TEXTURE_2D);

	stbi_image_free(data);

	const char *vertex_shader_source = file_to_str("shaders/vertex.glsl"),
		*fragment_shader_source = file_to_str("shaders/fragment.glsl");

	unsigned int vertex_shader, fragment_shader;

	vertex_shader = glCreateShader(GL_VERTEX_SHADER);
	glShaderSource(vertex_shader, 1, &vertex_shader_source, 0);
	glCompileShader(vertex_shader);

	fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
	glShaderSource(fragment_shader, 1, &fragment_shader_source, 0);
	glCompileShader(fragment_shader);

	file_to_str_free(vertex_shader_source);
	file_to_str_free(fragment_shader_source);

	shader_program = glCreateProgram();
	glAttachShader(shader_program, vertex_shader);
	glAttachShader(shader_program, fragment_shader);
	glLinkProgram(shader_program);

	glDeleteShader(vertex_shader);
	glDeleteShader(fragment_shader);

	glUseProgram(shader_program);
}

int
main(void)
{
	glfwInit();
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	glfwWindowHint(GLFW_SAMPLES, 4);

	GLFWwindow* window = glfwCreateWindow(scr[0], scr[1],
			"camera", 0, 0);
	glfwMakeContextCurrent(window);

	gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);

	set_data();

	glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
	glfwSetCursorPosCallback(window, mouse_callback);
	glfwSetScrollCallback(window, scroll_callback);

	glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);

	vec3 positions[] = {
		{ 0.0,  0.0,  0.0},
		{ 2.0,  5.0, -15.0},
		{-1.5, -2.2, -2.5},
		{-3.8, -2.0, -12.3},
		{ 2.4, -0.4, -3.5},
		{-1.7,  3.0, -7.5},
		{ 1.3, -2.0, -2.5},
		{ 1.5,  2.0, -2.5},
		{ 1.5,  0.2, -1.5},
		{-1.3,  1.0, -1.5}
	};

	mat4 model, view, projection;

	int model_loc = glGetUniformLocation(shader_program, "model");
	int view_loc = glGetUniformLocation(shader_program, "view");
	int projection_loc = glGetUniformLocation(shader_program, "projection");

	glEnable(GL_DEPTH_TEST);
	glClearColor(.2, .3, .3, 1);

	float current_frame;
	while (!glfwWindowShouldClose(window)) {
		keyboard_callback(window);

		current_frame = glfwGetTime();
		delta_time = current_frame - last_frame;
		last_frame = current_frame;

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		if (perspective_changed) {
			perspective_changed = false;

			glm_perspective(glm_rad(main_camera.zoom),
				(float)scr[0]/(float)scr[1], .1, 100, projection);
			glUniformMatrix4fv(projection_loc, 1, GL_FALSE,
				(float *)projection);
		}

		camera_getviewmatrix(view, &main_camera);
		glUniformMatrix4fv(view_loc, 1, GL_FALSE,
			(float *)view);

		for (short i = 0; i < sizeof(positions)/sizeof(vec3); ++i) {
			glm_translate_make(model, positions[i]);
			glm_rotate_y(model, cos(current_frame), model);
			glm_rotate_x(model, glm_rad(20 * i), model);

			glUniformMatrix4fv(model_loc, 1, GL_FALSE,
				(float *)model);

			glDrawArrays(GL_TRIANGLES, 0, 6);
			glDrawArrays(GL_TRIANGLE_STRIP, 6, 8);
		}

		glfwSwapBuffers(window);
		glfwPollEvents();
	}

	glDeleteVertexArrays(1, &VAO);
	glDeleteBuffers(1, &VBO);
	glDeleteProgram(shader_program);

	glfwTerminate();
}