Added new Gui Design changes from Pheonom, Added new ListWidget for Page selection, via settings can switch to use List or Toolbar AddFrameListeInsteadOfToolBar_v0.6_7357.patch

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7360 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-05-10 02:38:47 +00:00
parent 31962ea0c5
commit bcff888eb7
27 changed files with 1174 additions and 493 deletions

View File

@ -47,33 +47,33 @@
#define IMAGE_AUTOSUBSCRIBE ":images/accepted16.png"
ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
: RsAutoUpdatePage(5000, parent, flags)
: RsAutoUpdatePage(5000, parent, flags)
{
setupUi(this);
ui.setupUi(this);
m_bProcessSettings = false;
m_bProcessSettings = false;
QObject::connect(NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&)));
QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites()));
QObject::connect( NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&)));
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites()));
QObject::connect(lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCustomPopupMenu(QPoint)));
QObject::connect(lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
QObject::connect(lobbyTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateCurrentLobby()));
QObject::connect( ui.lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCustomPopupMenu(QPoint)));
QObject::connect( ui.lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
QObject::connect( ui.lobbyTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateCurrentLobby()));
QObject::connect( filterLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterItems(QString)));
QObject::connect( filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int)));
QObject::connect( createlobbytoolButton, SIGNAL(clicked()), this, SLOT(createChatLobby()));
QObject::connect( ui.filterLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterItems(QString)));
QObject::connect( ui.filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int)));
QObject::connect( ui.createlobbytoolButton, SIGNAL(clicked()), this, SLOT(createChatLobby()));
compareRole = new RSTreeWidgetItemCompareRole;
compareRole->setRole(COLUMN_NAME, ROLE_SORT);
lobbyTreeWidget->setColumnCount(COLUMN_COUNT);
lobbyTreeWidget->sortItems(COLUMN_NAME, Qt::AscendingOrder);
ui.lobbyTreeWidget->setColumnCount(COLUMN_COUNT);
ui.lobbyTreeWidget->sortItems(COLUMN_NAME, Qt::AscendingOrder);
lobbyTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu) ;
ui.lobbyTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu) ;
QTreeWidgetItem *headerItem = lobbyTreeWidget->headerItem();
QTreeWidgetItem *headerItem = ui.lobbyTreeWidget->headerItem();
headerItem->setText(COLUMN_NAME, tr("Name"));
headerItem->setText(COLUMN_USER_COUNT, tr("Count"));
headerItem->setText(COLUMN_TOPIC, tr("Topic"));
@ -81,56 +81,56 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
headerItem->setTextAlignment(COLUMN_NAME, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(COLUMN_TOPIC, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(COLUMN_USER_COUNT, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(COLUMN_SUBSCRIBED, Qt::AlignHCenter | Qt::AlignVCenter);
headerItem->setTextAlignment(COLUMN_SUBSCRIBED, Qt::AlignHCenter | Qt::AlignVCenter);
QHeaderView *header = lobbyTreeWidget->header();
QHeaderView *header = ui.lobbyTreeWidget->header();
QHeaderView_setSectionResizeMode(header, COLUMN_NAME, QHeaderView::Interactive);
QHeaderView_setSectionResizeMode(header, COLUMN_USER_COUNT, QHeaderView::Interactive);
QHeaderView_setSectionResizeMode(header, COLUMN_TOPIC, QHeaderView::Interactive);
QHeaderView_setSectionResizeMode(header, COLUMN_TOPIC, QHeaderView::Interactive);
QHeaderView_setSectionResizeMode(header, COLUMN_SUBSCRIBED, QHeaderView::Interactive);
privateSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
privateSubLobbyItem->setText(COLUMN_NAME, tr("Private Subscribed Lobbies"));
privateSubLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "1");
// privateLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE));
privateSubLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE);
lobbyTreeWidget->insertTopLevelItem(0, privateSubLobbyItem);
privateSubLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "1");
// privateLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE));
privateSubLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE);
ui.lobbyTreeWidget->insertTopLevelItem(0, privateSubLobbyItem);
publicSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed Lobbies"));
publicSubLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "2");
// publicLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC));
publicSubLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC);
lobbyTreeWidget->insertTopLevelItem(1, publicSubLobbyItem);
publicSubLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
publicSubLobbyItem->setText(COLUMN_NAME, tr("Public Subscribed Lobbies"));
publicSubLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "2");
// publicLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC));
publicSubLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC);
ui.lobbyTreeWidget->insertTopLevelItem(1, publicSubLobbyItem);
privateLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
privateLobbyItem->setText(COLUMN_NAME, tr("Private Lobbies"));
privateLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "3");
// privateLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE));
privateLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "3");
// privateLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE));
privateLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE);
lobbyTreeWidget->insertTopLevelItem(2, privateLobbyItem);
ui.lobbyTreeWidget->insertTopLevelItem(2, privateLobbyItem);
publicLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
publicLobbyItem->setText(COLUMN_NAME, tr("Public Lobbies"));
publicLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "4");
// publicLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC));
publicLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "4");
// publicLobbyItem->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC));
publicLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC);
lobbyTreeWidget->insertTopLevelItem(3, publicLobbyItem);
ui.lobbyTreeWidget->insertTopLevelItem(3, publicLobbyItem);
lobbyTreeWidget->expandAll();
lobbyTreeWidget->setColumnHidden(COLUMN_NAME,false) ;
lobbyTreeWidget->setColumnHidden(COLUMN_USER_COUNT,true) ;
lobbyTreeWidget->setColumnHidden(COLUMN_TOPIC,true) ;
lobbyTreeWidget->setColumnHidden(COLUMN_SUBSCRIBED,true) ;
lobbyTreeWidget->setSortingEnabled(true) ;
ui.lobbyTreeWidget->expandAll();
ui.lobbyTreeWidget->setColumnHidden(COLUMN_NAME,false) ;
ui.lobbyTreeWidget->setColumnHidden(COLUMN_USER_COUNT,true) ;
ui.lobbyTreeWidget->setColumnHidden(COLUMN_TOPIC,true) ;
ui.lobbyTreeWidget->setColumnHidden(COLUMN_SUBSCRIBED,true) ;
ui.lobbyTreeWidget->setSortingEnabled(true) ;
lobbyTreeWidget->adjustSize();
lobbyTreeWidget->setColumnWidth(COLUMN_NAME,100);
lobbyTreeWidget->setColumnWidth(COLUMN_USER_COUNT, 50);
lobbyTreeWidget->setColumnWidth(COLUMN_TOPIC, 50);
ui.lobbyTreeWidget->adjustSize();
ui.lobbyTreeWidget->setColumnWidth(COLUMN_NAME,100);
ui.lobbyTreeWidget->setColumnWidth(COLUMN_USER_COUNT, 50);
ui.lobbyTreeWidget->setColumnWidth(COLUMN_TOPIC, 50);
/** Setup the actions for the header context menu */
showUserCountAct= new QAction(headerItem->text(COLUMN_USER_COUNT),this);
/** Setup the actions for the header context menu */
showUserCountAct= new QAction(headerItem->text(COLUMN_USER_COUNT),this);
showUserCountAct->setCheckable(true); showUserCountAct->setToolTip(tr("Show ")+showUserCountAct->text()+tr(" Column"));
connect(showUserCountAct,SIGNAL(triggered(bool)),this,SLOT(setShowUserCountColumn(bool))) ;
showTopicAct= new QAction(headerItem->text(COLUMN_TOPIC),this);
@ -143,37 +143,37 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
// Set initial size of the splitter
QList<int> sizes;
sizes << 200 << width(); // Qt calculates the right sizes
splitter->setSizes(sizes);
ui.splitter->setSizes(sizes);
lobbyChanged();
showBlankPage(0) ;
/* add filter actions */
filterLineEdit->addFilter(QIcon(), tr("Name"), COLUMN_NAME, tr("Search Name"));
filterLineEdit->setCurrentFilter(COLUMN_NAME);
// load settings
processSettings(true);
/* add filter actions */
ui.filterLineEdit->addFilter(QIcon(), tr("Name"), COLUMN_NAME, tr("Search Name"));
ui.filterLineEdit->setCurrentFilter(COLUMN_NAME);
QString help_str = tr(
" <h1><img width=\"32\" src=\":/images/64px_help.png\">&nbsp;&nbsp;Chat Lobbies</h1> \
<p>Chat lobbies are distributed chat rooms, and work pretty much like IRC. \
They allow you to talk anonymously with tons of people without the need to make friends.</p> \
<p>A chat lobby can be public (your friends see it) or private (your friends can't see it, unless you \
invite them with <img src=\":/images/add_24x24.png\" width=12/>). Once you have been invited to a private lobby, you will be able to see it when your friends \
are using it.</p> \
<p>The list at left shows \
chat lobbies your friends are participating in. You can either \
// load settings
processSettings(true);
QString help_str = tr("\
<h1><img width=\"32\" src=\":/images/64px_help.png\">&nbsp;&nbsp;Chat Lobbies</h1> \
<p>Chat lobbies are distributed chat rooms, and work pretty much like IRC. \
They allow you to talk anonymously with tons of people without the need to make friends.</p> \
<p>A chat lobby can be public (your friends see it) or private (your friends can't see it, unless you \
invite them with <img src=\":/images/add_24x24.png\" width=12/>). \
Once you have been invited to a private lobby, you will be able to see it when your friends \
are using it.</p> \
<p>The list at left shows \
chat lobbies your friends are participating in. You can either \
<ul> \
<li>Right click to create a new chat lobby</li> \
<li>Double click a chat lobby to enter, chat, and show it to your friends</li> \
</ul> \
Note: For the chat lobbies to work properly, your computer needs be on time. So check your system clock!\
</p> \
") ;
registerHelpButton(helpButton,help_str) ;
</ul> \
Note: For the chat lobbies to work properly, your computer needs be on time. So check your system clock!\
</p> \
"
) ;
registerHelpButton(ui.helpButton,help_str) ;
}
ChatLobbyWidget::~ChatLobbyWidget()
@ -189,7 +189,7 @@ ChatLobbyWidget::~ChatLobbyWidget()
void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint)
{
std::cerr << "Creating customPopupMennu" << std::endl;
QTreeWidgetItem *item = lobbyTreeWidget->currentItem();
QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem();
QMenu contextMnu(this);
@ -211,14 +211,14 @@ void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint)
}
}
contextMnu.addSeparator();//-------------------------------------------------------------------
contextMnu.addSeparator();//-------------------------------------------------------------------
showUserCountAct->setChecked(!lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT));
showTopicAct->setChecked(!lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC));
showSubscribeAct->setChecked(!lobbyTreeWidget->isColumnHidden(COLUMN_SUBSCRIBED));
showUserCountAct->setChecked(!ui.lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT));
showTopicAct->setChecked(!ui.lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC));
showSubscribeAct->setChecked(!ui.lobbyTreeWidget->isColumnHidden(COLUMN_SUBSCRIBED));
QMenu *menu = contextMnu.addMenu(tr("Columns"));
menu->addAction(showUserCountAct);
QMenu *menu = contextMnu.addMenu(tr("Columns"));
menu->addAction(showUserCountAct);
menu->addAction(showTopicAct);
menu->addAction(showSubscribeAct);
@ -274,7 +274,7 @@ void ChatLobbyWidget::addChatPage(ChatLobbyDialog *d)
if(_lobby_infos.find(d->id()) == _lobby_infos.end())
{
stackedWidget->addWidget(d) ;
ui.stackedWidget->addWidget(d) ;
connect(d,SIGNAL(lobbyLeave(ChatLobbyId)),this,SLOT(unsubscribeChatLobby(ChatLobbyId))) ;
connect(d,SIGNAL(typingEventReceived(ChatLobbyId)),this,SLOT(updateTypingStatus(ChatLobbyId))) ;
@ -300,12 +300,12 @@ void ChatLobbyWidget::addChatPage(ChatLobbyDialog *d)
void ChatLobbyWidget::setCurrentChatPage(ChatLobbyDialog *d)
{
stackedWidget->setCurrentWidget(d) ;
ui.stackedWidget->setCurrentWidget(d) ;
if (d) {
QTreeWidgetItem *item = getTreeWidgetItem(d->id());
if (item) {
lobbyTreeWidget->setCurrentItem(item);
ui.lobbyTreeWidget->setCurrentItem(item);
}
}
}
@ -465,7 +465,7 @@ void ChatLobbyWidget::updateDisplay()
}
}
if (!icon.isNull()) {
item->setIcon(COLUMN_NAME, subscribed ? icon : icon.pixmap(lobbyTreeWidget->iconSize(), QIcon::Disabled));
item->setIcon(COLUMN_NAME, subscribed ? icon : icon.pixmap(ui.lobbyTreeWidget->iconSize(), QIcon::Disabled));
}
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
@ -474,7 +474,7 @@ void ChatLobbyWidget::updateDisplay()
{
if(_lobby_infos.find(lobby.lobby_id) == _lobby_infos.end())
{
if (item == lobbyTreeWidget->currentItem())
if (item == ui.lobbyTreeWidget->currentItem())
{
ChatDialog::chatFriend(vpid) ;
}else{
@ -483,10 +483,10 @@ void ChatLobbyWidget::updateDisplay()
}
}
updateItem(lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.total_number_of_peers, subscribed, autoSubscribe);
updateItem(ui.lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.total_number_of_peers, subscribed, autoSubscribe);
}
// time_t now = time(NULL) ;
// time_t now = time(NULL) ;
// Now add participating lobbies.
//
@ -532,12 +532,12 @@ void ChatLobbyWidget::updateDisplay()
item->setIcon(COLUMN_NAME, icon);
}
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
updateItem(lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.nick_names.size(), true, autoSubscribe);
updateItem(ui.lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.nick_names.size(), true, autoSubscribe);
}
publicSubLobbyItem->setHidden(publicSubLobbyItem->childCount()==0);
privateSubLobbyItem->setHidden(privateSubLobbyItem->childCount()==0);
publicSubLobbyItem->setHidden(publicSubLobbyItem->childCount()==0);
privateSubLobbyItem->setHidden(privateSubLobbyItem->childCount()==0);
}
void ChatLobbyWidget::createChatLobby()
@ -564,7 +564,7 @@ void ChatLobbyWidget::showLobby(QTreeWidgetItem *item)
if(_lobby_infos.find(id) == _lobby_infos.end())
showBlankPage(id) ;
else
stackedWidget->setCurrentWidget(_lobby_infos[id].dialog) ;
ui.stackedWidget->setCurrentWidget(_lobby_infos[id].dialog) ;
}
static void subscribeLobby(QTreeWidgetItem *item)
@ -597,7 +597,7 @@ void ChatLobbyWidget::autoSubscribeLobby(QTreeWidgetItem *item)
void ChatLobbyWidget::showBlankPage(ChatLobbyId id)
{
// show the default blank page.
stackedWidget->setCurrentWidget(_lobby_blank_page) ;
ui.stackedWidget->setCurrentWidget(ui._lobby_blank_page) ;
// Update information
std::vector<VisibleChatLobbyRecord> lobbies;
@ -606,34 +606,34 @@ void ChatLobbyWidget::showBlankPage(ChatLobbyId id)
for(std::vector<VisibleChatLobbyRecord>::const_iterator it(lobbies.begin());it!=lobbies.end();++it)
if( (*it).lobby_id == id)
{
lobbyname_lineEdit->setText( RsHtml::plainText(it->lobby_name) );
lobbyid_lineEdit->setText( QString::number((*it).lobby_id,16) );
lobbytopic_lineEdit->setText( RsHtml::plainText(it->lobby_topic) );
lobbytype_lineEdit->setText( (( (*it).lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE)?tr("Private"):tr("Public")) );
lobbypeers_lineEdit->setText( QString::number((*it).total_number_of_peers) );
lobbyinfo_label->setText(tr("You're not subscribed to this lobby; Double click-it to enter and chat.") );
ui.lobbyname_lineEdit->setText( RsHtml::plainText(it->lobby_name) );
ui.lobbyid_lineEdit->setText( QString::number((*it).lobby_id,16) );
ui.lobbytopic_lineEdit->setText( RsHtml::plainText(it->lobby_topic) );
ui.lobbytype_lineEdit->setText( (( (*it).lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE)?tr("Private"):tr("Public")) );
ui.lobbypeers_lineEdit->setText( QString::number((*it).total_number_of_peers) );
ui.lobbyinfo_label->setText(tr("You're not subscribed to this lobby; Double click-it to enter and chat.") );
return ;
}
lobbyname_lineEdit->clear();
lobbyid_lineEdit->clear();
lobbytopic_lineEdit->clear();
lobbytype_lineEdit->clear();
lobbypeers_lineEdit->clear();
ui.lobbyname_lineEdit->clear();
ui.lobbyid_lineEdit->clear();
ui.lobbytopic_lineEdit->clear();
ui.lobbytype_lineEdit->clear();
ui.lobbypeers_lineEdit->clear();
QString text = tr("No lobby selected. \nSelect lobbies at left to show details.\nDouble click lobbies to enter and chat.") ;
lobbyinfo_label->setText(text) ;
ui.lobbyinfo_label->setText(text) ;
}
void ChatLobbyWidget::subscribeItem()
{
subscribeLobby(lobbyTreeWidget->currentItem());
subscribeLobby(ui.lobbyTreeWidget->currentItem());
}
void ChatLobbyWidget::autoSubscribeItem()
{
autoSubscribeLobby(lobbyTreeWidget->currentItem());
autoSubscribeLobby(ui.lobbyTreeWidget->currentItem());
}
QTreeWidgetItem *ChatLobbyWidget::getTreeWidgetItem(ChatLobbyId id)
@ -708,13 +708,13 @@ void ChatLobbyWidget::resetLobbyTreeIcons()
if(it->second.last_typing_event + 5 <= now)
{
getTreeWidgetItem(it->first)->setIcon(COLUMN_NAME,it->second.default_icon) ;
// std::cerr << "Reseted 1 lobby icon." << std::endl;
//std::cerr << "Reseted 1 lobby icon." << std::endl;
}
}
void ChatLobbyWidget::unsubscribeItem()
{
QTreeWidgetItem *item = lobbyTreeWidget->currentItem();
QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem();
if (item == NULL && item->type() != TYPE_LOBBY) {
return;
}
@ -734,10 +734,10 @@ void ChatLobbyWidget::unsubscribeChatLobby(ChatLobbyId id)
if(it != _lobby_infos.end())
{
stackedWidget->removeWidget(it->second.dialog) ;
ui.stackedWidget->removeWidget(it->second.dialog) ;
_lobby_infos.erase(it) ;
}
// Unsubscribe the chat lobby
RsPeerId vpeer_id;
if (rsMsgs->getVirtualPeerId(id, vpeer_id))
@ -745,25 +745,25 @@ void ChatLobbyWidget::unsubscribeChatLobby(ChatLobbyId id)
rsMsgs->unsubscribeChatLobby(id);
bool isAutoSubscribe = rsMsgs->getLobbyAutoSubscribe(id);
if (isAutoSubscribe) rsMsgs->setLobbyAutoSubscribe(id, !isAutoSubscribe);
if (isAutoSubscribe) rsMsgs->setLobbyAutoSubscribe(id, !isAutoSubscribe);
ChatLobbyDialog *cldCW=NULL ;
if (NULL != (cldCW = dynamic_cast<ChatLobbyDialog *>(stackedWidget->currentWidget())))
{
ChatLobbyDialog *cldCW=NULL ;
if (NULL != (cldCW = dynamic_cast<ChatLobbyDialog *>(ui.stackedWidget->currentWidget())))
{
QTreeWidgetItem *qtwiFound = getTreeWidgetItem(cldCW->id());
if (qtwiFound) {
lobbyTreeWidget->setCurrentItem(qtwiFound);
}
} else {
lobbyTreeWidget->clearSelection();
QTreeWidgetItem *qtwiFound = getTreeWidgetItem(cldCW->id());
if (qtwiFound) {
ui.lobbyTreeWidget->setCurrentItem(qtwiFound);
}
} else {
ui.lobbyTreeWidget->clearSelection();
}
}
}
void ChatLobbyWidget::updateCurrentLobby()
{
QList<QTreeWidgetItem *> items = lobbyTreeWidget->selectedItems() ;
QList<QTreeWidgetItem *> items = ui.lobbyTreeWidget->selectedItems() ;
if(items.empty())
showLobby(0) ;
@ -781,14 +781,14 @@ void ChatLobbyWidget::updateCurrentLobby()
item->setIcon(COLUMN_NAME, icon) ;
}
}
if (filterLineEdit->text().isEmpty() == false) {
filterItems(filterLineEdit->text());
if (ui.filterLineEdit->text().isEmpty() == false) {
filterItems(ui.filterLineEdit->text());
}
}
void ChatLobbyWidget::updateMessageChanged(ChatLobbyId id)
{
QTreeWidgetItem *current_item = lobbyTreeWidget->currentItem();
QTreeWidgetItem *current_item = ui.lobbyTreeWidget->currentItem();
// Don't show anything for current lobby.
//
@ -845,17 +845,17 @@ void ChatLobbyWidget::readChatLobbyInvites()
void ChatLobbyWidget::filterColumnChanged(int)
{
filterItems(filterLineEdit->text());
filterItems(ui.filterLineEdit->text());
}
void ChatLobbyWidget::filterItems(const QString &text)
{
int filterColumn = filterLineEdit->currentFilter();
int filterColumn = ui.filterLineEdit->currentFilter();
int count = lobbyTreeWidget->topLevelItemCount ();
for (int index = 0; index < count; index++) {
filterItem(lobbyTreeWidget->topLevelItem(index), text, filterColumn);
}
int count = ui.lobbyTreeWidget->topLevelItemCount ();
for (int index = 0; index < count; index++) {
filterItem(ui.lobbyTreeWidget->topLevelItem(index), text, filterColumn);
}
}
bool ChatLobbyWidget::filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn)
@ -888,68 +888,68 @@ bool ChatLobbyWidget::filterItem(QTreeWidgetItem *item, const QString &text, int
void ChatLobbyWidget::processSettings(bool bLoad)
{
m_bProcessSettings = true;
m_bProcessSettings = true;
QHeaderView *Header = lobbyTreeWidget->header () ;
QHeaderView *Header = ui.lobbyTreeWidget->header () ;
Settings->beginGroup(QString("ChatLobbyWidget"));
Settings->beginGroup(QString("ChatLobbyWidget"));
if (bLoad) {
// load settings
// state of the lists
Header->restoreState(Settings->value("lobbyList").toByteArray());
// state of the lists
Header->restoreState(Settings->value("lobbyList").toByteArray());
setShowUserCountColumn(Settings->value("showUserCountColumn", !lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT)).toBool());
setShowTopicColumn(Settings->value("showTopicColumn", !lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC)).toBool());
setShowSubscribeColumn(Settings->value("showSubscribeColumn", !lobbyTreeWidget->isColumnHidden(COLUMN_SUBSCRIBED)).toBool());
} else {
// save settings
setShowUserCountColumn(Settings->value("showUserCountColumn", !ui.lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT)).toBool());
setShowTopicColumn(Settings->value("showTopicColumn", !ui.lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC)).toBool());
setShowSubscribeColumn(Settings->value("showSubscribeColumn", !ui.lobbyTreeWidget->isColumnHidden(COLUMN_SUBSCRIBED)).toBool());
} else {
// save settings
// state of the lists
Settings->setValue("lobbyList", Header->saveState());
// state of the lists
Settings->setValue("lobbyList", Header->saveState());
Settings->setValue("showUserCountColumn", !lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT));
Settings->setValue("showTopicColumn", !lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC));
Settings->setValue("showSubscribeColumn", !lobbyTreeWidget->isColumnHidden(COLUMN_SUBSCRIBED));
}
Settings->setValue("showUserCountColumn", !ui.lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT));
Settings->setValue("showTopicColumn", !ui.lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC));
Settings->setValue("showSubscribeColumn", !ui.lobbyTreeWidget->isColumnHidden(COLUMN_SUBSCRIBED));
}
Settings->endGroup();
Settings->endGroup();
m_bProcessSettings = false;
}
void ChatLobbyWidget::setShowUserCountColumn(bool show)
{
if (lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT) == show) {
lobbyTreeWidget->setColumnHidden(COLUMN_USER_COUNT, !show);
}
lobbyTreeWidget->header()->setVisible(getNumColVisible()>1);
if (ui.lobbyTreeWidget->isColumnHidden(COLUMN_USER_COUNT) == show) {
ui.lobbyTreeWidget->setColumnHidden(COLUMN_USER_COUNT, !show);
}
ui.lobbyTreeWidget->header()->setVisible(getNumColVisible()>1);
}
void ChatLobbyWidget::setShowTopicColumn(bool show)
{
if (lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC) == show) {
lobbyTreeWidget->setColumnHidden(COLUMN_TOPIC, !show);
}
lobbyTreeWidget->header()->setVisible(getNumColVisible()>1);
if (ui.lobbyTreeWidget->isColumnHidden(COLUMN_TOPIC) == show) {
ui.lobbyTreeWidget->setColumnHidden(COLUMN_TOPIC, !show);
}
ui.lobbyTreeWidget->header()->setVisible(getNumColVisible()>1);
}
void ChatLobbyWidget::setShowSubscribeColumn(bool show)
{
if (lobbyTreeWidget->isColumnHidden(COLUMN_SUBSCRIBED) == show) {
lobbyTreeWidget->setColumnHidden(COLUMN_SUBSCRIBED, !show);
}
lobbyTreeWidget->header()->setVisible(getNumColVisible()>1);
if (ui.lobbyTreeWidget->isColumnHidden(COLUMN_SUBSCRIBED) == show) {
ui.lobbyTreeWidget->setColumnHidden(COLUMN_SUBSCRIBED, !show);
}
ui.lobbyTreeWidget->header()->setVisible(getNumColVisible()>1);
}
int ChatLobbyWidget::getNumColVisible()
{
int iNumColVis=0;
for (int iColumn = 0; iColumn < COLUMN_COUNT; ++iColumn) {
if (!lobbyTreeWidget->isColumnHidden(iColumn)) {
++iNumColVis;
}
}
int iNumColVis=0;
for (int iColumn = 0; iColumn < COLUMN_COUNT; ++iColumn) {
if (!ui.lobbyTreeWidget->isColumnHidden(iColumn)) {
++iNumColVis;
}
}
return iNumColVis;
}

View File

@ -5,6 +5,8 @@
#include "ui_ChatLobbyWidget.h"
#include "RsAutoUpdatePage.h"
#define IMAGE_CHATLOBBY ":/images/chat_32.png"
class RSTreeWidgetItemCompareRole;
class ChatTabWidget ;
class ChatLobbyDialog ;
@ -17,7 +19,7 @@ struct ChatLobbyInfoStruct
time_t last_typing_event ;
};
class ChatLobbyWidget : public RsAutoUpdatePage, Ui::ChatLobbyWidget
class ChatLobbyWidget : public RsAutoUpdatePage
{
Q_OBJECT
@ -28,6 +30,10 @@ public:
/** Default destructor */
~ChatLobbyWidget();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_CHATLOBBY) ; } //MainPage
virtual QString pageName() const { return tr("Chat Lobbies") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual void updateDisplay();
void setCurrentChatPage(ChatLobbyDialog *) ; // used by ChatLobbyDialog to raise.
@ -85,8 +91,11 @@ private:
/** Defines the actions for the header context menu */
QAction* showUserCountAct;
QAction* showTopicAct;
QAction* showSubscribeAct;
int getNumColVisible();
QAction* showTopicAct;
QAction* showSubscribeAct;
int getNumColVisible();
/* UI - from Designer */
Ui::ChatLobbyWidget ui;
};

View File

@ -28,6 +28,8 @@
#include "util/TokenQueue.h"
#include "ui_CirclesDialog.h"
#define IMAGE_CIRCLES ":/images/circles/circles_32.png"
class UIStateHelper;
class CirclesDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
@ -37,6 +39,10 @@ class CirclesDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
public:
CirclesDialog(QWidget *parent = 0);
virtual QIcon iconPixmap() const { return QIcon(IMAGE_CIRCLES) ; } //MainPage
virtual QString pageName() const { return tr("Circles") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
protected:

View File

@ -26,12 +26,13 @@
#include <retroshare/rstypes.h>
#include "RsAutoUpdatePage.h"
#include "ui_TransfersDialog.h"
class DLListDelegate;
class ULListDelegate;
#include "ui_TransfersDialog.h"
#define IMAGE_TRANSFERS ":/images/ktorrent32.png"
class DLListDelegate;
class ULListDelegate;
class QStandardItemModel;
class QStandardItem;
class DetailsDialog;
@ -54,12 +55,16 @@ public:
/** Default Constructor */
TransfersDialog(QWidget *parent = 0);
~TransfersDialog();
virtual UserNotify *getUserNotify(QObject *parent);
void activatePage(TransfersDialog::Page page) ;
TransfersDialog(QWidget *parent = 0);
~TransfersDialog();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_TRANSFERS) ; } //MainPage
virtual QString pageName() const { return tr("File sharing") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual UserNotify *getUserNotify(QObject *parent);
void activatePage(TransfersDialog::Page page) ;
virtual void updateDisplay() ; // derived from RsAutoUpdateWidget

View File

@ -58,8 +58,8 @@
#include "gui/Circles/CirclesDialog.h"
/* Images for Newsfeed icons */
#define IMAGE_NEWSFEED ""
#define IMAGE_NEWSFEED_NEW ":/images/message-state-new.png"
//#define IMAGE_NEWSFEED ""
//#define IMAGE_NEWSFEED_NEW ":/images/message-state-new.png"
#define IMAGE_NETWORK2 ":/images/logo/logo_16.png"
#define IMAGE_PEERS ":/images/groupchat.png"
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"

View File

@ -27,6 +27,8 @@
#include "ui_FriendsDialog.h"
#define IMAGE_PEERS ":/images/groupchat.png"
class QFont;
class QAction;
class QTextEdit;
@ -57,6 +59,10 @@ public:
/** Default Destructor */
~FriendsDialog ();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_PEERS) ; } //MainPage
virtual QString pageName() const { return tr("Network") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual UserNotify *getUserNotify(QObject *parent);
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage

View File

@ -28,6 +28,7 @@
#include <QTimer>
#define IMG_HELP ":/images/help24.png"
class GetStartedDialog : public MainPage
{
@ -39,6 +40,10 @@ public:
/** Default Destructor */
~GetStartedDialog();
virtual QIcon iconPixmap() const { return QIcon(IMG_HELP) ; } //MainPage
virtual QString pageName() const { return tr("Getting Started") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
// Single Point for (English) Text of the Invitation.
// This is used by other classes.
static QString GetInviteText();

View File

@ -34,6 +34,8 @@
#include "gui/Identity/IdEditDialog.h"
#include "util/TokenQueue.h"
#define IMAGE_IDDIALOG ":/images/identity/identities_32.png"
class UIStateHelper;
class IdDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
@ -43,6 +45,10 @@ class IdDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
public:
IdDialog(QWidget *parent = 0);
virtual QIcon iconPixmap() const { return QIcon(IMAGE_IDDIALOG) ; } //MainPage
virtual QString pageName() const { return tr("Itentities") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
protected:

View File

@ -1,9 +1,12 @@
#include <retroshare-gui/mainpage.h>
#include "common/FloatingHelpBrowser.h"
MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, flags)
MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, flags)
{
mHelpBrowser = NULL ;
mIcon = QIcon();
mName = "";
mHelp = "";
}
void MainPage::registerHelpButton(QAbstractButton *button,const QString& help_html_txt)

View File

@ -95,12 +95,15 @@
#include "gui/gxsforums/GxsForumsDialog.h"
#include "gui/Identity/IdDialog.h"
#include "gui/Circles/CirclesDialog.h"
#include "gui/WikiPoos/WikiDialog.h"
#include "gui/Posted/PostedDialog.h"
#include "gui/connect/ConnectFriendWizard.h"
#include "util/rsguiversion.h"
#include "settings/rsettingswin.h"
#include "settings/rsharesettings.h"
#include "common/StatusDefs.h"
#include "gui/notifyqt.h"
#include <iomanip>
#include <unistd.h>
@ -125,8 +128,8 @@
/* Images for toolbar icons */
//#define IMAGE_NETWORK2 ":/images/rs1.png"
#define IMAGE_PEERS ":/images/groupchat.png"
#define IMAGE_TRANSFERS ":/images/ktorrent32.png"
//#define IMAGE_PEERS ":/images/groupchat.png"
//#define IMAGE_TRANSFERS ":/images/ktorrent32.png"
#define IMAGE_FILES ":/images/fileshare32.png"
#define IMAGE_CHANNELS ":/images/channels.png"
#define IMAGE_FORUMS ":/images/konversation.png"
@ -135,7 +138,7 @@
#define IMAGE_RETROSHARE ":/images/logo/logo_16.png"
#define IMAGE_ABOUT ":/images/informations_24x24.png"
#define IMAGE_STATISTIC ":/images/utilities-system-monitor.png"
#define IMAGE_MESSAGES ":/images/evolution.png"
//#define IMAGE_MESSAGES ":/images/evolution.png"
#define IMAGE_BWGRAPH ":/images/ksysguard.png"
#define IMAGE_RSM32 ":/images/kdmconfig.png"
#define IMAGE_RSM16 ":/images/rsmessenger16.png"
@ -144,26 +147,26 @@
#define IMAGE_COLOR ":/images/highlight.png"
#define IMAGE_GAMES ":/images/kgames.png"
#define IMAGE_PHOTO ":/images/lphoto.png"
#define IMAGE_ADDFRIEND ":/images/add-friend24.png"
#define IMAGE_ADDFRIEND ":/images/user/add_user24.png"
#define IMAGE_ADDSHARE ":/images/directoryadd_24x24_shadow.png"
#define IMAGE_OPTIONS ":/images/settings.png"
#define IMAGE_QUIT ":/images/exit_24x24.png"
#define IMAGE_UNFINISHED ":/images/underconstruction.png"
#define IMAGE_MINIMIZE ":/images/window_nofullscreen.png"
#define IMAGE_MAXIMIZE ":/images/window_fullscreen.png"
#define IMG_HELP ":/images/help24.png"
#define IMAGE_NEWSFEED ":/images/newsfeed/news-feed-32.png"
//#define IMG_HELP ":/images/help24.png"
//#define IMAGE_NEWSFEED ":/images/newsfeed/news-feed-32.png"
#define IMAGE_PLUGINS ":/images/extension_32.png"
#define IMAGE_NOONLINE ":/images/logo/logo_24_0.png"
#define IMAGE_ONEONLINE ":/images/logo/logo_24_1.png"
#define IMAGE_TWOONLINE ":/images/logo/logo_24_2.png"
#define IMAGE_BLOGS ":/images/kblogger.png"
#define IMAGE_DHT ":/images/dht16.png"
#define IMAGE_CHATLOBBY ":/images/chat_32.png"
#define IMAGE_GXSCHANNELS ":/images/channels.png"
#define IMAGE_GXSFORUMS ":/images/konversation.png"
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
#define IMAGE_CIRCLES ":/images/circles/circles_32.png"
//#define IMAGE_CHATLOBBY ":/images/chat_32.png"
//#define IMAGE_GXSCHANNELS ":/images/channels.png"
//#define IMAGE_GXSFORUMS ":/images/konversation.png"
//#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
//#define IMAGE_CIRCLES ":/images/circles/circles_32.png"
/*static*/ MainWindow *MainWindow::_instance = NULL;
@ -209,12 +212,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(retroshareVersion()) + " - " + nameAndLocation);
/* WORK OUT IF WE"RE IN ADVANCED MODE OR NOT */
bool advancedMode = false;
std::string advsetting;
if (rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES")) {
advancedMode = true;
}
/* add url handler for RetroShare links */
QDesktopServices::setUrlHandler(RSLINK_SCHEME, this, "retroshareLinkActivated");
@ -230,125 +227,14 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
#ifdef UNFINISHED
applicationWindow = new ApplicationWindow();
applicationWindow->hide();
#endif
#endif
initStackedPage();
connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setNewPage(int)));
connect(ui->stackPages, SIGNAL(currentChanged(int)), this, SLOT(setNewPage(int)));
QList<QPair<MainPage*, QAction*> > notify;
/* Create the Main pages and actions */
QActionGroup *grp = new QActionGroup(this);
QAction *action;
ui->stackPages->add(newsFeed = new NewsFeed(ui->stackPages),
action = createPageAction(QIcon(IMAGE_NEWSFEED), tr("News feed"), grp));
notify.push_back(QPair<MainPage*, QAction*>(newsFeed, action));
ui->stackPages->add(friendsDialog = new FriendsDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_PEERS), tr("Network"), grp));
notify.push_back(QPair<MainPage*, QAction*>(friendsDialog, action));
PeopleDialog *peopleDialog = NULL;
ui->stackPages->add(peopleDialog = new PeopleDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_IDENTITY), tr("People"), grp));
notify.push_back(QPair<MainPage*, QAction*>(peopleDialog, action));
/*IdDialog *idDialog = NULL;
ui->stackPages->add(idDialog = new IdDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_IDENTITY), tr("Itentities"), grp));
notify.push_back(QPair<MainPage*, QAction*>(idDialog, action));
CirclesDialog *circlesDialog = NULL;
ui->stackPages->add(circlesDialog = new CirclesDialog(ui->stackPages), createPageAction(QIcon(IMAGE_CIRCLES ), tr("Circles"), grp));
notify.push_back(QPair<MainPage*, QAction*>(circlesDialog, action));*/
ui->stackPages->add(transfersDialog = new TransfersDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_TRANSFERS), tr("File sharing"), grp));
notify.push_back(QPair<MainPage*, QAction*>(transfersDialog, action));
ui->stackPages->add(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages),
action = createPageAction(QIcon(IMAGE_CHATLOBBY), tr("Chat Lobbies"), grp));
notify.push_back(QPair<MainPage*, QAction*>(chatLobbyDialog, action));
ui->stackPages->add(messagesDialog = new MessagesDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
notify.push_back(QPair<MainPage*, QAction*>(messagesDialog, action));
ui->stackPages->add(gxschannelDialog = new GxsChannelDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_GXSCHANNELS), tr("Channels"), grp));
notify.push_back(QPair<MainPage*, QAction*>(gxschannelDialog, action));
ui->stackPages->add(gxsforumDialog = new GxsForumsDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_GXSFORUMS), tr("Forums"), grp));
notify.push_back(QPair<MainPage*, QAction*>(gxsforumDialog, action));
#ifdef BLOGS
ui->stackPages->add(blogsFeed = new BlogsDialog(ui->stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp));
#endif
#if 0
ui->stackPages->add(forumsDialog = new ForumsDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp));
notify.push_back(QPair<MainPage*, QAction*>(forumsDialog, action));
#endif
std::cerr << "Looking for interfaces in existing plugins:" << std::endl;
for(int i = 0;i<rsPlugins->nbPlugins();++i)
{
QIcon icon ;
if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_page() != NULL)
{
if(rsPlugins->plugin(i)->qt_icon() != NULL)
icon = *rsPlugins->plugin(i)->qt_icon() ;
else
icon = QIcon(":images/extension_48.png") ;
std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl;
MainPage *pluginPage = rsPlugins->plugin(i)->qt_page();
QAction *pluginAction = createPageAction(icon, QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()), grp);
ui->stackPages->add(pluginPage, pluginAction);
notify.push_back(QPair<MainPage*, QAction*>(pluginPage, pluginAction));
}
else if(rsPlugins->plugin(i) == NULL)
std::cerr << " No plugin object !" << std::endl;
else
std::cerr << " No plugin page !" << std::endl;
}
#ifndef RS_RELEASE_VERSION
#ifdef PLUGINMGR
ui->stackPages->add(pluginsPage = new PluginsPage(ui->stackPages),
createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp));
#endif
#endif
#ifdef GETSTARTED_GUI
MainPage *getStartedPage = NULL;
if (!advancedMode)
{
ui->stackPages->add(getStartedPage = new GetStartedDialog(ui->stackPages),
createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp));
}
#endif
/* Create the toolbar */
ui->toolBar->addActions(grp->actions());
connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *)));
#ifdef UNFINISHED
ui->toolBar->addSeparator();
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), SLOT(showApplWindow()));
notify += applicationWindow->getNotify();
#endif
addAction(new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), ui->toolBar), SLOT(showSettings()));
addAction(new QAction(QIcon(IMAGE_ABOUT), tr("About"), ui->toolBar), SLOT(showabout()));
addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBar), SLOT(doQuit()));
ui->stackPages->setCurrentIndex(Settings->getLastPageInMainWindow());
//ui->stackPages->setCurrentIndex(Settings->getLastPageInMainWindow());
setNewPage(Settings->getLastPageInMainWindow());
/** StatusBar section ********/
/* initialize combobox in status bar */
@ -390,19 +276,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
/* Creates a tray icon with a context menu and adds it to the system's * notification area. */
createTrayIcon();
QList<QPair<MainPage*, QAction*> >::iterator notifyIt;
for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) {
UserNotify *userNotify = notifyIt->first->getUserNotify(this);
if (userNotify) {
userNotify->initialize(ui->toolBar, notifyIt->second);
connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine()));
userNotifyList.push_back(userNotify);
}
}
createNotifyIcons();
/* caclulate friend count */
/* calculate friend count */
updateFriends();
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateFriends()));
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateFriends()));
@ -419,6 +295,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000);
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged();
}
/** Destructor. */
@ -439,6 +318,238 @@ MainWindow::~MainWindow()
delete(ui);
}
/** Initialyse Stacked Page*/
void MainWindow::initStackedPage()
{
/* WORK OUT IF WE"RE IN ADVANCED MODE OR NOT */
bool advancedMode = false;
std::string advsetting;
if (rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES")) {
advancedMode = true;
}
QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > > notify;
/* Create the Main pages and actions */
QActionGroup *grp = new QActionGroup(this);
//QAction *action;
//ui->stackPages->add(newsFeed = new NewsFeed(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_NEWSFEED), tr("News feed"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(newsFeed, action));
addPage(newsFeed = new NewsFeed(ui->stackPages), grp, &notify);
//ui->stackPages->add(friendsDialog = new FriendsDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_PEERS), tr("Network"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(friendsDialog, action));
addPage(friendsDialog = new FriendsDialog(ui->stackPages), grp, &notify);
PeopleDialog *peopleDialog = NULL;
//ui->stackPages->add(peopleDialog = new PeopleDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_IDENTITY), tr("People"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(peopleDialog, action));
addPage(peopleDialog = new PeopleDialog(ui->stackPages), grp, &notify);
IdDialog *idDialog = NULL;
//ui->stackPages->add(idDialog = new IdDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_IDENTITY), tr("Itentities"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(idDialog, action));
addPage(idDialog = new IdDialog(ui->stackPages), grp, &notify);
CirclesDialog *circlesDialog = NULL;
//ui->stackPages->add(circlesDialog = new CirclesDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_CIRCLES ), tr("Circles"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(circlesDialog, action));
addPage(circlesDialog = new CirclesDialog(ui->stackPages), grp, &notify);
//ui->stackPages->add(transfersDialog = new TransfersDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_TRANSFERS), tr("File sharing"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(transfersDialog, action));
addPage(transfersDialog = new TransfersDialog(ui->stackPages), grp, &notify);
//ui->stackPages->add(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_CHATLOBBY), tr("Chat Lobbies"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(chatLobbyDialog, action));
addPage(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages), grp, &notify);
//ui->stackPages->add(messagesDialog = new MessagesDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(messagesDialog, action));
addPage(messagesDialog = new MessagesDialog(ui->stackPages), grp, &notify);
//ui->stackPages->add(gxschannelDialog = new GxsChannelDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_GXSCHANNELS), tr("Channels"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(gxschannelDialog, action));
addPage(gxschannelDialog = new GxsChannelDialog(ui->stackPages), grp, &notify);
//ui->stackPages->add(gxsforumDialog = new GxsForumsDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_GXSFORUMS), tr("Forums"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(gxsforumDialog, action));
addPage(gxsforumDialog = new GxsForumsDialog(ui->stackPages), grp, &notify);
//PostedDialog *postedDialog = NULL;
//addPage(postedDialog = new PostedDialog(ui->stackPages), grp, &notify);
//postedDialog->setup();
WikiDialog *wikiDialog = NULL;
addPage(wikiDialog = new WikiDialog(ui->stackPages), grp, &notify);
#ifdef BLOGS
//ui->stackPages->add(blogsFeed = new BlogsDialog(ui->stackPages),
// createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp));
//TODO: Add iconPixmap, pageName and helpText to BlogsDialog.h
addPage(blogsFeed = new BlogsDialog(ui->stackPages), grp, NULL);
#endif
#if 0
//ui->stackPages->add(forumsDialog = new ForumsDialog(ui->stackPages),
// action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp));
//notify.push_back(QPair<MainPage*, QAction*>(forumsDialog, action));
//TODO: Add iconPixmap, pageName and helpText to BlogsDialog.h
addPage(forumsDialog = new ForumsDialog(ui->stackPages), grp, &notify);
#endif
std::cerr << "Looking for interfaces in existing plugins:" << std::endl;
for(int i = 0;i<rsPlugins->nbPlugins();++i)
{
QIcon icon ;
if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_page() != NULL)
{
if(rsPlugins->plugin(i)->qt_icon() != NULL)
icon = *rsPlugins->plugin(i)->qt_icon() ;
else
icon = QIcon(":images/extension_48.png") ;
std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl;
MainPage *pluginPage = rsPlugins->plugin(i)->qt_page();
pluginPage->setIconPixmap(icon);
pluginPage->setPageName(QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()));
//QAction *pluginAction = createPageAction(icon, QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()), grp);
//ui->stackPages->add(pluginPage, pluginAction);
//notify.push_back(QPair<MainPage*, QAction*>(pluginPage, pluginAction));
addPage(pluginPage, grp, &notify);
}
else if(rsPlugins->plugin(i) == NULL)
std::cerr << " No plugin object !" << std::endl;
else
std::cerr << " No plugin page !" << std::endl;
}
#ifndef RS_RELEASE_VERSION
#ifdef PLUGINMGR
//ui->stackPages->add(pluginsPage = new PluginsPage(ui->stackPages),
// createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp));
//TODO: Add iconPixmap, pageName and helpText to PluginsPage.h
addPage(pluginsPage = new PluginsPage(ui->stackPages), grp, NULL);
#endif
#endif
#ifdef GETSTARTED_GUI
MainPage *getStartedPage = NULL;
if (!advancedMode)
{
//ui->stackPages->add(getStartedPage = new GetStartedDialog(ui->stackPages),
// createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp));
addPage(getStartedPage = new GetStartedDialog(ui->stackPages), grp, NULL);
}
#endif
/* Create the toolbar */
ui->toolBarPage->addActions(grp->actions());
connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *)));
#ifdef UNFINISHED
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), SLOT(showApplWindow()));
ui->toolBarAction->addSeparator();
notify += applicationWindow->getNotify();
#endif
addAction(new QAction(QIcon(IMAGE_ADDFRIEND), tr("Add"), ui->toolBarAction), SLOT(addFriend()));
addAction(new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), ui->toolBarAction), SLOT(showSettings()));
addAction(new QAction(QIcon(IMAGE_ABOUT), tr("About"), ui->toolBarAction), SLOT(showabout()));
addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBarAction), SLOT(doQuit()));
QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > >::iterator notifyIt;
for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) {
UserNotify *userNotify = notifyIt->first->getUserNotify(this);
if (userNotify) {
userNotify->initialize(ui->toolBarPage, notifyIt->second.first, notifyIt->second.second);
connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine()));
userNotifyList.push_back(userNotify);
}
}
}
/** Creates a new action associated with a config page. */
QAction *MainWindow::createPageAction(const QIcon &icon, const QString &text, QActionGroup *group)
{
QFont font;
QAction *action = new QAction(icon, text, group);
font = action->font();
font.setPointSize(9);
action->setCheckable(true);
action->setFont(font);
return action;
}
/** Adds the given action to the toolbar and hooks its triggered() signal to
* the specified slot (if given). */
void MainWindow::addAction(QAction *action, const char *slot)
{
QFont font;
font = action->font();
font.setPointSize(9);
action->setFont(font);
ui->toolBarAction->addAction(action);
connect(action, SIGNAL(triggered()), this, slot);
QListWidgetItem *item = new QListWidgetItem(action->icon(),action->text()) ;
item->setData(Qt::UserRole,QString(slot));
ui->listWidget->addItem(item) ;
}
/** Add the given page to the stackPage and list. */
void MainWindow::addPage(MainPage *page, QActionGroup *grp, QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > > *notify)
{
QAction *action;
ui->stackPages->add(page, action = createPageAction(page->iconPixmap(), page->pageName(), grp));
QListWidgetItem *item = new QListWidgetItem(QIcon(page->iconPixmap()),page->pageName()) ;
ui->listWidget->addItem(item) ;
if (notify)
{
QPair<QAction*, QListWidgetItem*> pair = QPair<QAction*, QListWidgetItem*>( action, item);
notify->push_back(QPair<MainPage*, QPair<QAction*, QListWidgetItem*> >(page, pair));
}
}
/** Selection page. */
void MainWindow::setNewPage(int page)
{
MainPage *pagew = dynamic_cast<MainPage*>(ui->stackPages->widget(page)) ;
if(pagew)
{
ui->stackPages->setCurrentIndex(page);
ui->listWidget->setCurrentRow(page);
} else {
QString procName = ui->listWidget->item(page)->data(Qt::UserRole).toString();
#ifdef UNFINISHED
if (procName == SLOT(showApplWindow())) showApplWindow();
#endif
if (procName == SLOT(showSettings())) showSettings();
if (procName == SLOT(showabout())) showabout();
if (procName == SLOT(doQuit())) doQuit();
ui->listWidget->setCurrentRow(ui->stackPages->currentIndex());
}
}
void MainWindow::displayDiskSpaceWarning(int loc,int size_limit_mb)
{
QString locString ;
@ -687,30 +798,6 @@ void MainWindow::postModDirectories(bool update_local)
QCoreApplication::flush();
}
/** Creates a new action associated with a config page. */
QAction *MainWindow::createPageAction(const QIcon &icon, const QString &text, QActionGroup *group)
{
QFont font;
QAction *action = new QAction(icon, text, group);
font = action->font();
font.setPointSize(9);
action->setCheckable(true);
action->setFont(font);
return action;
}
/** Adds the given action to the toolbar and hooks its triggered() signal to
* the specified slot (if given). */
void MainWindow::addAction(QAction *action, const char *slot)
{
QFont font;
font = action->font();
font.setPointSize(9);
action->setFont(font);
ui->toolBar->addAction(action);
connect(action, SIGNAL(triggered()), this, slot);
}
#ifdef WINDOWS_SYS
//void SetForegroundWindowInternal(HWND hWnd)
//{
@ -1121,7 +1208,7 @@ MainWindow::retranslateUi()
foreach (MainPage *page, ui->stackPages->pages()) {
page->retranslateUi();
}
foreach (QAction *action, ui->toolBar->actions()) {
foreach (QAction *action, ui->toolBarPage->actions()) {
action->setText(tr(qPrintable(action->data().toString()), "MainWindow"));
}
}
@ -1303,6 +1390,27 @@ void MainWindow::statusChangedComboBox(int index)
/* no object known */
setStatus(NULL, statusComboBox->itemData(index, Qt::UserRole).toInt());
}
/*new setting*/
void MainWindow::settingsChanged()
{
ui->toolBarPage->setVisible(Settings->getPageButtonLoc());
ui->toolBarAction->setVisible(Settings->getActionButtonLoc());
ui->listWidget->setVisible(!Settings->getPageButtonLoc() || !Settings->getActionButtonLoc());
for(int i = 0; i < ui->listWidget->count(); i++) {
if (ui->listWidget->item(i)->data(Qt::UserRole).toString() == "") {
ui->listWidget->item(i)->setHidden(Settings->getPageButtonLoc());
} else {
ui->listWidget->item(i)->setHidden(Settings->getActionButtonLoc());
}
}
int size = Settings->getToolButtonSize();
ui->toolBarPage->setToolButtonStyle(Settings->getToolButtonStyle());
ui->toolBarPage->setIconSize(QSize(size,size));
ui->toolBarAction->setToolButtonStyle(Settings->getToolButtonStyle());
ui->toolBarAction->setIconSize(QSize(size,size));
}
void MainWindow::externalLinkActivated(const QUrl &url)
{
static bool already_warned = false ;

View File

@ -34,6 +34,7 @@ class MainWindow;
class QComboBox;
class QLabel;
class QActionGroup;
class QListWidgetItem;
class Idle;
class PeerStatus;
class GxsChannelDialog ;
@ -168,6 +169,8 @@ public slots:
void retroshareLinkActivated(const QUrl &url);
void externalLinkActivated(const QUrl &url);
//! Go to a specific part of the control panel.
void setNewPage(int page);
protected:
/** Default Constructor */
@ -212,6 +215,7 @@ private slots:
void showSettings();
void statusChangedMenu(QAction *pAction);
void statusChangedComboBox(int index);
void settingsChanged();
/** Called when user attempts to quit via quit button*/
void doQuit();
@ -219,6 +223,8 @@ private slots:
void updateTrayCombine();
private:
void initStackedPage();
void addPage(MainPage *page, QActionGroup *grp, QList<QPair<MainPage *, QPair<QAction *, QListWidgetItem *> > > *notify);
void createTrayIcon();
void createNotifyIcons();
static MainWindow *_instance;

View File

@ -25,18 +25,101 @@
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="MainPageStack" name="stackPages" native="true"/>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>571</width>
<height>421</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="textElideMode">
<enum>Qt::ElideMiddle</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>false</bool>
</property>
<property name="resizeMode">
<enum>QListView::Fixed</enum>
</property>
<property name="layoutMode">
<enum>QListView::SinglePass</enum>
</property>
<property name="spacing">
<number>0</number>
</property>
<property name="gridSize">
<size>
<width>100</width>
<height>24</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="currentRow">
<number>-1</number>
</property>
</widget>
<widget class="MainPageStack" name="stackPages" native="true"/>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBarPage">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QToolBar" name="toolBarAction">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>

View File

@ -27,9 +27,11 @@
#include "mainpage.h"
#include "ui_MessagesDialog.h"
#define IMAGE_MESSAGES ":/images/evolution.png"
class MessageWidget;
class MessagesDialog : public MainPage
class MessagesDialog : public MainPage
{
Q_OBJECT
@ -41,6 +43,10 @@ public:
/** Default Destructor */
~MessagesDialog();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_MESSAGES) ; } //MainPage
virtual QString pageName() const { return tr("Messages") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual UserNotify *getUserNotify(QObject *parent);
// replaced by shortcut

View File

@ -27,6 +27,9 @@
#include "gui/feeds/FeedHolder.h"
#include <retroshare-gui/RsAutoUpdatePage.h>
#define IMAGE_NEWSFEED ":/images/newsfeed/news-feed-32.png"
class RsFeedItem;
class ForumNewItem;
@ -44,6 +47,10 @@ public:
/** Default Destructor */
virtual ~NewsFeed();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_NEWSFEED) ; } //MainPage
virtual QString pageName() const { return tr("News feed") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual UserNotify *getUserNotify(QObject *parent);
/* FeedHolder Functions (for FeedItem functionality) */

View File

@ -30,6 +30,8 @@
#include "ui_PeopleDialog.h"
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
class UIStateHelper;
class PeopleDialog : public RsGxsUpdateBroadcastPage, public Ui::PeopleDialog
@ -39,6 +41,10 @@ class PeopleDialog : public RsGxsUpdateBroadcastPage, public Ui::PeopleDialog
public:
PeopleDialog(QWidget *parent = 0);
virtual QIcon iconPixmap() const { return QIcon(IMAGE_IDENTITY) ; } //MainPage
virtual QString pageName() const { return tr("People") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
protected:
virtual void updateDisplay(bool complete);

View File

@ -35,6 +35,8 @@
#include "gui/gxs/GxsCommentContainer.h"
#include "gui/feeds/FeedHolder.h"
#define IMAGE_POSTED ":/images/posted_32.png"
class PostedItem;
/*********************** **** **** **** ***********************/
@ -54,6 +56,11 @@ class PostedListDialog : public RsGxsUpdateBroadcastPage, public FeedHolder, pub
public:
PostedListDialog(QWidget *parent = 0);
virtual QIcon iconPixmap() const { return QIcon(IMAGE_POSTED) ; } //MainPage
virtual QString pageName() const { return tr("Posted Links") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
// Overloaded from FeedHolder.
virtual QScrollArea *getScrollArea();

View File

@ -35,6 +35,8 @@
#include <map>
#define IMAGE_WIKI ":/images/wikibook_32.png"
class WikiAddDialog;
class WikiEditDialog;
@ -44,6 +46,11 @@ class WikiDialog : public MainPage, public TokenResponse
public:
WikiDialog(QWidget *parent = 0);
virtual QIcon iconPixmap() const { return QIcon(IMAGE_WIKI) ; } //MainPage
virtual QString pageName() const { return tr("Wiki Pages") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
void loadRequest(const TokenQueue *queue, const TokenRequest &req);

View File

@ -28,29 +28,34 @@
UserNotify::UserNotify(QObject *parent) :
QObject(parent)
{
mMainToolButton = NULL;
mMainAction = NULL;
mTrayIcon = NULL;
mNotifyIcon = NULL;
mNewCount = 0;
{
mMainToolButton = NULL;
mMainAction = NULL;
mListItem = NULL;
mTrayIcon = NULL;
mNotifyIcon = NULL;
mNewCount = 0;
mLastBlinking = false;
connect(rApp, SIGNAL(blink(bool)), this, SLOT(blink(bool)));
}
void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction)
{
mMainAction = mainAction;
if (mMainAction) {
connect(rApp, SIGNAL(blink(bool)), this, SLOT(blink(bool)));
}
void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem)
{
mMainAction = mainAction;
if (mMainAction) {
mButtonText = mMainAction->text();
if (mainToolBar) {
mMainToolButton = dynamic_cast<QToolButton*>(mainToolBar->widgetForAction(mMainAction));
}
}
}
void UserNotify::createIcons(QMenu *notifyMenu)
mMainToolButton = dynamic_cast<QToolButton*>(mainToolBar->widgetForAction(mMainAction));
}
}
mListItem = listItem;
if (mListItem && !mMainAction) {
mButtonText = mMainAction->text();
}
}
void UserNotify::createIcons(QMenu *notifyMenu)
{
#define DELETE_OBJECT(x) if (x) { delete(x); x = NULL; }
@ -91,12 +96,20 @@ void UserNotify::updateIcon()
QFont font = mMainAction->font();
font.setBold(count > 0);
mMainAction->setFont(font);
}
if (mMainToolButton) {
mMainToolButton->setStyleSheet((count > 0) ? "QToolButton { color: #E21D3A; }" : "");
mMainAction->setFont(font);
}
if (mListItem) {
mListItem->setIcon(getMainIcon(count > 0));
mListItem->setText((count > 0) ? QString("%1 (%2)").arg(mButtonText).arg(count) : mButtonText);
QFont font = mListItem->font();
font.setBold(count > 0);
mListItem->setFont(font);
}
if (mMainToolButton) {
mMainToolButton->setStyleSheet((count > 0) ? "QToolButton { color: #E21D3A; }" : "");
QFont font = mMainToolButton->font();
font.setBold(count > 0);
mMainToolButton->setFont(font);

View File

@ -21,25 +21,27 @@
#ifndef USERNOTIFY_H
#define USERNOTIFY_H
#include <QObject>
#include <QSystemTrayIcon>
class QToolBar;
class QToolButton;
class QAction;
class UserNotify : public QObject
{
#include <QObject>
#include <QSystemTrayIcon>
#include <QListWidgetItem>
class QToolBar;
class QToolButton;
class QAction;
//class QListWidgetItem;
class UserNotify : public QObject
{
Q_OBJECT
public:
UserNotify(QObject *parent = 0);
void initialize(QToolBar *mainToolBar, QAction *mainAction);
void createIcons(QMenu *notifyMenu);
virtual bool hasSetting(QString &/*name*/) { return false; }
public:
UserNotify(QObject *parent = 0);
void initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem);
void createIcons(QMenu *notifyMenu);
virtual bool hasSetting(QString &/*name*/) { return false; }
virtual bool notifyEnabled() { return false; }
virtual bool notifyCombined() { return false; }
virtual bool notifyBlink() { return false; }
@ -64,12 +66,13 @@ private:
virtual QString getNotifyMessage(bool plural);
virtual void iconClicked() {}
QToolButton *mMainToolButton;
QAction *mMainAction;
QSystemTrayIcon *mTrayIcon;
QAction *mNotifyIcon;
unsigned int mNewCount;
QToolButton *mMainToolButton;
QAction *mMainAction;
QListWidgetItem *mListItem;
QSystemTrayIcon *mTrayIcon;
QAction *mNotifyIcon;
unsigned int mNewCount;
QString mButtonText;
bool mLastBlinking;
};

View File

@ -24,6 +24,8 @@
#include "gui/gxs/GxsGroupFrameDialog.h"
#define IMAGE_GXSCHANNELS ":/images/channels.png"
class GxsChannelDialog : public GxsGroupFrameDialog
{
Q_OBJECT
@ -34,6 +36,10 @@ public:
/** Default Destructor */
~GxsChannelDialog();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_GXSCHANNELS) ; } //MainPage
virtual QString pageName() const { return tr("Channels") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
// virtual UserNotify *getUserNotify(QObject *parent);
private slots:

View File

@ -24,6 +24,8 @@
#include "gui/gxs/GxsGroupFrameDialog.h"
#define IMAGE_GXSFORUMS ":/images/konversation.png"
class GxsForumsDialog : public GxsGroupFrameDialog
{
Q_OBJECT
@ -32,6 +34,10 @@ public:
GxsForumsDialog(QWidget *parent = 0);
~GxsForumsDialog();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_GXSFORUMS) ; } //MainPage
virtual QString pageName() const { return tr("Forums") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
// virtual UserNotify *getUserNotify(QObject *parent);
private slots:

View File

@ -35,7 +35,7 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect(ui.styleSheetCombo, SIGNAL(activated(int)), this, SLOT(loadStyleSheet(int)));
connect(ui.cmboStyleSheet, SIGNAL(activated(int)), this, SLOT(loadStyleSheet(int)));
/* Populate combo boxes */
foreach (QString code, LanguageSupport::languageCodes()) {
@ -46,13 +46,13 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
}
// add empty entry representing "no style sheet"
ui.styleSheetCombo->addItem("", "");
ui.cmboStyleSheet->addItem("", "");
QMap<QString, QString> styleSheets;
Rshare::getAvailableStyleSheets(styleSheets);
foreach (QString name, styleSheets.keys()) {
ui.styleSheetCombo->addItem(name, styleSheets[name]);
ui.cmboStyleSheet->addItem(name, styleSheets[name]);
}
/* Hide platform specific features */
@ -69,7 +69,39 @@ bool AppearancePage::save(QString &errmsg)
Settings->setLanguageCode(languageCode);
Settings->setInterfaceStyle(ui.cmboStyle->currentText());
Settings->setSheetName(ui.styleSheetCombo->itemData(ui.styleSheetCombo->currentIndex()).toString());
Settings->setSheetName(ui.cmboStyleSheet->itemData(ui.cmboStyleSheet->currentIndex()).toString());
Settings->setPageButtonLoc(ui.rbtPageOnToolBar->isChecked());
Settings->setActionButtonLoc(ui.rbtActionOnToolBar->isChecked());
switch (ui.cmboTollButtonsStyle->currentIndex())
{
case 0:
Settings->setToolButtonStyle(Qt::ToolButtonIconOnly);
break;
case 1:
Settings->setToolButtonStyle(Qt::ToolButtonTextOnly);
break;
case 2:
Settings->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
break;
case 3:
default:
Settings->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
switch (ui.cmboTollButtonsSize->currentIndex())
{
case 0:
Settings->setToolButtonSize(8);
break;
case 1:
Settings->setToolButtonSize(16);
break;
case 2:
default:
Settings->setToolButtonSize(24);
break;
case 3:
Settings->setToolButtonSize(32);
}
/* Set to new style */
Rshare::setStyle(ui.cmboStyle->currentText());
@ -86,15 +118,50 @@ void AppearancePage::load()
index = ui.cmboStyle->findData(Rshare::style().toLower());
ui.cmboStyle->setCurrentIndex(index);
index = ui.styleSheetCombo->findData(Settings->getSheetName());
index = ui.cmboStyleSheet->findData(Settings->getSheetName());
if (index == -1) {
/* set standard "no style sheet" */
index = ui.styleSheetCombo->findData("");
index = ui.cmboStyleSheet->findData("");
}
ui.cmboStyleSheet->setCurrentIndex(index);
ui.rbtPageOnToolBar->setChecked(Settings->getPageButtonLoc());
ui.rbtPageOnListItem->setChecked(!Settings->getPageButtonLoc());
ui.rbtActionOnToolBar->setChecked(Settings->getActionButtonLoc());
ui.rbtActionOnListItem->setChecked(!Settings->getActionButtonLoc());
switch (Settings->getToolButtonStyle())
{
case Qt::ToolButtonIconOnly:
ui.cmboTollButtonsStyle->setCurrentIndex(0);
break;
case Qt::ToolButtonTextOnly:
ui.cmboTollButtonsStyle->setCurrentIndex(1);
break;
case Qt::ToolButtonTextBesideIcon:
ui.cmboTollButtonsStyle->setCurrentIndex(2);
break;
case Qt::ToolButtonTextUnderIcon:
default:
ui.cmboTollButtonsStyle->setCurrentIndex(3);
}
switch (Settings->getToolButtonSize())
{
case 8:
ui.cmboTollButtonsSize->setCurrentIndex(0);
break;
case 16:
ui.cmboTollButtonsSize->setCurrentIndex(1);
break;
case 24:
default:
ui.cmboTollButtonsSize->setCurrentIndex(2);
break;
case 32:
ui.cmboTollButtonsSize->setCurrentIndex(3);
}
ui.styleSheetCombo->setCurrentIndex(index);
}
void AppearancePage::loadStyleSheet(int index)
{
Rshare::loadStyleSheet(ui.styleSheetCombo->itemData(index).toString());
Rshare::loadStyleSheet(ui.cmboStyleSheet->itemData(index).toString());
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>406</width>
<height>291</height>
<width>598</width>
<height>567</height>
</rect>
</property>
<property name="contextMenuPolicy">
@ -20,6 +20,190 @@
<property name="spacing">
<number>0</number>
</property>
<item row="4" column="0">
<widget class="QGroupBox" name="grpToolBar">
<property name="minimumSize">
<size>
<width>0</width>
<height>75</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="title">
<string>Tool Bar</string>
</property>
<layout class="QGridLayout" name="gridLayout_ToolBar">
<item row="4" column="0">
<widget class="QFrame" name="frameAction">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QRadioButton" name="rbtActionOnToolBar">
<property name="text">
<string>On Tool Bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbtActionOnListItem">
<property name="text">
<string>On List Item</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="framePage">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QRadioButton" name="rbtPageOnToolBar">
<property name="text">
<string>On Tool Bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbtPageOnListItem">
<property name="text">
<string>On List Item</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelActionToolBar">
<property name="text">
<string>Where do you want to have the buttons for menu?</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelPageToolBar">
<property name="text">
<string>Where do you want to have the buttons for the page?</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelToolButtonStyle">
<property name="text">
<string>Choose the style of Tool Buttons.</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QComboBox" name="cmboTollButtonsStyle">
<item>
<property name="text">
<string>Icon Only</string>
</property>
</item>
<item>
<property name="text">
<string>Text Only</string>
</property>
</item>
<item>
<property name="text">
<string>Text Beside Icon</string>
</property>
</item>
<item>
<property name="text">
<string>Text Under Icon</string>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QComboBox" name="cmboTollButtonsSize">
<item>
<property name="text">
<string>Icon Size = 8x8</string>
</property>
</item>
<item>
<property name="text">
<string>Icon Size = 16x16</string>
</property>
</item>
<item>
<property name="text">
<string>Icon Size = 24x24</string>
</property>
</item>
<item>
<property name="text">
<string>Inon Size = 32x32</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>361</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="grpLanguage">
<property name="minimumSize">
@ -34,9 +218,9 @@
<property name="title">
<string>Language</string>
</property>
<layout class="QGridLayout" name="gridLayout_appearance">
<layout class="QGridLayout" name="gridLayout_Language">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelLanguage">
<property name="text">
<string>Changes to language will only take effect after restarting RetroShare!</string>
</property>
@ -77,6 +261,44 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="grpStyleSheet">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="title">
<string>Style Sheet</string>
</property>
<layout class="QGridLayout" name="gridLayout_StyleSheet">
<item row="0" column="0">
<widget class="QComboBox" name="cmboStyleSheet">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>215</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="grpStyle">
<property name="minimumSize">
@ -94,7 +316,7 @@
<property name="title">
<string>Style</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout_Style">
<item row="0" column="0">
<widget class="QComboBox" name="cmboStyle">
<property name="minimumSize">
@ -124,57 +346,6 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="title">
<string>Style Sheet</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QComboBox" name="styleSheetCombo">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>215</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>361</width>
<height>61</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>

View File

@ -44,6 +44,10 @@
#define SETTING_LANGUAGE "LanguageCode"
#define SETTING_STYLE "InterfaceStyle"
#define SETTING_SHEETNAME "SheetName"
#define SETTING_PAGEBUTTONLOC "PageButtonLocation"
#define SETTING_ACTIONBUTTONLOC "ActionButtonLocation"
#define SETTING_TOOLBUTTONSTYLE "ToolButtonStyle"
#define SETTING_TOOLBUTTONSIZE "ToolButtonSize"
#define SETTING_DATA_DIRECTORY "DataDirectory"
#define SETTING_BWGRAPH_FILTER "StatisticDialog/BWLineFilter"
@ -69,6 +73,12 @@
#define DEFAULT_BWGRAPH_FILTER (BWGRAPH_SEND|BWGRAPH_REC)
#define DEFAULT_BWGRAPH_ALWAYS_ON_TOP false
/* values for ToolButtonStyle */
#define SETTING_VALUE_TOOLBUTTONSTYLE_ICONONLY 1
#define SETTING_VALUE_TOOLBUTTONSTYLE_TEXTONLY 2
#define SETTING_VALUE_TOOLBUTTONSTYLE_TEXTBESIDEICON 3
#define SETTING_VALUE_TOOLBUTTONSTYLE_TEXTUNDERICON 4
// the one and only global settings object
RshareSettings *Settings = NULL;
@ -171,6 +181,102 @@ void RshareSettings::setSheetName(QString sheet)
setValue(SETTING_SHEETNAME, sheet);
}
/** Gets the page button Location.*/
bool RshareSettings::getPageButtonLoc()
{
return value(SETTING_PAGEBUTTONLOC, false).toBool();
}
/** Sets the page button Location.*/
void RshareSettings::setPageButtonLoc(bool onToolBar)
{
setValue(SETTING_PAGEBUTTONLOC, onToolBar);
}
/** Gets the action button Location.*/
bool RshareSettings::getActionButtonLoc()
{
return value(SETTING_ACTIONBUTTONLOC, true).toBool();
}
/** Sets the action button Location.*/
void RshareSettings::setActionButtonLoc(bool onToolBar)
{
setValue(SETTING_ACTIONBUTTONLOC, onToolBar);
}
/** Gets the tool button's style.*/
Qt::ToolButtonStyle RshareSettings::getToolButtonStyle()
{
int intValue=value(SETTING_TOOLBUTTONSTYLE, SETTING_VALUE_TOOLBUTTONSTYLE_TEXTUNDERICON).toInt();
switch (intValue)
{
case SETTING_VALUE_TOOLBUTTONSTYLE_ICONONLY:
return Qt::ToolButtonIconOnly;
case SETTING_VALUE_TOOLBUTTONSTYLE_TEXTONLY:
return Qt::ToolButtonTextOnly;
case SETTING_VALUE_TOOLBUTTONSTYLE_TEXTBESIDEICON:
return Qt::ToolButtonTextBesideIcon;
case SETTING_VALUE_TOOLBUTTONSTYLE_TEXTUNDERICON:
default:
return Qt::ToolButtonTextUnderIcon;
}
}
/** Sets the tool button's style.*/
void RshareSettings::setToolButtonStyle(Qt::ToolButtonStyle style)
{
switch (style)
{
case Qt::ToolButtonIconOnly:
setValue(SETTING_TOOLBUTTONSTYLE, SETTING_VALUE_TOOLBUTTONSTYLE_ICONONLY);
break;
case Qt::ToolButtonTextOnly:
setValue(SETTING_TOOLBUTTONSTYLE, SETTING_VALUE_TOOLBUTTONSTYLE_TEXTONLY);
break;
case Qt::ToolButtonTextBesideIcon:
setValue(SETTING_TOOLBUTTONSTYLE, SETTING_VALUE_TOOLBUTTONSTYLE_TEXTBESIDEICON);
break;
case Qt::ToolButtonTextUnderIcon:
default:
setValue(SETTING_TOOLBUTTONSTYLE, SETTING_VALUE_TOOLBUTTONSTYLE_TEXTUNDERICON);
}
}
/** Gets the tool button's size.*/
int RshareSettings::getToolButtonSize()
{
int intValue=value(SETTING_TOOLBUTTONSIZE, 24).toInt();
switch (intValue)
{
case 8:
return 8;
case 16:
return 16;
case 24:
default:
return 24;
case 32:
return 32;
}
}
/** Sets the tool button's size.*/
void RshareSettings::setToolButtonSize(int size)
{
switch (size)
{
case 8:
setValue(SETTING_TOOLBUTTONSIZE, 8);
break;
case 16:
setValue(SETTING_TOOLBUTTONSIZE, 16);
break;
case 24:
default:
setValue(SETTING_TOOLBUTTONSIZE, 24);
break;
case 32:
setValue(SETTING_TOOLBUTTONSIZE, 32);
}
}
static QString getKeyForLastDir(RshareSettings::enumLastDir type)
{
switch (type) {

View File

@ -111,7 +111,27 @@ public:
void setSheetName(QString sheet);
/** Gets the stylesheet */
QString getSheetName();
/** Gets the page button Location.*/
bool getPageButtonLoc();
/** Sets the page button Location.*/
void setPageButtonLoc(bool onToolBar);
/** Gets the action button Location.*/
bool getActionButtonLoc();
/** Sets the action button Location.*/
void setActionButtonLoc(bool onToolBar);
/** Gets the tool button's style.*/
Qt::ToolButtonStyle getToolButtonStyle();
/** Sets the tool button's style.*/
void setToolButtonStyle(Qt::ToolButtonStyle style);
/** Gets the tool button's size.*/
int getToolButtonSize();
/** Sets the tool button's size.*/
void setToolButtonSize(int size);
/** Returns true if RetroShare's main window should be visible when the
* application starts. */
bool getStartMinimized();

View File

@ -115,7 +115,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WindowFlags flags)
mNotify.push_back(QPair<MainPage*, QAction*>(photoShare, action));
#endif
PostedDialog *postedDialog = NULL;
/*PostedDialog *postedDialog = NULL;
ui.stackPages->add(postedDialog = new PostedDialog(ui.stackPages),
action = createPageAction(QIcon(IMAGE_POSTED), tr("Posted Links"), grp));
postedDialog->setup();
@ -124,7 +124,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WindowFlags flags)
WikiDialog *wikiDialog = NULL;
ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
action = createPageAction(QIcon(IMAGE_WIKI), tr("Wiki Pages"), grp));
mNotify.push_back(QPair<MainPage*, QAction*>(wikiDialog, action));
mNotify.push_back(QPair<MainPage*, QAction*>(wikiDialog, action));*/
#if 0
GxsForumsDialog *gxsforumsDialog = NULL;
ui.stackPages->add(gxsforumsDialog = new GxsForumsDialog(ui.stackPages),

View File

@ -25,6 +25,7 @@
#include <QWidget>
#include <QTextBrowser>
#include <QIcon>
class UserNotify;
class QAbstractButton ;
@ -32,22 +33,40 @@ class FloatingHelpBrowser;
class MainPage : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
/** Default Constructor */
MainPage(QWidget *parent = 0, Qt::WindowFlags flags = 0) ;
public:
/** Default Constructor */
MainPage(QWidget *parent = 0, Qt::WindowFlags flags = 0);
virtual void retranslateUi() {}
virtual UserNotify *getUserNotify(QObject */*parent*/) { return NULL; }
// Icon to be used to display the main page.
//
virtual QIcon iconPixmap() const { return mIcon ; }
void setIconPixmap(QIcon icon) { mIcon = icon; }
// Name of the page, to put in the leftside list and action name
//
virtual QString pageName() const { return mName ; }
void setPageName(QString name) { mName = name; }
// Text to be used to display in the help browser
//
virtual QString helpText() const { return mHelp ; }
void setHelpText(QString help) { mHelp = help; }
virtual void retranslateUi() {}
virtual UserNotify *getUserNotify(QObject */*parent*/) { return NULL; }
// Overload this to add some help info to the page. The way the info is
// shown is handled by showHelp() below;
//
void registerHelpButton(QAbstractButton *button, const QString& help_html_text) ;
//
void registerHelpButton(QAbstractButton *button, const QString& help_html_text) ;
private:
FloatingHelpBrowser *mHelpBrowser ;
private:
FloatingHelpBrowser *mHelpBrowser ;
QIcon mIcon;
QString mName;
QString mHelp;
};
#endif