From 65e02ba4deccb318ebd06b43890782974c61d6b5 Mon Sep 17 00:00:00 2001 From: drbob Date: Fri, 8 May 2009 23:07:08 +0000 Subject: [PATCH] * Rolled back Modifications to SearchDialog and PopupChatDialog. - unable to get windows to compile with PopupChat on windows. - not happy with new SearchDialog. Not an improvement on old dialog + uses Qt4.4 * updated version numbers... * added a couple of windows scripts. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1200 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- build_scripts/Windows/make_installer.sh | 46 + build_scripts/Windows/retroshare.nsi | 35 +- build_scripts/Windows/stripSVN.sh | 12 + libretroshare/src/services/p3chatservice.cc | 2 +- retroshare-gui/src/RetroShare.pro | 9 +- retroshare-gui/src/gui/MainWindow.cpp | 1 + retroshare-gui/src/gui/SearchDialog.cpp | 40 +- retroshare-gui/src/gui/SearchDialog.h | 3 - retroshare-gui/src/gui/SearchDialog.ui | 1121 ++++++++++------- .../src/gui/chat/PopupChatDialog.cpp | 147 +-- retroshare-gui/src/gui/chat/PopupChatDialog.h | 11 +- .../src/gui/chat/PopupChatDialog.ui | 26 +- retroshare-gui/src/util/rsversion.cpp | 2 +- 13 files changed, 779 insertions(+), 676 deletions(-) create mode 100755 build_scripts/Windows/make_installer.sh create mode 100755 build_scripts/Windows/stripSVN.sh diff --git a/build_scripts/Windows/make_installer.sh b/build_scripts/Windows/make_installer.sh new file mode 100755 index 000000000..6b3b5766a --- /dev/null +++ b/build_scripts/Windows/make_installer.sh @@ -0,0 +1,46 @@ +#!/bin/sh +### +# +# +# + +QTGUI_DIR=../devel/retroshare-package-v0.4.09b/src/svn-retroshare/retroshare-gui/src +INST_DIR=../devel/retroshare-package-v0.4.09b/src/svn-retroshare/build_scripts/Windows/ +EXEC=release/Retroshare.exe + +BIN_DIR=./release +NSIS_EXE="/cygdrive/c/Program\ Files/NSIS/makensis.exe" + +cp $QTGUI_DIR/$EXEC $BIN_DIR +echo cp $QTGUI_DIR/$EXEC $BIN_DIR + +# copy skin files. +cp -r $QTGUI_DIR/qss/* $BIN_DIR/qss +echo 'cp -r $QTGUI_DIR/qss/* $BIN_DIR/qss' +# +cp -r $QTGUI_DIR/skin/* $BIN_DIR/skin +echo 'cp $QTGUI_DIR/skin/* $BIN_DIR/skin' +# +cp -r $QTGUI_DIR/emoticons/* $BIN_DIR/emoticons/ +echo cp -r $QTGUI_DIR/emoticons/* $BIN_DIR/emoticons/ + +cp -r $QTGUI_DIR/style/* $BIN_DIR/style +echo 'cp -r $QTGUI_DIR/style/* $BIN_DIR/style' + +./stripSVN.sh release +echo ./stripSVN.sh release + +cp $INST_DIR/retroshare.nsi ./ +echo cp $QTGUI_DIR/retroshare.nsi ./ + +cp $QTGUI_DIR/license/* ./license/ +echo cp $QTGUI_DIR/license/* ./license/ + +cp $QTGUI_DIR/gui/images/splash.bmp ./gui/images/ +echo cp $QTGUI_DIR/gui/images/splash.bmp ./gui/images/ + +#cp $QTGUI_DIR/release/changelog.txt ./release/changelog.txt +#echo cp $QTGUI_DIR/release/changelog.txt ./release/changelog.txt + +"/cygdrive/c/Program Files/NSIS/makensis.exe" retroshare.nsi +#$NSIS_EXE retroshare.nsi diff --git a/build_scripts/Windows/retroshare.nsi b/build_scripts/Windows/retroshare.nsi index 63731e1eb..e2a201b21 100644 --- a/build_scripts/Windows/retroshare.nsi +++ b/build_scripts/Windows/retroshare.nsi @@ -2,7 +2,7 @@ ; Define your application name !define APPNAME "RetroShare" -!define VERSION "0.4.12a" +!define VERSION "0.4.13a" !define APPNAMEANDVERSION "${APPNAME} ${VERSION}" ; Main Install settings @@ -40,7 +40,7 @@ SetCompressor LZMA !define MUI_LANGDLL_REGISTRY_KEY ${REGKEY} !define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage -; !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of RetroShare. \r\n\r\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without havinf to reboot your computer. \r\n\r\nIMPORTANT: Ensure that RetroShare is NOT RUNNING before continuing (you can exit from the taskbar menu), otherwise the installer cannot update the executables, and the installation will fail. \r\n\r\nClick Next to continue. " +; !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of RetroShare. \r\n\r\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer. \r\n\r\nIMPORTANT: Ensure that RetroShare is NOT RUNNING before continuing (you can exit from the taskbar menu), otherwise the installer cannot update the executables, and the installation will fail. \r\n\r\nClick Next to continue. " !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of RetroShare. \r\n\r\nIMPORTANT: Ensure that RetroShare is NOT RUNNING before continuing (you can exit from the taskbar menu), otherwise the installer cannot update the executables, and the installation will fail. \r\n\r\nClick Next to continue. " @@ -144,14 +144,21 @@ Section $(sec_main) sec_main ; Set Section Files and Shortcuts SetOutPath "$INSTDIR\" File /r "release\RetroShare.exe" - File /r "D:\MinGW\bin\mingwm10.dll" - File /r "pthreadGCE2.dll" - File /r "D:\Qt\4.4.3\bin\QtCore4.dll" - File /r "D:\Qt\4.4.3\bin\QtGui4.dll" - File /r "D:\Qt\4.4.3\bin\QtNetwork4.dll" - File /r "D:\Qt\4.4.3\bin\QtXml4.dll" - File /r "D:\Qt\4.4.3\bin\QtScript4.dll" - File /r "changelog.txt" + File /r "release\mingwm10.dll" + File /r "release\changelog.txt" + +; Two Comments here: +; 1) Please use relative directorys ( like I have changed it to) +; As it prevents use from needing to continually change the file. +; 2) Better To Build as standalone exec. +; +; File /r "D:\MinGW\bin\mingwm10.dll" +; File /r "pthreadGCE2.dll" +; File /r "D:\Qt\4.4.3\bin\QtCore4.dll" +; File /r "D:\Qt\4.4.3\bin\QtGui4.dll" +; File /r "D:\Qt\4.4.3\bin\QtNetwork4.dll" +; File /r "D:\Qt\4.4.3\bin\QtXml4.dll" +; File /r "D:\Qt\4.4.3\bin\QtScript4.dll" @@ -169,19 +176,19 @@ Section $(sec_data) sec_data ; We're not ready for external skins... ; Set Section qss need to remove svn path SetOutPath "$INSTDIR\qss\" - File /r qss\*.* + File /r release\qss\*.* ; Set Section skin ; SetOutPath "$INSTDIR\skin\" - ; File /r release\skin\*.* + ; File /r skin\*.* ; Add emoticons SetOutPath "$INSTDIR\emoticons\" - File /r emoticons\*.* + File /r release\emoticons\*.* ; Add Chat Style SetOutPath "$INSTDIR\style\" - File /r style\*.* + File /r release\style\*.* SectionEnd diff --git a/build_scripts/Windows/stripSVN.sh b/build_scripts/Windows/stripSVN.sh new file mode 100755 index 000000000..65a740cab --- /dev/null +++ b/build_scripts/Windows/stripSVN.sh @@ -0,0 +1,12 @@ +#!/bin/sh + + +if [ $# -le 0 ] +then + echo usage $0 directory + exit +fi + +echo find $1 -name .svn +rm -vrf `find $1 -name .svn` + diff --git a/libretroshare/src/services/p3chatservice.cc b/libretroshare/src/services/p3chatservice.cc index 1dd1c639c..4ec1d3ee4 100644 --- a/libretroshare/src/services/p3chatservice.cc +++ b/libretroshare/src/services/p3chatservice.cc @@ -315,8 +315,8 @@ void p3ChatService::setOwnAvatarJpegData(const unsigned char *data,int size) for(std::map::iterator it(_avatars.begin());it!=_avatars.end();++it) it->second->_own_is_new = true ; } - IndicateConfigChanged(); + std::cerr << "p3chatservice:setOwnAvatarJpegData() done." << std::endl ; } void p3ChatService::receiveAvatarJpegData(RsChatMsgItem *ci) diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index f9c0b1512..191ef5642 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -1,4 +1,4 @@ -CONFIG += qt gui uic qrc resources uitools pluginmgr debug +CONFIG += qt gui uic qrc resources uitools release # pluginmgr debug QT += network xml script TEMPLATE = app TARGET = RetroShare @@ -53,10 +53,8 @@ win32-x-g++ { #################################### Windows ##################################### win32 { - OBJECTS_DIR = temp/obj - RCC_DIR = temp/qrc - UI_DIR = temp/ui - MOC_DIR = temp/moc + + OBJECTS_DIR = temp/obj LIBS += -L"../../../../lib" -lretroshare -lssl -lcrypto -lpthreadGC2d -lminiupnpc -lz LIBS += -lws2_32 -luuid -lole32 -liphlpapi -lcrypt32-cygwin -lgdi32 @@ -67,6 +65,7 @@ win32 { ## ENABLE THIS OPTION for release Version. #DEFINES += RS_RELEASE_VERSION + } ##################################### MacOS ###################################### diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index e61896aac..09f1f44f0 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -230,6 +230,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) ui.stackPages->add(pluginsPage = new PluginsPage(ui.stackPages), createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp)); #endif + /* Create the toolbar */ ui.toolBar->addActions(grp->actions()); ui.toolBar->addSeparator(); diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/SearchDialog.cpp index 96a99730c..c686cca9b 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/SearchDialog.cpp @@ -91,26 +91,23 @@ SearchDialog::SearchDialog(QWidget *parent) /* initialise the filetypes mapping */ if (!SearchDialog::initialised) { - initialiseFileTypeMappings(); + initialiseFileTypeMappings(); } /* Advanced search panel specifica */ RshareSettings rsharesettings; QString key (UI_PREF_ADVANCED_SEARCH); bool useAdvanced = rsharesettings.value(key, QVariant(false)).toBool(); - /*if (useAdvanced) + if (useAdvanced) { ui.toggleAdvancedSearchBtn->setChecked(true); ui.SimpleSearchPanel->hide(); } else { ui.AdvancedSearchPanel->hide(); - }*/ + } - //connect(ui.toggleAdvancedSearchBtn, SIGNAL(toggled(bool)), this, SLOT(toggleAdvancedSearchDialog(bool))); - //connect(ui.focusAdvSearchDialogBtn, SIGNAL(clicked()), this, SLOT(showAdvSearchDialog())); - connect(ui.toggleAdvancedSearchBtn, SIGNAL(clicked()), this, SLOT(showAdvSearchDialog())); - connect(ui.cloaseallsearchresultsButton, SIGNAL(clicked()), this, SLOT(searchRemoveAll())); - connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(clearKeyword())); + connect(ui.toggleAdvancedSearchBtn, SIGNAL(toggled(bool)), this, SLOT(toggleAdvancedSearchDialog(bool))); + connect(ui.focusAdvSearchDialogBtn, SIGNAL(clicked()), this, SLOT(showAdvSearchDialog())); /* End Advanced Search Panel specifics */ @@ -126,8 +123,6 @@ SearchDialog::SearchDialog(QWidget *parent) connect ( ui.searchSummaryWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ), this, SLOT( selectSearchResults( void ) ) ); - - connect( ui.searchResultWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(download())); /* hide the Tree +/- */ @@ -149,8 +144,8 @@ SearchDialog::SearchDialog(QWidget *parent) _smheader->setResizeMode (2, QHeaderView::Interactive); _smheader->resizeSection ( 0, 80 ); - _smheader->resizeSection ( 1, 60 ); - _smheader->resizeSection ( 2, 30 ); + _smheader->resizeSection ( 1, 75 ); + _smheader->resizeSection ( 2, 75 ); ui.searchResultWidget->setColumnCount(6); _smheader = ui.searchResultWidget->header () ; @@ -168,11 +163,11 @@ SearchDialog::SearchDialog(QWidget *parent) // set header text aligment - QTreeWidgetItem * headerItem = ui.searchResultWidget->headerItem(); - headerItem->setTextAlignment(2, Qt::AlignRight | Qt::AlignRight); - headerItem->setTextAlignment(3, Qt::AlignRight | Qt::AlignRight); + QTreeWidgetItem * headerItem = ui.searchResultWidget->headerItem(); + headerItem->setTextAlignment(2, Qt::AlignRight | Qt::AlignRight); + headerItem->setTextAlignment(3, Qt::AlignRight | Qt::AlignRight); - ui.searchResultWidget->sortItems(SR_NAME_COL, Qt::AscendingOrder); + ui.searchResultWidget->sortItems(SR_NAME_COL, Qt::AscendingOrder); @@ -226,9 +221,9 @@ void SearchDialog::searchtableWidgetCostumPopupMenu( QPoint point ) contextMnu->clear(); contextMnu->addAction( downloadAct); - //contextMnu->addSeparator(); - //contextMnu->addAction( broadcastonchannelAct); - //contextMnu->addAction( recommendtofriendsAct); + contextMnu->addSeparator(); + contextMnu->addAction( broadcastonchannelAct); + contextMnu->addAction( recommendtofriendsAct); } QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, @@ -367,13 +362,6 @@ void SearchDialog::searchRemoveAll() nextSearchId = 1; } -/** clear keywords **/ -void SearchDialog::clearKeyword() -{ - ui.lineEdit->clear(); - ui.FileTypeComboBox->setCurrentIndex(0); -} - /* ***************************************************************** Advanced search implementation *******************************************************************/ diff --git a/retroshare-gui/src/gui/SearchDialog.h b/retroshare-gui/src/gui/SearchDialog.h index 308d70d94..4e7fa576c 100644 --- a/retroshare-gui/src/gui/SearchDialog.h +++ b/retroshare-gui/src/gui/SearchDialog.h @@ -66,9 +66,6 @@ private slots: void searchRemoveAll(); void searchKeywords(); - - void clearKeyword(); - /** management of the adv search dialog object when switching search modes */ void toggleAdvancedSearchDialog(bool); diff --git a/retroshare-gui/src/gui/SearchDialog.ui b/retroshare-gui/src/gui/SearchDialog.ui index f09e9e446..565af914d 100644 --- a/retroshare-gui/src/gui/SearchDialog.ui +++ b/retroshare-gui/src/gui/SearchDialog.ui @@ -5,28 +5,16 @@ 0 0 - 685 - 474 + 661 + 289 - 0 - 0 + 1 + 1 - - - 0 - 0 - - - - - 0 - 0 - - @@ -511,502 +499,688 @@ Qt::NoContextMenu + + 6 + + + 0 + + + 6 + + + 0 + + + 1 + - 4 + 0 - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - :/images/find.png - - - true - - - Qt::AlignCenter - - - - - - - - 16777215 - 32 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Search</span></p></body></html> - - - - - - - - - - 0 - 0 - - - - - 220 - 0 - - - - - 220 - 152 - - - + + 0 - - - - 0 - 0 - 235 - 131 - - - - Keyword Search - - - - - + + 0 + + + 0 + + + 0 + + + 0 + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + 6 - - 6 + + 5 - - - - Type your Search here - - - - - + + 5 + + + 5 + + + 5 + + + - - 3 + + 0 0 - - - 558 - 16777215 - - - - - - - - - Any - - - :/images/FileTypeAny.png - - - - - Archive - - - :/images/FileTypeArchive.png - - - - - Audio - - - :/images/FileTypeAudio.png - - - - - CD-Image - - - :/images/FileTypeCDImage.png - - - - - Document - - - :/images/FileTypeDocument.png - - - - - Picture - - - :/images/FileTypePicture.png - - - - - Program - - - :/images/FileTypeProgram.png - - - - - Video - - - :/images/FileTypeVideo.png - - - - - - - 0 - 0 + 34 + 34 - 200 - 200 + 34 + 34 - Perform simple search + Toggle advanced searching on and off. - Search + - :/images/find.png + :/images/advsearch_24x24.png + + + + 24 + 24 + + + + true - + - Qt::Horizontal + Qt::Vertical - 88 - 20 + 20 + 0 - - + + + + + + + 255 + 0 + + + + + 390 + 24 + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + <h3>Simple Search:</h3> + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + Keywords + + + + + + + + 3 + 0 + + + + + 558 + 16777215 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 16 + 32 + + + + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Format</p></body></html> + + + + + + + + Any + + + :/images/FileTypeAny.png + + + + + Archive + + + :/images/FileTypeArchive.png + + + + + Audio + + + :/images/FileTypeAudio.png + + + + + CD-Image + + + :/images/FileTypeCDImage.png + + + + + Document + + + :/images/FileTypeDocument.png + + + + + Picture + + + :/images/FileTypePicture.png + + + + + Program + + + :/images/FileTypeProgram.png + + + + + Video + + + :/images/FileTypeVideo.png + + + + + + + + Qt::Horizontal + + + + 16 + 20 + + + + + + + + + 34 + 34 + + + + + 34 + 34 + + + + Perform simple search + + + + + + :/images/find.png + + + + 24 + 24 + + + + + + + + + + + + + true + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + <h3>Advanced Search:</h3> + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 50 + 20 + + + + + + + + true + + + + 0 + 0 + + + + Show Advanced Search Tool + + + + + + + + + + + + + + + 6 + + + 5 + + + 5 + + + 5 + + + 5 + + + + + + 0 + 0 + + + + + 34 + 34 + + + + + 34 + 34 + + + + Download + - Reset + + + + :/images/down_24x24.png + + + + 24 + 24 + + + + + Qt::Vertical + + + + 20 + 0 + + + + - - - - - - - - - - 1 - 0 - - - - Qt::CustomContextMenu - - - true - - - QAbstractItemView::DragOnly - - - true - - - - - - - - - Filename - - - - - Size - - - - - Sources - - - - - Type - - - - - Hash - - - - - + + - + 0 - 0 + 1 - - - 0 - 0 - - - - - 120 - 25 - - - - Download - - - Download - - - :/images/down_24x24.png - - - - 16 - 16 - - - - - - Qt::Horizontal - - - 158 - 31 - - - - - - - - - 0 - 25 - - - - Close All Search Results - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 34 - 24 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">advanced searching</p></body></html> - - - - - - :/images/advsearch_24x24.png - - - - 16 - 16 - - - - false - + + + + 1 + 0 + + + + Qt::CustomContextMenu + + + true + + + QAbstractItemView::DragOnly + + + true + + + + + + + + + Filename + + + + + Size + + + + + Sources + + + + + Type + + + + + Hash + + + + + + + 0 + 1 + + + + + 0 + 0 + + + + + 0 + 0 + + + + true + + + Qt::CustomContextMenu + + + true + + + + KeyWords + + + + + Results + + + + + Search Id + + + - - - - - 0 - 0 - - - - - 220 - 0 - - - - - 220 - 16777215 - - - - 0 - - - 6 - - - - - 0 - 0 - 224 - 221 - - - - Search Activity - - - - - - - 0 - 1 - - - - - 200 - 16777215 - - - - - 0 - 0 - - - - - 0 - 0 - - - - true - - - Qt::CustomContextMenu - - - true - - - - KeyWords - - - - - Results - - - - - Search Id - - - - - - - - @@ -1019,5 +1193,38 @@ p, li { white-space: pre-wrap; } - + + + toggleAdvancedSearchBtn + toggled(bool) + SimpleSearchPanel + setHidden(bool) + + + 29 + 35 + + + 72 + 43 + + + + + toggleAdvancedSearchBtn + toggled(bool) + AdvancedSearchPanel + setVisible(bool) + + + 28 + 29 + + + 80 + 64 + + + + diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index a6f150873..3cb0d71b4 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -33,13 +33,9 @@ #include #include #include -#include #include "rsiface/rspeers.h" #include "rsiface/rsmsgs.h" -#include "rsiface/rsfiles.h" - -#include "gui/feeds/SubFileItem.h" #define appDir QApplication::applicationDirPath() @@ -80,8 +76,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name, connect(ui.chattextEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) )); connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) )); - connect(ui.addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); - + connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(setFont())); @@ -90,13 +85,10 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name, connect(ui.emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); connect(ui.styleButton, SIGNAL(clicked()), SLOT(changeStyle())); - connect(ui.textBrowser, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &))); - // Create the status bar resetStatusBar() ; ui.textBrowser->setOpenExternalLinks ( false ); - ui.textBrowser->setOpenLinks ( false ); QString title = QString::fromStdString(name) + " :" + tr(" RetroShare - Encrypted Chat") ; setWindowTitle(title); @@ -139,7 +131,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name, void PopupChatDialog::resetStatusBar() { - statusBar()->showMessage(tr("Chatting with ") + QString::fromStdString(dialogName) + " (" +QString::fromStdString(dialogId)+ ")") ; + statusBar()->showMessage(QString("Chatting with ") + QString::fromStdString(dialogName) + " (" +QString::fromStdString(dialogId)+ ")") ; } void PopupChatDialog::updateStatusTyping() @@ -251,19 +243,6 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci) QString name = QString::fromStdString(ci ->name); QString message = QString::fromStdWString(ci -> msg); - //replace url by a link - //first, avoid DTD link taht stands at the beginning of the string - QString messageSubString = message.mid(110, -1); - //replace http:// and www. with links - messageSubString.replace(QRegExp("(http://[^ <]*)|(www\\.[^ <]*)"), "\\1\\2"); - //rebuild the full message - message = message.left(109) + messageSubString; - -#ifdef CHAT_DEBUG -std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() << std::endl; -#endif - - /*QHashIterator i(smileys); while(i.hasNext()) { @@ -315,7 +294,7 @@ void PopupChatDialog::checkChat() void PopupChatDialog::sendChat() { - QTextEdit *chatWidget = ui.chattextEdit; + QTextEdit *chatWidget = ui.chattextEdit; ChatInfo ci; @@ -699,123 +678,3 @@ void PopupChatDialog::getAvatar() } } -void PopupChatDialog::addExtraFile() -{ - // select a file - QString qfile = QFileDialog::getOpenFileName(this, tr("Add Extra File"), "", "", 0, - QFileDialog::DontResolveSymlinks); - std::string filePath = qfile.toStdString(); - if (filePath != "") - { - /* add a SubFileItem to the attachment section */ - std::cerr << "PopupChatDialog::addExtraFile() hashing file."; - std::cerr << std::endl; - - /* add widget in for new destination */ - SubFileItem *file = new SubFileItem(filePath); - //file-> - - ui.vboxLayout->addWidget(file, 1, 0); - - //when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message - if (file->getState() == SFI_STATE_LOCAL) { - fileHashingFinished(file); - } else { - QObject::connect(file,SIGNAL(fileFinished(SubFileItem *)), SLOT(fileHashingFinished(SubFileItem *))) ; - } - - } -} - -void PopupChatDialog::fileHashingFinished(SubFileItem* file) { - std::cerr << "PopupChatDialog::fileHashingFinished() started."; - std::cerr << std::endl; - - ChatInfo ci; - - - { - rsiface->lockData(); /* Lock Interface */ - const RsConfig &conf = rsiface->getConfig(); - - ci.rsid = conf.ownId; - ci.name = conf.ownName; - - rsiface->unlockData(); /* Unlock Interface */ - } - - //convert fileSize from uint_64 to string for html link - char fileSizeChar [100]; - sprintf(fileSizeChar, "%lld", file->FileSize()); - std::string fileSize = *(&fileSizeChar); - - std::string mesgString = "" + (file->FileName()) + ""; -#ifdef CHAT_DEBUG - std::cerr << "PopupChatDialog::anchorClicked mesgString : " << mesgString << std::endl; -#endif - - const char * messageString = mesgString.c_str (); - - //convert char massageString to w_char - wchar_t* message; - int requiredSize = mbstowcs(NULL, messageString, 0); // C4996 - /* Add one to leave room for the NULL terminator */ - message = (wchar_t *)malloc( (requiredSize + 1) * sizeof( wchar_t )); - if (! message) - { - std::cerr << ("Memory allocation failure.\n"); - } - int size = mbstowcs( message, messageString, requiredSize + 1); // C4996 - if (size == (size_t) (-1)) - { - printf("Couldn't convert string--invalid multibyte character.\n"); - } - - ci.msg = message; - ci.chatflags = RS_CHAT_PRIVATE; - - addChatMsg(&ci); - - /* put proper destination */ - ci.rsid = dialogId; - ci.name = dialogName; - - rsMsgs -> ChatSend(ci); -} - -void PopupChatDialog::anchorClicked (const QUrl& link ) { - #ifdef CHAT_DEBUG - std::cerr << "PopupChatDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl; - #endif - if (link.scheme() == "file") { - std::string fileName = link.queryItemValue(QString("fileName")).toStdString(); - std::string fileHash = link.queryItemValue(QString("fileHash")).toStdString(); - uint32_t fileSize = link.queryItemValue(QString("fileSize")).toInt(); - #ifdef CHAT_DEBUG - std::cerr << "PopupChatDialog::anchorClicked FileRequest : fileName : " << fileName << ". fileHash : " << fileHash << ". fileSize : " << fileSize; - std::cerr << ". source id : " << dialogId << std::endl; - #endif - if (fileName != "" && - fileHash != "") { - std::list srcIds; - srcIds.push_front(dialogId); - rsFiles->FileRequest(fileName, fileHash, fileSize, "", 0, srcIds); - - QMessageBox mb(tr("File Request Confirmation"), tr("The file has been added to your download list."),QMessageBox::Information,QMessageBox::Ok,0,0); - mb.setButtonText( QMessageBox::Ok, "OK" ); - mb.exec(); - } else { - QMessageBox mb(tr("File Request Error"), tr("The file link is malformed."),QMessageBox::Information,QMessageBox::Ok,0,0); - mb.setButtonText( QMessageBox::Ok, "OK" ); - mb.exec(); - } - } else if (link.scheme() == "http") { - QDesktopServices::openUrl(link); - } else if (link.scheme() == "") { - //it's probably a web adress, let's add http:// at the beginning of the link - QString newAddress = link.toString(); - newAddress.prepend("http://"); - QDesktopServices::openUrl(QUrl(newAddress)); - } - -} diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.h b/retroshare-gui/src/gui/chat/PopupChatDialog.h index f23cfd343..9e34c9e57 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.h +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.h @@ -30,7 +30,6 @@ #include #include "rsiface/rsiface.h" -#include "gui/feeds/SubFileItem.h" @@ -75,19 +74,15 @@ public slots: void addSmiley(); void changeStyle(); - void fileHashingFinished(SubFileItem* file); void resetStatusBar() ; void updateStatusTyping() ; void updateStatusString(const QString&) ; - void anchorClicked (const QUrl &); - - protected: void closeEvent (QCloseEvent * event); private slots: - void addExtraFile(); + void showAvatarFrame(bool show); void setColor(); @@ -100,6 +95,7 @@ private slots: void getAvatar(); + private: void colorChanged(const QColor &c); @@ -124,9 +120,10 @@ private: QStringList history; QString wholeChat; + + /** Qt Designer generated object */ Ui::PopupChatDialog ui; - }; #endif diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.ui b/retroshare-gui/src/gui/chat/PopupChatDialog.ui index f6d694148..72ccb32ef 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.ui +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.ui @@ -6,7 +6,7 @@ 0 0 484 - 439 + 437 @@ -446,7 +446,7 @@ p, li { white-space: pre-wrap; } - + 0 @@ -456,30 +456,23 @@ p, li { white-space: pre-wrap; } 2 - - - - - - - :/images/add-share24.png - - - - + + 6 + + Qt::Horizontal - 331 + 351 20 - + Send @@ -488,9 +481,6 @@ p, li { white-space: pre-wrap; } - - - diff --git a/retroshare-gui/src/util/rsversion.cpp b/retroshare-gui/src/util/rsversion.cpp index da709b345..d0a098b4e 100644 --- a/retroshare-gui/src/util/rsversion.cpp +++ b/retroshare-gui/src/util/rsversion.cpp @@ -23,7 +23,7 @@ //#define USE_SVN_VERSIONS 1 -#define VERSION "0.4.12d" +#define VERSION "0.4.13a" #if USE_SVN_VERSIONS #include "svn_revision.h"