← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2692: simplify adding grid rows/columns

 

------------------------------------------------------------
revno: 2692
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2011-11-30 21:54:12 +0100
message:
  simplify adding grid rows/columns
modified:
  dwt/include/dwt/widgets/Grid.h
  dwt/src/widgets/Grid.cpp
  win32/UsersFrame.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/include/dwt/widgets/Grid.h'
--- dwt/include/dwt/widgets/Grid.h	2011-11-30 19:58:51 +0000
+++ dwt/include/dwt/widgets/Grid.h	2011-11-30 20:54:12 +0000
@@ -89,12 +89,15 @@
 
 	virtual void layout();
 
+	size_t addRow();
+	size_t addColumn();
+
 	size_t addRow(const GridInfo& gp);
 	size_t addColumn(const GridInfo& gp);
 
 	/// Remove the row that contains the specified widget.
 	void removeRow(Control* w);
-	/// Remove the row that contains the specified widget.
+	/// Remove the column that contains the specified widget.
 	void removeColumn(Control* w);
 
 	void removeRow(size_t row);

=== modified file 'dwt/src/widgets/Grid.cpp'
--- dwt/src/widgets/Grid.cpp	2011-11-30 19:58:51 +0000
+++ dwt/src/widgets/Grid.cpp	2011-11-30 20:54:12 +0000
@@ -256,6 +256,14 @@
 	return &widgetInfo.back();
 }
 
+size_t Grid::addRow() {
+	return addRow(GridInfo(0, GridInfo::AUTO, GridInfo::CENTER));
+}
+
+size_t Grid::addColumn() {
+	return addColumn(GridInfo(0, GridInfo::AUTO, GridInfo::STRETCH));
+}
+
 size_t Grid::addRow(const GridInfo& gp) {
 	rows.push_back(gp);
 	return rows.size() - 1;

=== modified file 'win32/UsersFrame.cpp'
--- win32/UsersFrame.cpp	2011-11-12 19:36:12 +0000
+++ win32/UsersFrame.cpp	2011-11-30 20:54:12 +0000
@@ -365,14 +365,14 @@
 		}
 	}
 
-	userInfo->addRow(GridInfo());
+	userInfo->addRow();
 	auto generalGroup = userInfo->addChild(GroupBox::Seed(T_("General information")));
 	auto generalGrid = generalGroup->addChild(Grid::Seed(0, 2));
 
 	for(auto f = fields; !f->field.empty(); ++f) {
 		auto i = info.find(f->field);
 		if(i != info.end()) {
-			generalGrid->addRow(GridInfo());
+			generalGrid->addRow();
 			generalGrid->addChild(Label::Seed(f->name));
 			generalGrid->addChild(Label::Seed(f->convert(i->second)));
 			info.erase(i);
@@ -380,7 +380,7 @@
 	}
 
 	for(auto i = info.begin(); i != info.end(); ++i) {
-		generalGrid->addRow(GridInfo());
+		generalGrid->addRow();
 		generalGrid->addChild(Label::Seed(Text::toT(i->first)));
 		generalGrid->addChild(Label::Seed(Text::toT(i->second)));
 	}
@@ -388,27 +388,27 @@
 	auto queued = QueueManager::getInstance()->getQueued(user);
 
 	if(queued.first) {
-		userInfo->addRow(GridInfo());
+		userInfo->addRow();
 		auto queuedGroup = userInfo->addChild(GroupBox::Seed(T_("Pending downloads information")));
 		auto queuedGrid = queuedGroup->addChild(Grid::Seed(0, 2));
 
-		queuedGrid->addRow(GridInfo());
+		queuedGrid->addRow();
 		queuedGrid->addChild(Label::Seed(T_("Queued files")));
 		queuedGrid->addChild(Label::Seed(Text::toT(Util::toString(queued.first))));
 
-		queuedGrid->addRow(GridInfo());
+		queuedGrid->addRow();
 		queuedGrid->addChild(Label::Seed(T_("Queued bytes")));
 		queuedGrid->addChild(Label::Seed(Text::toT(Util::formatBytes(queued.second))));
 	}
 
 	auto files = UploadManager::getInstance()->getWaitingUserFiles(user);
 	if(!files.empty()) {
-		userInfo->addRow(GridInfo());
+		userInfo->addRow();
 		auto uploadsGroup = userInfo->addChild(GroupBox::Seed(T_("Pending uploads information")));
 		auto uploadsGrid = uploadsGroup->addChild(Grid::Seed(0, 2));
 
 		for(auto i = files.begin(); i != files.end(); ++i) {
-			uploadsGrid->addRow(GridInfo());
+			uploadsGrid->addRow();
 			uploadsGrid->addChild(Label::Seed(T_("Filename")));
 			uploadsGrid->addChild(Label::Seed(Text::toT(*i)));
 		}