在开发过程中,开始可以直接使用trunk进行开发,每到发布一个新版本时候,就拷贝到tags里。但随着系统的复杂化,特性的增加,模块的增多,系统越来越复杂,这个时候,为了系统的稳定性考虑,就可以考虑使用branch来进行开发。每增加一个新特性,首先在branch里进行,当稳定性达到一定程度后,就可以合并到trunk。
这个是由QGIS的开发者提出来的一个策略:
Initial announcement on mailing list
Before starting, make an announcement on the developer mailing list to see if another developerm is already working on the same feature. Also contact the technical advisor of the project steering committee (PSC). If the new feature requires any changes to the QGIS architecture, a request for comment (RFC) ist needed.
Create a branch
Create a new svn branch for the development of the new feature (see UsingSubversion for the svn syntax). Now you can start developing.
Merge from trunk regularly
It is recommended to merge the changes in trunk to the branch on a regular basis. This makes it easier to merge the branch back to trunk later.
Documentation on wiki
It is also recommended to document the intended changes and the current status of the work on a wiki page.
Testing before merging back to trunk
When you are finished with the new feature and happy with the stability, make an announcement on the developer list. Before merging back, the changes will be tested by developers and users. Binary packages (especially for OsX and Windows) will be generated to also involve non-developers. In trac, a new Component will be opened to fill tickets against. Once there are no remaining issues left, the technical advisor of the PSC merges the changes into trunk.
参考:
http://wiki.qgis.org/qgiswiki/DevelopmentInBranches
Using Gtk::TreeView in my code, get confused with the mouse click event and drag event.
What I am expected is that: press the mouse, begin the drag event, release the mouse begin click event.
But I get this: press the mouse, begin the click event, then the drag event.
So there is a confusion to user: while he select a item, and then drag the item to another widget, the item unselected!
and if the selection mode is multiple selection, the confusion will get increase.
I do think this is a bug in gtkmm or gtk+, what's you option?
原文见:http://www.martinfowler.com/articles/continuousIntegration.html
这儿还有一篇中文的说明:http://bbs.scmlife.com/viewthread.php?tid=5500
我是在研究trac的plugin的时候,发现有一个plugin看不懂,不知道是干什么的,就搜索了一下。 Read the rest of this entry »
在$HOME/.thumbnails/目录下有一系列的缩略图文件,以供系统调用。
其生成规律:
md5("file:///home/....")
大小是128x96的PNG图片
不过,为了更好的cache,提高速度,这儿有讨论,拟把md5的hash拆分成目录。
http://lists.freedesktop.org/archives/xdg/2007-August/008749.html
非常奇怪的问题,在使用Gtk::IconView的时候遇到的。
假设model的数据重新刷新后,但和刷新前的数据相同,这时候IconView里的显示就会发生奇怪的现象,首先height边大,若再次刷新,则text会奇怪的显示(左对齐),而且text每行的长度很短,导致item的height被变相拉大。
Use Gtk::IconView to display some pdf's thumbnail, and without any problem. But encounter a strange problem, the iconview item's height will increase after a model's update if the model's content unchanged.
For e.g., I use a update() function to do the update thing:
refListModel->clear();
for(int i=0;i
{
Gtk::TreeModel::Row row = *(refListModel->append());
row[columns.id] = t[i].id;
row[columns.name] = t[i].name;
row[columns.click] = t[i].click;
row[columns.uri]=t[i].uri;
row[columns.pixbuf]=get_pixbuf(t[i].uri);
}
in this function, if the refListModel's content same as before refListModel->clear() function, the iconview will get this problem.
So I don't know, is this problem related with gtkmm or gtk+, and is this a bug or a feature?
其实很简单:
Gtk::Menu menuPopup;
Gtk::MenuItem testitem("test sub");
Gtk::Menu::MenuList& menulist = menuPopup.items();
menulist.push_back( Gtk::Menu_Helpers::MenuElem("_Add",sigc::mem_fun(*this, &DocView::insert_doc) ) );
menulist.push_back( Gtk::Menu_Helpers::MenuElem("_Open",sigc::mem_fun(*this, &DocView::open_doc) ) );
menulist.push_back( Gtk::Menu_Helpers::MenuElem("_Edit",sigc::mem_fun(*this, &DocView::edit_doc) ) );
menuPopup.append(testitem);
//必须用指针形式,否则无法弹出
Gtk::Menu* submenu=manage(new Gtk::Menu());
submenu.items().push_back( Gtk::Menu_Helpers::MenuElem("_Add",sigc::mem_fun(*this, &DocView::insert_doc) ) );
testitem.set_submenu(*submenu);
关键就在于要用指针,我一开始没用,怎么也没有找到问题。
其实也很简单,就是在文档中没有看到。
Easy enough:
sigc::connection c =
widget.signal_whatever().connect(sigc::mem_fun(whatever, whatever));
Then keep hold of c until you want to disconnect, and when you do, call
c.disconnect().
Works in libsigc++ 1.2 as well, with the appropriate changes:
SigC::Connection c =
widget.signal_whatever().connect(SigC::slot(whatever, whatever));
c.disconnect();
简单点说:
必须维护一个sigc::connection变量,在注销信号时必须使用原始的connection进行。
参考:
http://mail.gnome.org/archives/gtkmm-list/2004-April/msg00030.html
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/apbs03.html
如何遍历TreeStore?
gtkmm的邮件列表上有一个简单的例子,但是经过测试,发现只能遍历到第二层枝。
Gtk::TreeModel::Children child=refTreeModel->children();//只能获取到第一级分类
Gtk::TreeModel::Children::iterator iter ;
for( iter = child.begin() ; iter != child.end() ; iter++ )
{
if ((*iter)[columns.id]==t[i].parent_id)
{
row=*(refTreeModel->append(iter->children()));
break;
}
}
最终通过递归实现全部遍历,代码如下。
void CategoryView::getrow(Gtk::TreeModel::Children child,unsigned int pid, Gtk::TreeModel::Row& row)
{
Gtk::TreeModel::Children::iterator iter;
for( iter = child.begin() ; iter != child.end() ; iter++ )
{
if ((*iter)[columns.id]==pid)
{
row=*(refTreeModel->append(iter->children()));
return ;
} else getrow(iter->children(),pid,row);
if (row) return;//避免不必要的递归
}
}
如何转换string到其他类型?如何从其他类型转换到string?
代码1:toString
template <class T> std::string toString(const T& a)
{
std::ostringstream ost;
ost << a;
return ost.str();
}
代码2:fromString
template<typename T>T fromString( const std::string& s)
{
std::istringstream is(s);
T t;
is >> t;
return t;
}
使用方法:
int d = fromString<int>( s );
string str=toString(d);
参考:
http://www.thescripts.com/forum/thread62219.html
单文件比较简单,
看到这个函数的原型是这样的:
Glib::SListHandle<Glib::ustring> Gtk::FileChooser::get_filenames ( ) const
因此,就以为要使用这样的变量来进行声明:
Glib::SListHandle<Glib::ustring> filenames =dialog.get_filenames();
for(int i=0;i<filenames.size();i++)
{
//Notice that this is a std::string, not a Glib::ustring.
//std::string filename = dialog.get_filename();
std::cout << "File selected: " << filenames[i] << std::endl;
}
结果发现编译不通过,再仔细看看,Glib::SListHandle并没有重载[]操作符。
再网络上搜索后发现有人和我的问题相同:
That looks like a case where the GLib documentation was automatically
converted to glibmm documentation, but it doesn't really make sense.
SListHandle and ListHandle types are 'intermediate' types that you
shouldn't ever really need to use. They just provide handy
conversions to any of the standard containers. So, you should just be
able to use either std::list<> or std::vector<> or something like
that. So something like the following:
std::list<Glib::ustring> filenames = chooser.get_filenames();
而且,紧跟的一个邮件说明需要使用std::string来声明,就是应该这样:
std::vector<std::string> filenames=chooser.get_filenames();
恩,这样就清楚了。
参考:http://mail.gnome.org/archives/gtkmm-list/2007-May/msg00178.html