Archive:Development/Tutorials (zh TW)

From KDE TechBase
Revision as of 14:37, 2 December 2009 by Alisha (talk | contribs)


Development/Tutorials


教學是發現 KDE 能為你做哪些事以及如何做的捷徑。下面是當前可用的 KDE 4 教學列表。關於 KDE 3 和 KDE 2 的材料可以在本頁的底部找到。

KDE 4 程式設計介紹

你是否對用 KDE 4 寫程式感興趣呢?這個教學系列的目的是讓那些對 KDE 程式設計完全沒有概念的新手能夠入門。

Hello World
初步的介紹了 KDE 4 程式設計的最基本知識
建立主視窗
本教學將向你展示應用程式最重要的部分──主視窗──的魔術。
使用 KAction
如何在選單和工具列中加入動作(action)。
儲存與載入
介紹 KIO 函式庫,為我們的應用程式增加載入和儲存的功能。
命令列參數
加入在命令列用文字編輯器打開指定檔案的功能。

基礎知識

移植你的程式
協助移植應用程式從Qt3/KDE3到Qt4/KDE4
介紹 CMake
如何把 CMake 構建系統用於 KDE 4 。
常見程式設計錯誤
各種在開發 Qt 和 KDE 應用程式時常見的錯誤,以及如何避免它們。
使用 Qt Designer 建立使用者界面
如何使用 designer 建立 UI 檔案,以及如何整合它們到 KDE 程式中。
建立函式庫來分享程式碼
如何把函式庫加到建構系統以及如何準備原始碼。
工作階段管理
讓您的程式察覺 X 工作階段(X sessions)

測試與除錯

對你的應用程式進行除錯
對你的 KDE 應用程式進行除錯時可以採用的工具、技術和技巧。
使用 QTestLib 為 Q t4 與 KDE 4 編寫 Unittest (原始出處)
Brad Hards的教學,敘述如何使用 QTestLib 框架編寫 unit tests。它是一個基於例子的教學,仍在開發中。
檢測程式碼錯誤的半自動方法
一些您可以用在 KDE 程式碼中檢測錯誤的技術

使用 KConfig 管理配置資料

介紹 KConfig
概要介紹 KConfig 的類別,以及如何使用它們在你的應用程式的程式碼中
使用 KConfig XT
如何有效使用 KConfig XT 框架的教學。
更新 KConfig 檔案
如何編寫一個更新腳本,以保證你程式的設定檔格式與使用者已有的設定檔一致的教學

服務:應用程式和外掛

介紹服務框架
KDE中的服務框架,以及它們向開發人員提供了哪些功能的概述。覆蓋了系統配置快取(SyCoCa)、源資料檔案以及索引資訊可以做哪些事情。
使用 Trader Querie 來搜尋服務
如何使用 Trader Query 語法來搜尋那些在 SyCoCa 中有索引的服務,如外掛或者 mime 類型等
使用 KService 創建和載入模塊
學習如何使用 KService,以一種方便且易於擴展方式來完成定義自定外掛類型、搜尋已安裝的外掛(包括第三方外掛)、以及載入外掛等任務。

本地化

另見本地化入口

介紹 Unicode
介紹 Unicode 以及如何在 KDE 應用程式中處理 Unicode 資料。
編寫考慮到本地化需要的應用程式
這篇教學內容涵蓋了什麼是本地化、為什麼本地化很重要和如何確定您的應用程式已經為本地化做好準備。這是一份所有應用程式開發者都必讀的說明。
避免常見的本地化陷阱
這裡有許多常見易犯的錯誤,妨礙正確地本地化應用程式。這篇教學闡述了什麼是錯誤的方式,以及如何簡單地避開這些錯誤。
建構 KDE 的本地化模塊
對那些用 KDE 主要貯藏庫開發應用程式的人來說,建構和安裝 KDE 的本地化(l10n)模塊中的語言支援是一個好主意。這樣可以讓您在其他語言測試您的應用程式並且迅速發現什麼地方出問題了。本教學教導如何做到這一點。
合併 i18n 到建構系統中
一旦您的程式已準備好進行本地化工作,下一步是確保翻譯檔案是自動建立並且是不斷更新的。本教學涵蓋了必要加入的 CMakeFiles.txt 以及您的應用程式在發佈的過程中所產生的訊息記載。
常見的 i18n 挑戰和解決方案
This tutorial covers challenges that you may eventually run into such as translating handbooks and other data that exists outside of the source code, merging and handling obsolete .po files, dealing with freezes, coding in languages other than English and creating independent releases of or moving applications between KDE modules.
訊息的語義標記
To ensure consistent presentation and more meaningful representations of messages in applications, semantic markup can be applied to messages marked for translation using the KUIT system. This tutorial describes how this system works.
自動化 i18n 程式碼檢查
Krazy 程式碼檢查器會掃描 KDE 的程式碼並回報常見的 i18n 錯誤。

文件

API 文件
This tutorial explains how to document your APIs properly.
Man Pages
編寫和生成參考手冊。

應用程式自動化及腳本

D-Bus

介紹 D-Bus
A straight-forward introduction to the core concepts in D-Bus from an application developer's perspective, this tutorial covers what D-Bus is and how it can be used by applications.
訪問 D-Bus 介面
A step-by-step guide to calling D-Bus methods and connecting to D-Bus signals using QtDBus.
Intermediate D-Bus
Tips to make use of QtDBus when faced with problematic real-world interfaces.
創建 D-Bus 介面
Learn how to expose functionality in your application by creating and using custom D-Bus interfaces. Covers generating the XML descriptions, instantiating interfaces at run time and setting up the build system with CMake.
D-Bus 自動啟動服務
Turn your application into a D-Bus autostart service with this tutorial. This D-Bus feature, also known as "D-Bus service activation", will ensure that even when your application isn't running that D-Bus calls made to it will work by relying on the D-Bus daemon itself to start your app if and when needed.
從 DCOP 移植到 D-Bus
Port your applications from DCOP to D-Bus with this handy guide.

Konqueror

創建 Konqueror 服務選單
This tutorial shows you how to create mimetype-specific actions in Konqueror's context menu (aka "servicemenus").

Kross

介紹 Kross
介紹 Kross 腳本框架。
Hello World
A first application with working kross code.
呼叫 Kross 中的函式
Simple demonstration of calling scripting functions
鏈接 Kross中的信號(Signals)和槽(Slots)
Simple demonstration of connecting object signals with script slots
Scripts as Plugins with Kross
This tutorial provides a step-by-step introduction how to integrate scripts as plugins into a KDE application.
加入腳本動作到程式選單
Simple demonstration on how to extend you application menus to execute script files.

KOffice 外掛教學

KOffice 概觀
This document shows an overview of the different KOffice plugin types and tells you what each of their purpose and strengths are. If you are new with KOffice plugins, this is the place to start.
建立 KOffice Flake 外掛
This tutorial shows you how you can build a plugin for KOffice applications to allow you embed content in ODF documents using Flake.
KWord 腳本
本教學展示如何透過 Kross 使用Python、Ruby 或 JavaScript 腳本在 KWord。
KSpread 腳本
本教學展示如何透過 Kross 使用Python、Ruby 或 JavaScript 腳本在 KSpread。
Krita 腳本
本教學展示如何透過 Kross 使用Python、Ruby 或 JavaScript 腳本在 Krita。


SuperKaramba

SuperKaramba 教學
This tutorial provides an overview of SuperKaramba, theme files and scripting with Python, Ruby and JavaScript.

外掛和KParts

撰寫 Kontact 外掛
Kontact plugins are KParts. This tutorial describes how you can write one.
使用 KParts
Learn how to load a KPart into an application window.
撰寫 Qt Designer 外掛
Add your widgets to Qt Designer and thus make them usable in UI files.

搜尋與元數據

Strigi

編寫檔案分析器
File analyzers extract data from files to display in the file dialogs and file managers. The data gathered this way is also used to search for files. KDE4 allows the use of multiple analyzers per file type. This tutorial describes how you can write new analyzers.

Nepomuk

Nepomuk 快速入門
How to use Nepomuk resources in a quick and painless way without much fuss.
RDF and Ontologies in Nepomuk
An introduction to RDF and the usage of ontologies in Nepomuk.
Data Layout in Nepomuk
An overview of which and how data is stored in Nepomuk.
用 Nepomuk 處理資源
Nepomuk is the KDE library which provides easy access to metadata in the Nepomuk system. Learn how to make your application create and read metadata using the Nepomuk system.
使用 Nepomuk 資源生成器
Nepomuk includes a resource generator which creates convenience classes for handling metadata.
進階搜尋
The real power of Nepomuk can only be exposed when performing fancy queries on the data repository. This tutorial provides an introduction to semantic and full text queries in Nepomuk.
The Nepomuk Server and the Architecture of the Nepomuk subsystem
The Nepomuk Server hosts the main Nepomuk data repository and can be accessed directly via a Soprano API.
Nepomuk 服務
The Nepomuk Server manages a set of Nepomuk services.
  • 存儲服務 The probably most important service hosts the Nepomuk data repository using Soprano.
  • Ontology Loader Makes sure installed ontologies such as RDF, RDFS, NRL, or Xesam are loaded into the storage repository.
  • 檔案監視服務 Monitors the file system for changes and updates the file resource paths and URIs in Nepomuk.
  • Strigi 服務 Controls Strigi, the file indexing tool which extracts metadata from files and stores it into the storage repository.
  • 查詢服務 Provides persistant query folders.
Nepomuk 提示和技巧
A set of tips and tricks for development with Nepomuk and Soprano. This is a must-read if you intend to use Nepomuk in your application or hack on it directly.

硬體探知(Solid)

介紹 Solid
An introduction to using the Solid hardware discovery and interaction system in KDE applications.
訪問網絡資訊
How to use the Solid system to get information about the network

Privileged Applications (PolicyKit)

介紹 PolicyKit
A straight-forward introduction to what PolicyKit is, and how it can be useful for your next application requiring super-user privileges or user authentication
Using the caller-helper model to perform actions as root
This tutorial will teach you how to get your application to perform some actions as root in a completely safe and easy manner, if the user is authorized to, by using PolicyKit and the caller-helper technique
Getting root privileges in KCM Modules
This tutorial will teach you how to create KCModules able to save settings as root

多媒體(Phonon)

Phonon
How to start with the multimedia API
How to compile and use Phonon and its GStreamer backend on Linux using Qt 4.3.x
This article gives you a quick brief of how you can use checkout, compile Phonon and its GStreamer backend on GNU/Linux with just Qt 4.3.x. Towards the end, the article also describes how a developer can make use of Phonon to create simple audio and video players. You can read the article here. You can download the editable OpenDocumentText file from here.

Plasma

See Development/Tutorials/Plasma for Plasma tutorials.

通訊(Decibel)

Getting started with Decibel
This tutorial describes how to set up Decibel.
Handling TextChannels
This tutorial introduces the basics of handling incoming TextChannels by guiding you through building a simple text chat application.

個人資訊管理(Akonadi)

在應用程式中使用 Akonadi
Displaying and modifying data provided by Akonadi
開發 Akonadi 資源
Akonadi Resources are agent programs which transport PIM data between Akonadi and a backend (files, servers, etc)
Using custom data types with Akonadi
Akonadi can handle arbitrary data as item payloads through the use of a plugin based serialization framework

Kate 和 Kwrite

KTextEditor 外掛入門
建立您第一個 KTextEditor 外掛
Developing a plugin with configuration dialog
Adding a configuration dialog to the Time & Date example
A small Editor
Create a small application using KTextEditor

列印

Hello World
介紹 KDE 列印系統
列印對話框
使用 KDE 列印對話框

kioslaves

Collaboration

Open Collaboration Services (libattica)

Introduction to Attica
In this tutorial a simple widget showing information about a Person on the server is created.

Get Hot New Stuff

Get Hot New Stuff 3
How to use KHotNewStuff3 in your application.
Introduction to Get Hot New Stuff 2
A short tutorial about how to use KHotNewStuff2 in your application. Deprecated, use version 3
  • old links for KNS1 content:
Introduction to Get Hot New Stuff
An introduction to the developer-friendly network update system that allows KDE applications to fetch new application data at runtime in a user friendly manner.
KNewStuff Secure (Original Link)
Tutorial showing how to share resources in a secured way (KDE 3.4 and later). By András Mantia <[email protected]>.

Goya

Goya 使用簡介
An introduction for the Goya subsystem usage, which allows you to easily add widgets to your itemviews and connect their signals to your code, as they were real widgets.
Goya 使用簡介(part 2)
The second part of the tutorial, with a slightly more complex example than the first part.

其他程式語言

Python

PyQt 介紹
Starting off
PyQt 範例
另一個 PyQt 介紹
PyKDE WebKit 教學
A simple web browser application in PyKDE
101 Introduction to signals and slots
A simple introduction to Qt's signal and slot architecture.
PyKDE DBus Tutorial
An introduction to DBus communication using PyKDE

Ruby

KDE Ruby Korundum 教學
A ruby version of Antonio Larrosa Jiménez's KDE tutorial by Richard Dale. See the Ruby Developers Corner for Qt tutorials and other info.
Qt4 Ruby 教學
Trolltech's fabulous introductory tutorial to Qt, translated to Ruby.
用 Ruby 創建 Plasma Widget
Tutorial that shows how to create your first Plasma Applet using the Ruby language.
Developing Qt4 Applications using Qt Designer and Ruby on Kubuntu
Tutorial that shows how to design a simple User Interface in Qt Designer and then use the resulting widget in a Qt Ruby application we build from scratch.

Shell

Shell Scripting with KDE dialogs (原文鏈接)
Tutorial by Brad Hards that describes how to use KDE dialogs in shell scripts with kdialog. It is presented as an example based tutorial.

繪圖程式設計

QPainter 效能
Hints on avoiding common mistakes leading to poor performance when using QPainter

使用 KDE 遊戲函式庫

KStandardGameAction
Using libkdegames to make your game fit the kdegames standard
Highscores
Implementing a simple highscore table into your game
主题選擇器
Using the libkdegames theme selection dialog
Palapeli Patterns
Creating a pattern for Palapeli

KGLEngine

安裝和您的第一個 KGLItem
開始您的第一個 kglengine 應用程式
item motion
how to move kglitem
collision detection
how to detect collision and interact
texture and color
apply texture and color for your items
particles and shadow effects
add some nice effects
kglpong
Now use our knowledge to make a pong

KALEngine

播放 hello word 聲音
Using KALEngine for games sound development using openAL
Play music
Using KALEngine to play music in a stream

使用 KDE PIM 函式庫

iCalendar 功能
使用 kcal 管理 iCalendar 檔案

其它教學

2D Plotting (KPlotWidget)

Using the KDE data-plotting widget
This tutorial introduces KPlotWidget, which is used for 2-D data plotting. It includes information on simple usage of the widget (including adding and modifying data sets, and customizing the plot axes and labels), and advanced customization (including extending the widget through sub-classing).

拼寫與語法檢查(Sonnet)

在 KDE 應用程式中加入拼寫或語法檢查
This tutorial introduces Sonnet and how one may use it to add language correction to your KDE application. Sonnet's auxiliary features shall be described in a separate tutorial.

像素圖快取(KPixmapCache)

使用 KDE 像素圖快取
This tutorial shows how to use KPixmapCache to cache e.g. pixmaps generated from SVGs or some data.

使用MarbleWidget (Marble)

使用 MarbleWidget
本教學說明如何在我們的專案中使用 MarbleWidget

用本地 SCM 開發 KDE

使用 Git 在 KDE 開發
本教學說明如何使用 Git 在 KDE 開發

Kwin 效果教學(blog)

blog by Martin Graesslin
This tutorial guides you through the development of a simple KWin effect

實現並加入 KSysGuard 感應器

Development/Tutorials/Sensors
This tutorial shows how to write and KSysGuard sensor and connect it to the systray.

Runners

KDE2 和 KDE3 材料

KDE3 Tutorials
These tutorials cover topics related to KDE3.
KDE2 Tutorials
These tutorials cover topics related to KDE2.