Archive:Projects/Skrooge (zh CN): Difference between revisions

From KDE TechBase
No edit summary
m (AnneW moved page Projects/Skrooge (zh CN) to Archive:Projects/Skrooge (zh CN) without leaving a redirect: Obsolete)
 
(No difference)

Latest revision as of 15:14, 23 June 2013


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