Archive:Projects/Skrooge (zh TW)

From KDE TechBase
Revision as of 14:07, 18 July 2012 by AnneW (talk | contribs)


Skrooge是KDE4的個人財務管理軟件,致力於簡單直觀。他允許你記錄你的開支和收入,分類以及生成報告。 了解更多...

這篇文章解釋如何編譯安裝Skrooge。

但是開始前,請考慮下使用你發行版已經編譯好的軟件包。你應該只在找不到適合你發行版的軟件包時自己動手編譯,或是你想要開發人員手頭上的最新版本。

得到源代碼

首先,你需要拿到Skrooge源代碼。這裡有2種方法。

最新版

你能下載包含了源代碼的壓縮文件,用你喜歡的解壓工具,比如Ark解壓他的內容。

開發版

與所有的KDE程序類似,源代碼存儲在KDE的Subversion system裡,在extragear/office文件夾。請參考the Subversion Tutorial for KDE。你需要一個SVN帳號以便從那獲取源代碼。

svn co svn://anonsvn.kde.org/home/kde/trunk/extragear/office/skrooge

依賴

以便能編譯和運行Skrooge,你需要一些額外的組件。

KDE4 heads頭文件

Skrooge是個KDE4程序,他依賴KDE頭文件裡很多東西。你能從你的發行版的軟件包(通常命名里包含了 KDE4+devel,KDE4+headers)裡獲取他們,或從KDE倉庫裡直接獲取

QCA

Qt Cryptographic Architecture。從你的發行版軟件包裡獲取。

libofx

處理OFX文件導入的library。從你的發行版軟件包裡獲取。

編譯&安裝

進入包含源代碼的目錄,創建一個名為“build“的目錄(分離源代碼編譯生成的文件很有用)。在源代碼所在目錄裡打開Konsole,運行如下命令(以普通用戶權限):

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix`
make

(請注意cmake命令裡的反引號,他們很重要。。。)

然後,需要有root權限:

make install

卸載

嘗試了Skrooge但是不喜歡他?聽到這個很遺憾。 。 。你能在上述的"build"目錄裡運行這個命令卸載他,需要有root權限:

make uninstall

Debugging

Trace activation

To activate traces, you need to export an environment variable in your console:

export SKGTRACE=XX

XX is the level of traces you want. It should be an integer between 0 and 20. The higher the number, the higher the quantity of information you get. 10 is good compromise.

Then, start Skrooge from this console. This will display a lot of information in your terminal, giving you hints as to what could be going wrong if you face issues.

Profiling

To activate the basic profiling mechanism included in Skrooge, you need to export an environment variable in your console:

export SKGTRACEPERFO=1 

Once Skrooge is started from this console, you can find two new commands:

  • Restart profiling (CTRL+Pause) to initialize the profiling
  • Open profiling (ALT+Pause) to open the result of the profiling

Profiling results look like this:

method , nb call , millisecondes , average , min , max , own time , average own time 
SKGMainPanel::setNewTabContent-addTab , 1 , 38.26897848 , 38.26897848 , 38.26897848 , 38.26897848 , 25.6370585 , 25.6370585
SKGObjectModelBase::refresh , 2 , 8.741794825 , 4.370897412 , 0.9698964357 , 7.771898389 , 8.147958875 , 4.073979437 
SKGMainPanel::setNewTabContent , 1 , 49.36599612 , 49.36599612 , 49.36599612 , 49.36599612 , 3.772916079 , 3.772916079 
SKGOperationBoardWidget::SKGOperationBoardWidget , 1 , 3.179117203 , 3.179117203 , 3.179117203 , 3.179117203 , 2.963078141 , 2.963078141 
SKGMainPanel::onOpenContext , 1 , 50.43999612 , 50.43999612 , 50.43999612 , 50.43999612 , 1.074000001 , 1.074000001
...

Remark: If SKGTRACE is set then you will be able to find the execution time of each methods in traces.

To profile only sql instructions, you can export an environment variable in your console:

export SKGTRACESQL=XX  

Only sql order with an execution time greater then XX ms will be displayed in console.

In the console, you will get something like:

executeSqliteOrder : SELECT t_name, t_TYPENLS, f_CURRENTAMOUNT, t_close from v_account_display WHERE (t_type='C' OR t_type='D' OR t_type='I' OR t_type='O') ORDER BY t_TYPENLS, t_name TIME='441 ms'

Interactive mode