diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index a5dc47977..ac4946f4e 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -246,8 +246,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow())); #endif - /* Select the first action */ - grp->actions()[0]->setChecked(true); + if (activatePage((Page) Settings->getLastPageInMainWindow()) == false) { + /* Select the first action */ + grp->actions()[0]->setChecked(true); + } /** StatusBar section ********/ /* initialize combobox in status bar */ @@ -306,6 +308,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) /** Destructor. */ MainWindow::~MainWindow() { + Settings->setLastPageInMainWindow(getActivatePage()); + delete _bandwidthGraph; delete _messengerwindowAct; delete peerstatus; @@ -600,10 +604,10 @@ void MainWindow::addAction(QAction *action, const char *slot) } /** Set focus to the given page. */ -/*static*/ void MainWindow::activatePage(Page page) +/*static*/ bool MainWindow::activatePage(Page page) { if (_instance == NULL) { - return; + return false; } MainPage *Page = NULL; @@ -648,7 +652,57 @@ void MainWindow::addAction(QAction *action, const char *slot) if (Page) { /* Set the focus to the specified page. */ _instance->ui.stackPages->setCurrentPage(Page); + return true; } + + return false; +} + +/** Get the active page. */ +/*static*/ MainWindow::Page MainWindow::getActivatePage() +{ + if (_instance == NULL) { + return Network; + } + + QWidget *page = _instance->ui.stackPages->currentWidget(); + + if (page == _instance->networkDialog) { + return Network; + } + if (page == _instance->peersDialog) { + return Friends; + } + if (page == _instance->searchDialog) { + return Search; + } + if (page == _instance->transfersDialog) { + return Transfers; + } + if (page == _instance->sharedfilesDialog) { + return SharedDirectories; + } + if (page == _instance->messagesDialog) { + return Messages; + } +#ifndef RS_RELEASE_VERSION + if (page == _instance->linksDialog) { + return Links; + } + if (page == _instance->channelFeed) { + return Channels; + } +#endif + if (page == _instance->forumsDialog) { + return Forums; + } +#ifdef BLOGS + if (page == _instance->blogsFeed) { + return Blogs; + } +#endif + + return Network; } /** get page */ diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index 56c6e3bbd..7cfe04c39 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -68,19 +68,20 @@ class MainWindow : public RWindow public: /** Main dialog pages. */ enum Page { - Network = 0, /** Network page. */ - Friends, /** Peers page. */ - Search, /** Search page. */ - Transfers, /** Transfers page. */ - SharedDirectories, /** Shared Directories page. */ - Messages, /** Messages page. */ - Channels, /** Channels page. */ - Forums, /** Forums page. */ + /* Fixed numbers for load and save the last page */ + Network = 0, /** Network page. */ + Friends = 1, /** Peers page. */ + Search = 2, /** Search page. */ + Transfers = 3, /** Transfers page. */ + SharedDirectories = 4, /** Shared Directories page. */ + Messages = 5, /** Messages page. */ + Channels = 6, /** Channels page. */ + Forums = 7, /** Forums page. */ #ifdef BLOGS - Blogs, /** Blogs page. */ + Blogs = 8, /** Blogs page. */ #endif #ifndef RS_RELEASE_VERSION - Links, /** Links page. */ + Links = 9, /** Links page. */ #endif }; @@ -94,7 +95,8 @@ public: /** Shows the MainWindow dialog with focus set to the given page. */ static void showWindow(Page page); /** Set focus to the given page. */ - static void activatePage (Page page); + static bool activatePage (Page page); + static Page getActivatePage (); /** get page */ static MainPage *getPage (Page page); diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 27284db61..2908abe4a 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -188,7 +188,7 @@ PeersDialog::PeersDialog(QWidget *parent) historyKeeper.init(QString::fromStdString(RsInit::RsProfileConfigDirectory()) + "/chatPublic.xml"); QList historyItems; - historyKeeper.getMessages(historyItems, 20); + historyKeeper.getMessages(historyItems, Settings->getPublicChatHistoryCount()); foreach(IMHistoryItem item, historyItems) { addChatMsg(item.incoming, true, item.name, item.recvTime, item.messageText); } diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index a28720da6..5b3a56a46 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -210,7 +210,7 @@ PopupChatDialog::PopupChatDialog(std::string id, const QString name, QWidget *pa rsMsgs->getPrivateChatQueueCount(false) && rsMsgs->getPrivateChatQueue(false, dialogId, offlineChat); QList historyItems; - historyKeeper.getMessages(historyItems, 20); + historyKeeper.getMessages(historyItems, Settings->getPrivateChatHistoryCount()); foreach(IMHistoryItem item, historyItems) { for(offineChatIt = offlineChat.begin(); offineChatIt != offlineChat.end(); offineChatIt++) { /* are they public? */ diff --git a/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp b/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp index aeebe0f5b..2f653f94e 100644 --- a/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp +++ b/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp @@ -132,6 +132,11 @@ bool IMHistoryKeeper::getMessages(QList &historyItems, const int historyItems.clear(); + if (messagesCount == 0) { + /* nothing to do */ + return true; + } + QListIterator hii(hitems); hii.toBack(); while (hii.hasPrevious()) { diff --git a/retroshare-gui/src/gui/settings/ChatPage.cpp b/retroshare-gui/src/gui/settings/ChatPage.cpp index aa113d745..0d0f74c68 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.cpp +++ b/retroshare-gui/src/gui/settings/ChatPage.cpp @@ -113,6 +113,9 @@ ChatPage::save(QString &errmsg) Settings->setChatSendMessageWithCtrlReturn(ui.sendMessageWithCtrlReturn->isChecked()); + Settings->setPublicChatHistoryCount(ui.groupchatspinBox->value()); + Settings->setPrivateChatHistoryCount(ui.privatchatspinBox->value()); + ChatStyleInfo info; QListWidgetItem *item = ui.publicList->currentItem(); if (item) { @@ -161,6 +164,9 @@ ChatPage::load() ui.sendMessageWithCtrlReturn->setChecked(Settings->getChatSendMessageWithCtrlReturn()); + ui.groupchatspinBox->setValue(Settings->getPublicChatHistoryCount()); + ui.privatchatspinBox->setValue(Settings->getPrivateChatHistoryCount()); + ui.labelChatFontPreview->setText(fontTempChat.rawName()); ui.labelChatFontPreview->setFont(fontTempChat); diff --git a/retroshare-gui/src/gui/settings/ChatPage.ui b/retroshare-gui/src/gui/settings/ChatPage.ui index 395cefe33..87a448d94 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.ui +++ b/retroshare-gui/src/gui/settings/ChatPage.ui @@ -648,7 +648,7 @@ - 0 = off + Load number of messages (0 = off) diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 887929b8e..9ff1af349 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -140,16 +140,6 @@ void RshareSettings::initSettings() setDefault("AddFeedsAtEnd", false); } -/** Gets/sets the currently saved chat avatar. */ -QImage RshareSettings::getChatAvatar() const -{ - return value(SETTING_CHAT_AVATAR).value(); -} -void RshareSettings::setChatAvatar(const QImage& I) -{ - setValue(SETTING_CHAT_AVATAR,I) ; -} - /** Gets the currently preferred language code for Rshare. */ QString RshareSettings::getLanguageCode() { @@ -356,6 +346,26 @@ void RshareSettings::setHistoryChatStyle(const QString &stylePath, const QString setValueToGroup("Chat", "StylePrivateVariant", styleVariant); } +int RshareSettings::getPublicChatHistoryCount() +{ + return valueFromGroup("Chat", "PublicChatHistoryCount", 0).toInt(); +} + +void RshareSettings::setPublicChatHistoryCount(int value) +{ + setValueToGroup("Chat", "PublicChatHistoryCount", value); +} + +int RshareSettings::getPrivateChatHistoryCount() +{ + return valueFromGroup("Chat", "PrivateChatHistoryCount", 20).toInt(); +} + +void RshareSettings::setPrivateChatHistoryCount(int value) +{ + setValueToGroup("Chat", "PrivateChatHistoryCount", value); +} + /** Returns true if RetroShare is set to run on system boot. */ bool RshareSettings::runRetroshareOnBoot() @@ -445,6 +455,17 @@ void RshareSettings::loadWidgetInformation(QMainWindow *widget, QToolBar *toolBa loadWidgetInformation(widget); } +/* MainWindow */ +int RshareSettings::getLastPageInMainWindow () +{ + return valueFromGroup("MainWindow", "LastPage", true).toInt(); +} + +void RshareSettings::setLastPageInMainWindow (int value) +{ + setValueToGroup("MainWindow", "LastPage", value); +} + /* Messages */ bool RshareSettings::getMsgSetToReadOnActivate () { diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h index ef728475a..1bba96202 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.h +++ b/retroshare-gui/src/gui/settings/rsharesettings.h @@ -84,12 +84,6 @@ public: /** Set whether to run RetroShare on system boot. */ void setRunRetroshareOnBoot(bool run); - /** Returns the chat avatar. Returns a null image if no avatar is saved. */ - QImage getChatAvatar() const ; - - /** set the chat avatar. Returns a null image if no avatar is saved. */ - void setChatAvatar(const QImage&) ; - /* Get the destination log file. */ QString getLogFile(); /** Set the destination log file. */ @@ -145,6 +139,13 @@ public: void getHistoryChatStyle(QString &stylePath, QString &styleVariant); void setHistoryChatStyle(const QString &stylePath, const QString &styleVariant); + /* Chat */ + int getPublicChatHistoryCount(); + void setPublicChatHistoryCount(int value); + + int getPrivateChatHistoryCount(); + void setPrivateChatHistoryCount(int value); + //! Save placement, state and size information of a window. void saveWidgetInformation(QWidget *widget); @@ -157,6 +158,10 @@ public: //! Method overload. Restore window and toolbar information. void loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar); + /* MainWindow */ + int getLastPageInMainWindow (); + void setLastPageInMainWindow (int value); + /* Messages */ bool getMsgSetToReadOnActivate (); void setMsgSetToReadOnActivate (bool bValue); diff --git a/retroshare-gui/src/lang/retroshare_de.qm b/retroshare-gui/src/lang/retroshare_de.qm index 5f67ea327..58de9b619 100644 Binary files a/retroshare-gui/src/lang/retroshare_de.qm and b/retroshare-gui/src/lang/retroshare_de.qm differ diff --git a/retroshare-gui/src/lang/retroshare_de.ts b/retroshare-gui/src/lang/retroshare_de.ts index fe732c7fd..8a73bdc79 100644 --- a/retroshare-gui/src/lang/retroshare_de.ts +++ b/retroshare-gui/src/lang/retroshare_de.ts @@ -147,7 +147,7 @@ p, li { white-space: pre-wrap; } Abbrechen - + Add Link Failure Fehle beim Hinzufügen des Links @@ -1221,7 +1221,27 @@ Verfügbar: %3 Emoticons für Gruppenchat - + + Chat History + Chat History + + + + Load number of messages (0 = off) + Lade Anzahl von Nachrichten (0 = aus) + + + + Group Chat + Gruppenchat + + + + Private Chat + Privater Chat + + + Group chat Gruppenchat @@ -1231,12 +1251,12 @@ Verfügbar: %3 Privater Chat - + General Allgemein - + Enable Group Chat History Chat Verlauf für Gruppenchat @@ -1246,12 +1266,12 @@ Verfügbar: %3 Sende Nachricht mit Strg+Enter - + Enable Private Chat History Chat Verlauf für privaten Chat - + Style Stil @@ -1282,7 +1302,7 @@ Verfügbar: %3 Verlauf - + Incoming message in history Eingehehende Nachricht aus dem Verlauf @@ -4785,7 +4805,7 @@ p, li { white-space: pre-wrap; } LinksDialog - + Share Link Anonymously Verknüpfung anonym teilen @@ -5006,7 +5026,12 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><span style=" font-weight:600;">Verknüpfungs-Wolke</span></p></body></html> - + + Add new link + + + + Combo Kombiniert