[Libreoffice-commits] .: tubes/AllLangResTarget_tubes.mk tubes/Library_tubes.mk tubes/Module_tubes.mk tubes/source tubes/uiconfig tubes/UI_tubes.mk
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Oct 13 07:33:36 PDT 2012
tubes/AllLangResTarget_tubes.mk | 19 -----
tubes/Library_tubes.mk | 1
tubes/Module_tubes.mk | 4 -
tubes/UI_tubes.mk | 16 ++++
tubes/source/contacts.cxx | 113 ++++++++++-----------------------
tubes/source/contacts.hrc | 12 ---
tubes/source/contacts.src | 66 -------------------
tubes/uiconfig/ui/contacts.ui | 135 ++++++++++++++++++++++++++++++++++++++++
8 files changed, 189 insertions(+), 177 deletions(-)
New commits:
commit e74fc93e4aba7887e6a278cc44c4bc0962471065
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Fri Oct 5 22:58:18 2012 +0200
tubes: use new .ui format for contacts dialog
it looks worse; more work needed
Change-Id: If8d15d614d49b1cea751852164b3e0edf43c52a6
diff --git a/tubes/AllLangResTarget_tubes.mk b/tubes/AllLangResTarget_tubes.mk
deleted file mode 100644
index 9cd4e1f..0000000
--- a/tubes/AllLangResTarget_tubes.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-$(eval $(call gb_AllLangResTarget_AllLangResTarget,tubes))
-
-$(eval $(call gb_AllLangResTarget_add_srs,tubes,tubes/res))
-
-$(eval $(call gb_SrsTarget_SrsTarget,tubes/res))
-
-$(eval $(call gb_SrsTarget_add_files,tubes/res,\
- tubes/source/contacts.src \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/tubes/Library_tubes.mk b/tubes/Library_tubes.mk
index 1f79aca..d262156 100644
--- a/tubes/Library_tubes.mk
+++ b/tubes/Library_tubes.mk
@@ -47,7 +47,6 @@ $(eval $(call gb_Library_use_libraries,tubes,\
svt \
svxcore \
tl \
- utl \
vcl \
$(gb_UWINAPI) \
))
diff --git a/tubes/Module_tubes.mk b/tubes/Module_tubes.mk
index 7eec798..dc0bba8 100644
--- a/tubes/Module_tubes.mk
+++ b/tubes/Module_tubes.mk
@@ -30,10 +30,10 @@ $(eval $(call gb_Module_Module,tubes))
ifeq ($(ENABLE_TELEPATHY),TRUE)
$(eval $(call gb_Module_add_targets,tubes,\
- AllLangResTarget_tubes \
+ Executable_liboapprover \
Library_tubes \
Package_inc \
- Executable_liboapprover \
+ UI_tubes \
))
$(eval $(call gb_Module_add_subsequentcheck_targets,tubes,\
diff --git a/tubes/UI_tubes.mk b/tubes/UI_tubes.mk
new file mode 100644
index 0000000..59801da
--- /dev/null
+++ b/tubes/UI_tubes.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UI_UI,tubes))
+
+$(eval $(call gb_UI_add_uifiles,tubes,\
+ tubes/uiconfig/ui/contacts \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index 3c0a332..91cce71 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -28,44 +28,26 @@
#include <sal/config.h>
-#include "contacts.hrc"
#include <svtools/filter.hxx>
-#include <svx/simptabl.hxx>
-#include <tools/resid.hxx>
#include <tubes/conference.hxx>
#include <tubes/collaboration.hxx>
#include <tubes/manager.hxx>
-#include <unotools/confignode.hxx>
-#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
-#include <vcl/unohelp.hxx>
+#include <vcl/lstbox.hxx>
-#include <map>
-#include <vector>
#include <telepathy-glib/telepathy-glib.h>
namespace {
-ResId TubesResId( sal_uInt32 nId )
-{
- static ResMgr* pResMgr = NULL;
- if (!pResMgr)
- {
- pResMgr = ResMgr::CreateResMgr( "tubes" );
- }
- return ResId( nId, *pResMgr );
-}
-
class TubeContacts : public ModelessDialog
{
- FixedLine maLabel;
- PushButton maBtnDemo;
- PushButton maBtnConnect;
- PushButton maBtnGroup;
- PushButton maBtnInvite;
- PushButton maBtnListen;
- SvxSimpleTableContainer maListContainer;
- SvxSimpleTable maList;
+ PushButton* mpBtnDemo;
+ PushButton* mpBtnBuddy;
+ PushButton* mpBtnGroup;
+ PushButton* mpBtnInvite;
+ PushButton* mpBtnListen;
+ ListBox* mpList;
Collaboration* mpCollaboration;
DECL_LINK( BtnDemoHdl, void * );
@@ -78,12 +60,11 @@ class TubeContacts : public ModelessDialog
void Invite()
{
- AccountContactPair *pAC = NULL;
- if (maList.FirstSelected())
- pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
- if (pAC)
+ if (mpList->GetSelectEntryCount())
{
- mpCollaboration->Invite( pAC->second );
+ sal_uInt16 i = mpList->GetSelectEntryPos();
+ TpContact* pContact = maACs[i].second;
+ mpCollaboration->Invite( pContact );
}
}
@@ -107,13 +88,11 @@ class TubeContacts : public ModelessDialog
void StartBuddySession()
{
- AccountContactPair *pAC = NULL;
- if (maList.FirstSelected())
- pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
- if (pAC)
+ if (mpList->GetSelectEntryCount())
{
- TpAccount* pAccount = pAC->first;
- TpContact* pContact = pAC->second;
+ sal_uInt16 i = mpList->GetSelectEntryPos();
+ TpAccount* pAccount = maACs[i].first;
+ TpContact* pContact = maACs[i].second;
SAL_INFO( "tubes", "picked " << tp_contact_get_identifier( pContact ) );
TeleConference* pConference = TeleManager::startBuddySession( pAccount, pContact );
if (!pConference)
@@ -129,12 +108,10 @@ class TubeContacts : public ModelessDialog
void StartGroupSession()
{
- AccountContactPair *pAC = NULL;
- if (maList.FirstSelected())
- pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
- if (pAC)
+ if (mpList->GetSelectEntryCount())
{
- TpAccount* pAccount = pAC->first;
+ sal_uInt16 i = mpList->GetSelectEntryPos();
+ TpAccount* pAccount = maACs[i].first;
SAL_INFO( "tubes", "picked " << tp_account_get_display_name( pAccount ) );
TeleConference* pConference = TeleManager::startGroupSession( pAccount,
rtl::OUString("liboroom"), rtl::OUString("conference.jabber.org") );
@@ -149,36 +126,20 @@ class TubeContacts : public ModelessDialog
public:
TubeContacts( Collaboration* pCollaboration ) :
- ModelessDialog( NULL, TubesResId( RID_TUBES_DLG_CONTACTS ) ),
- maLabel( this, TubesResId( FL_LABEL ) ),
- maBtnDemo( this, TubesResId( BTN_DEMO ) ),
- maBtnConnect( this, TubesResId( BTN_CONNECT ) ),
- maBtnGroup( this, TubesResId( BTN_GROUP ) ),
- maBtnInvite( this, TubesResId( BTN_INVITE ) ),
- maBtnListen( this, TubesResId( BTN_LISTEN ) ),
- maListContainer( this, TubesResId( CTL_LIST ) ),
- maList( maListContainer ),
+ ModelessDialog( NULL, "ContactsDialog", "tubes/ui/contacts.ui" ),
mpCollaboration( pCollaboration )
{
- Hide();
- maBtnDemo.SetClickHdl( LINK( this, TubeContacts, BtnDemoHdl ) );
- maBtnConnect.SetClickHdl( LINK( this, TubeContacts, BtnConnectHdl ) );
- maBtnGroup.SetClickHdl( LINK( this, TubeContacts, BtnGroupHdl ) );
- maBtnInvite.SetClickHdl( LINK( this, TubeContacts, BtnInviteHdl ) );
- maBtnListen.SetClickHdl( LINK( this, TubeContacts, BtnListenHdl ) );
-
- static long aStaticTabs[]=
- {
- 3 /* count */, 0, 20, 100, 150, 200
- };
-
- maList.SvxSimpleTable::SetTabs( aStaticTabs );
- String sHeader( '\t' );
- sHeader += String( TubesResId( STR_HEADER_ALIAS ) );
- sHeader += '\t';
- sHeader += String( TubesResId( STR_HEADER_NAME ) );
- sHeader += '\t';
- maList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT );
+ get( mpBtnListen, "listen");
+ get( mpBtnInvite, "invite");
+ get( mpBtnDemo, "demo");
+ get( mpBtnBuddy, "buddy");
+ get( mpBtnGroup, "group");
+ get( mpList, "contacts");
+ mpBtnListen->SetClickHdl( LINK( this, TubeContacts, BtnListenHdl ) );
+ mpBtnInvite->SetClickHdl( LINK( this, TubeContacts, BtnInviteHdl ) );
+ mpBtnDemo->SetClickHdl( LINK( this, TubeContacts, BtnDemoHdl ) );
+ mpBtnBuddy->SetClickHdl( LINK( this, TubeContacts, BtnConnectHdl ) );
+ mpBtnGroup->SetClickHdl( LINK( this, TubeContacts, BtnGroupHdl ) );
}
virtual ~TubeContacts()
{
@@ -193,13 +154,13 @@ public:
void Populate()
{
SAL_INFO( "tubes", "Populating contact list dialog" );
- maList.Clear();
+ mpList->Clear();
maACs.clear();
AccountContactPairV aPairs = TeleManager::getContacts();
AccountContactPairV::iterator it;
// make sure we have enough memory to not need re-allocation
- // which would invalidate pointers stored in maList entries
+ // which would invalidate pointers stored in mpList entries
maACs.reserve( aPairs.size() );
for( it = aPairs.begin(); it != aPairs.end(); ++it )
{
@@ -218,15 +179,13 @@ public:
}
}
rtl::OUStringBuffer aEntry( 128 );
- aEntry.append( sal_Unicode( '\t' ) );
+ aEntry.append( " " );
aEntry.append( fromUTF8 ( tp_contact_get_alias( it->second ) ) );
- aEntry.append( sal_Unicode( '\t' ) );
+ aEntry.append( " - " );
aEntry.append( fromUTF8 ( tp_contact_get_identifier( it->second ) ) );
- aEntry.append( sal_Unicode( '\t' ) );
- SvLBoxEntry* pEntry = maList.InsertEntry( aEntry.makeStringAndClear(), aImage, aImage );
+ mpList->InsertEntry( aEntry.makeStringAndClear(), aImage);
// FIXME: ref the TpAccount, TpContact ...
maACs.push_back( AccountContactPair( it->first, it->second ) );
- pEntry->SetUserData( &maACs.back() );
g_object_unref (it->first);
g_object_unref (it->second);
diff --git a/tubes/source/contacts.hrc b/tubes/source/contacts.hrc
deleted file mode 100644
index a9e1e0a..0000000
--- a/tubes/source/contacts.hrc
+++ /dev/null
@@ -1,12 +0,0 @@
-#define RID_TUBES_DLG_CONTACTS 1000
-
-#define FL_LABEL 1
-#define CTL_LIST 2
-#define BTN_CONNECT 3
-#define BTN_INVITE 4
-#define BTN_LISTEN 5
-#define BTN_GROUP 6
-#define BTN_DEMO 7
-
-#define STR_HEADER_ALIAS 20
-#define STR_HEADER_NAME 21
diff --git a/tubes/source/contacts.src b/tubes/source/contacts.src
deleted file mode 100644
index 08ad165..0000000
--- a/tubes/source/contacts.src
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "contacts.hrc"
-
-ModelessDialog RID_TUBES_DLG_CONTACTS
-{
- HelpId = "TUBES_HID"; // has to be something ...
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Hide = FALSE ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Size = MAP_APPFONT ( 220 , 225 ) ;
- OutputSize = TRUE ;
- Text [ en-US ] = "Contacts" ;
-
- FixedLine FL_LABEL
- {
- Pos = MAP_APPFONT ( 8 , 2 ) ;
- Size = MAP_APPFONT ( 198 , 8 ) ;
- Text [ en-US ] = "Select a contact to collaborate with" ;
- };
- PushButton BTN_DEMO
- {
- Pos = MAP_APPFONT( 8, 212 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "startDemoSession";
- };
- PushButton BTN_CONNECT
- {
- Pos = MAP_APPFONT( 70 , 200 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "startBuddySession";
- };
- PushButton BTN_GROUP
- {
- Pos = MAP_APPFONT( 70 , 212 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "startGroupSession";
- };
- PushButton BTN_INVITE
- {
- Pos = MAP_APPFONT( 130 , 200 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "Invite";
- };
- PushButton BTN_LISTEN
- {
- Pos = MAP_APPFONT( 8 , 200 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "Listen";
- };
- Control CTL_LIST
- {
- Pos = MAP_APPFONT ( 8 , 10 ) ;
- Size = MAP_APPFONT ( 200 , 190 ) ;
- Border = TRUE ;
- TabStop = TRUE ;
- };
- String STR_HEADER_ALIAS
- {
- Text [ en-US ] = "Alias" ;
- };
- String STR_HEADER_NAME
- {
- Text [ en-US ] = "Name" ;
- };
-};
diff --git a/tubes/uiconfig/ui/contacts.ui b/tubes/uiconfig/ui/contacts.ui
new file mode 100644
index 0000000..5500c0d
--- /dev/null
+++ b/tubes/uiconfig/ui/contacts.ui
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkDialog" id="ContactsDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Select a contact to collaborate with</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="listen">
+ <property name="label" translatable="yes">Listen</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="invite">
+ <property name="label" translatable="yes">Invite</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="demo">
+ <property name="label" translatable="yes">StartDemoSession</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="buddy">
+ <property name="label" translatable="yes">StartBuddySession</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="group">
+ <property name="label" translatable="yes">StartGroupSession</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTreeView" id="contacts">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">listen</action-widget>
+ <action-widget response="0">invite</action-widget>
+ <action-widget response="0">demo</action-widget>
+ <action-widget response="0">buddy</action-widget>
+ <action-widget response="0">group</action-widget>
+ </action-widgets>
+ </object>
+</interface>
More information about the Libreoffice-commits
mailing list