dc-qt-0.2.0.alpha/0000755000175000017500000000000010467035213012630 5ustar whitewhitedc-qt-0.2.0.alpha/ui/0000755000175000017500000000000010467035207013250 5ustar whitewhitedc-qt-0.2.0.alpha/ui/favouritehubswidget.h0000644000175000017500000000656010433640765017526 0ustar whitewhite// // C++ Interface: FavouriteHubs // // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #ifndef FAVOURITE_HUBS_H__ #define FAVOURITE_HUBS_H__ #include #include #include #include #include "ui_favouritehublist.h" #include "rpctypes.h" #include "backendconnection.h" //! Implements the favourite hub list user interface class FavouriteHubs : public QWidget { Q_OBJECT public: FavouriteHubs( const BackendConnectionPtr& backendConn, QWidget* parent=0); ~FavouriteHubs() {} public slots: //! Called to set the list of favourite hubs. void setHubs(const QList& hubs) { model->setHubs(hubs); } //! Called when a hub has been added. void addHub(const rpc_types::FavouriteHub& e) { model->addHub(e); } //! Called when a hub has been removed. void removeHub(const string& e) { model->removeHub(e); } void refresh(); private slots: void on_connectFavouriteButton_clicked(); //! Called to execute a remove request to the backend. void on_removeFavouriteButton_clicked(); void on_addFavouriteButton_clicked(); void on_favouriteHubList_doubleClicked(); void createPersistentEditors(); signals: void close(); private: class FavouriteHubsModel; class CheckBoxDelegate; boost::shared_ptr model; boost::shared_ptr delegate; Ui::FavouriteHubsForm ui; BackendConnectionPtr backendConnection; class CheckBoxDelegate : public QItemDelegate { public: CheckBoxDelegate(QObject *parent = 0); //! Returns the editor widget used for editing the given index QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,const QModelIndex &index) const; //! Set the data to be edited in the given editor void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model,const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor,const QStyleOptionViewItem &option, const QModelIndex &index) const; }; class FavouriteHubsModel : public QAbstractTableModel { friend class CheckBoxDelegate; public: FavouriteHubsModel(QWidget* parent=0) : QAbstractTableModel( parent ) {} ~FavouriteHubsModel() {} // QAbstractTableModel methods... int rowCount ( const QModelIndex& ) const { return entries.size(); } int columnCount ( const QModelIndex& ) const { return 7; } QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; QString getServer(int row) const { return entries.at(row).server.c_str(); } //! AbstractItemView overload. Called by the view when editing. virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual Qt::ItemFlags flags ( const QModelIndex & index ) const; void setHubs(const QList&); void addHub(const rpc_types::FavouriteHub&); void removeHub(const string&); protected: rpc_types::FavouriteHub getHubData( const QModelIndex& index ) const; private: QList entries; }; }; #endif dc-qt-0.2.0.alpha/ui/favouritehubswidget.cpp0000644000175000017500000001207710433640765020061 0ustar whitewhite// // C++ Implementation: FavouriteHubs // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #include #include "favouritehubswidget.h" #include "backendconnection.h" #include "createfavouritedialog.h" FavouriteHubs::CheckBoxDelegate::CheckBoxDelegate( QObject *parent ) : QItemDelegate(parent) { } QWidget * FavouriteHubs::CheckBoxDelegate::createEditor( QWidget * parent, const QStyleOptionViewItem & /*option*/, const QModelIndex & /*index*/ ) const { QCheckBox* editor = new QCheckBox( parent ); editor->installEventFilter(editor); return editor; } void FavouriteHubs::CheckBoxDelegate::setEditorData( QWidget * editor, const QModelIndex & index ) const { QCheckBox *checkBox = dynamic_cast(editor); try { checkBox->setChecked(dynamic_cast(index.model())->getHubData(index).autoConnect); } catch(...) { } } void FavouriteHubs::CheckBoxDelegate::setModelData( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const { QCheckBox *checkBox = dynamic_cast(editor); bool value = checkBox->isChecked(); model->setData(index, value); } void FavouriteHubs::CheckBoxDelegate::updateEditorGeometry( QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & /*index*/ ) const { editor->setGeometry(option.rect); } FavouriteHubs::FavouriteHubs( const BackendConnectionPtr& backendConn, QWidget * parent ) : QWidget(parent), model(new FavouriteHubsModel(this)), delegate( new CheckBoxDelegate ), backendConnection( backendConn ) { // Create the UI ui.setupUi(this); ui.favouriteHubList->setModel(model.get()); ui.favouriteHubList->setItemDelegate(delegate.get()); connect(model.get(),SIGNAL(layoutChanged()),SLOT(createPersistentEditors())); } void FavouriteHubs::on_connectFavouriteButton_clicked( ) { backendConnection->createSession( model->getServer( ui.favouriteHubList->selectionModel()->currentIndex().row() )); emit close(); } void FavouriteHubs::on_removeFavouriteButton_clicked( ) { QModelIndex i = ui.favouriteHubList->selectionModel()->currentIndex(); if(i.isValid()) backendConnection->removeFavouriteHub( model->getServer( i.row()) ); } void FavouriteHubs::on_addFavouriteButton_clicked( ) { CreateFavouriteDialog dlg( backendConnection, this ); dlg.setModal(true); dlg.exec(); } void FavouriteHubs::on_favouriteHubList_doubleClicked() { on_connectFavouriteButton_clicked(); } void FavouriteHubs::createPersistentEditors( ) { // todo iterate, call openpersistenteditor for(int i = 0; i < model->rowCount(QModelIndex());i++) { QModelIndex mi = model->index(i,0); ui.favouriteHubList->openPersistentEditor(mi); } } void FavouriteHubs::refresh() { backendConnection->getFavouriteHubs(); } QVariant FavouriteHubs::FavouriteHubsModel::data( const QModelIndex & index, int role ) const { if(role==Qt::DisplayRole) { switch(index.column()) { // case 0: return entries[index.row()].autoConnect; case 1: return entries[index.row()].name.c_str(); case 2: return entries[index.row()].server.c_str(); case 3: return entries[index.row()].description.c_str(); case 4: return entries[index.row()].password.c_str(); case 5: return entries[index.row()].nick.c_str(); case 6: return entries[index.row()].userDescription.c_str(); } } return QVariant(); } rpc_types::FavouriteHub FavouriteHubs::FavouriteHubsModel::getHubData( const QModelIndex& index ) const { if( index.isValid() ) { return entries[index.row()]; } return rpc_types::FavouriteHub(); } QVariant FavouriteHubs::FavouriteHubsModel::headerData( int section, Qt::Orientation orientation, int role ) const { if( orientation==Qt::Horizontal && role==Qt::DisplayRole ) { switch(section) { case 0: return tr("AutoConnect"); case 1: return tr("Name"); case 2: return tr("Server"); case 3: return tr("Description"); case 4: return tr("Password"); case 5: return tr("Nick"); case 6: return tr("User Description"); } } return QVariant(); } void FavouriteHubs::FavouriteHubsModel::setHubs( const QList< rpc_types::FavouriteHub >& hubs) { entries = hubs; emit layoutChanged(); } void FavouriteHubs::FavouriteHubsModel::addHub( const rpc_types::FavouriteHub &e ) { entries.append( e ); emit layoutChanged(); } void FavouriteHubs::FavouriteHubsModel::removeHub( const string &s ) { rpc_types::FavouriteHub tempFav; tempFav.server = s; entries.removeAll( tempFav ); emit layoutChanged(); } bool FavouriteHubs::FavouriteHubsModel::setData ( const QModelIndex& index, const QVariant& value, int role /*= Qt::EditRole*/ ) { if(index.column()==0 && role==Qt::EditRole) // editing autoconnect { entries[index.row()].autoConnect = value.toBool(); return true; } return false; } Qt::ItemFlags FavouriteHubs::FavouriteHubsModel::flags ( const QModelIndex& index ) const { switch(index.column()) { case 0: return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEditable; } return Qt::ItemIsSelectable | Qt::ItemIsEnabled; } dc-qt-0.2.0.alpha/ui/filelog.h0000644000175000017500000000163610433640765015054 0ustar whitewhite// // C++ Interface: filelog // // Description: // // // Author: Arsenij Vodjanov , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #ifndef FILELOG_H_ #define FILELOG_H_ #include "log.h" #include //! Log implementation that logs to a file. class FileLog : public Log { public: FileLog(); virtual void info(const char* format, ...); virtual void info(const QString&); virtual void error(const char* format, ...); virtual void error(const QString&); virtual void warn(const char* format, ...); virtual void warn(const QString&); virtual void debug(const char* format, ...); virtual void debug(const QString&); virtual void msg(const QString&,const QColor& color); virtual ~FileLog(); private: void printMessage(const QString msg); void printMessage(const char* format, va_list va); QTime time; }; #endif dc-qt-0.2.0.alpha/ui/commandhandlers.h0000644000175000017500000002703110433640765016567 0ustar whitewhite#ifndef COMMAND_HANDLERS_H_ #define COMMAND_HANDLERS_H_ #include "commandhandlersinclude.h" #include "shareitemmodel.h" #include "searchentry.h" #include "queueitem.h" #include "filetransfer.h" #include "exceptions.h" #include "userfilemodel.h" #include #include class User; class FinishedItem; namespace ui_cmd_handlers { class RpcCommandEvent : public QEvent { public: RpcCommandEvent(const anylist& params) : QEvent(QEvent::User), parameters(params) {} ; const anylist& getParams() const { return parameters; } private: const anylist parameters; }; class GuiCommandHandlerBase : public QObject, public rpc::RpcCommandHandler { Q_OBJECT public: GuiCommandHandlerBase(const char* name, boost::function sender, int numParams ) : rpc::RpcCommandHandler(name, sender,numParams ),dialogFence(false) {} //! Called by the RpcDriver. virtual void handleCommand(int /*clientId*/, const anylist& params) { RpcCommandEvent* event = new RpcCommandEvent(params); // deleted by qt QCoreApplication::postEvent(this,event); } protected: virtual void customEvent(QEvent* e) { RpcCommandEvent* ce = static_cast(e); try { handleCommand(ce->getParams()); } catch(const boost::bad_any_cast& e) { if(!dialogFence) { dialogFence = true; QMessageBox::critical(0,tr("Backend Communication Error"), tr("We encountered an error while communicating with the backend! Perhaps versions mismatch?")); dialogFence = false; } } catch(const RpcHandlerException& re) { if(!dialogFence) { dialogFence = true; QMessageBox::critical(0,tr("Backend Communication Error"), QString("Exception: ") + re.getMethodName() + " " + re.getMessage()); dialogFence = false; } } } virtual void handleCommand(const anylist& params) = 0; private: bool dialogFence; }; class HubConnectedHandler : public GuiCommandHandlerBase { Q_OBJECT public: HubConnectedHandler(boost::function sender ) : GuiCommandHandlerBase("hubConnected", sender,NUM_PARAMS ) {} protected: //! Implements the actual command parsing and signal emission. virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 1; signals: void hubConnected(int); }; class HubUpdatedHandler : public GuiCommandHandlerBase { Q_OBJECT public: HubUpdatedHandler(boost::function sender ) : GuiCommandHandlerBase("hubUpdated", sender,NUM_PARAMS ) {} protected: //! Implements the actual command parsing and signal emission. virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void hubUpdated(int,const QString&); }; class HubStatsHandler : public GuiCommandHandlerBase { Q_OBJECT public: HubStatsHandler(boost::function sender ) : GuiCommandHandlerBase("hubStats", sender,NUM_PARAMS ) {} protected: //! Implements the actual command parsing and signal emission. virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void hubStats(int,qint64); }; class ConnectionFailedHandler : public GuiCommandHandlerBase { Q_OBJECT public: ConnectionFailedHandler(boost::function sender ) : GuiCommandHandlerBase("connectionFailed", sender,NUM_PARAMS ) {} protected: //! Implements the actual command parsing and signal emission. virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void connectionFailed(int,const QString&); }; class PrivateChatHandler : public GuiCommandHandlerBase { Q_OBJECT public: PrivateChatHandler(boost::function sender ) : GuiCommandHandlerBase("privateChatMessage", sender,NUM_PARAMS) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 3; signals: void privateChat(int session,const QString& user,const QString& msg); }; class ChatMessageHandler : public GuiCommandHandlerBase { Q_OBJECT public: ChatMessageHandler( boost::function sender ) : GuiCommandHandlerBase("chatMessage",sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void chatMessage(int session,const QString&); }; class UsersUpdatedHandler : public GuiCommandHandlerBase { Q_OBJECT public: UsersUpdatedHandler( boost::function sender ) : GuiCommandHandlerBase("usersUpdated",sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void usersUpdated(int session,QList); }; class settingsInfoHandler : public GuiCommandHandlerBase { Q_OBJECT public: settingsInfoHandler(boost::function sender ) : GuiCommandHandlerBase("settingsInfo", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void settingsInfo(const QList&,const QList&); }; class PublicHubListHandler : public GuiCommandHandlerBase { Q_OBJECT public: PublicHubListHandler( boost::function sender ) : GuiCommandHandlerBase( "newHubList", sender, NUM_PARAMS ) {} protected: virtual void handleCommand( const anylist& params ); private: static const short NUM_PARAMS = 1; signals: void hubList( const QList& ); }; class FavouriteHubAddedHandler : public GuiCommandHandlerBase { Q_OBJECT public: FavouriteHubAddedHandler( boost::function sender ) : GuiCommandHandlerBase( "favouriteHubAdded", sender, NUM_PARAMS ) {} protected: virtual void handleCommand( const anylist& params ); private: static const short NUM_PARAMS = 1; signals: void favHubAdded( const rpc_types::FavouriteHub& ); }; class FavouriteHubRemovedHandler : public GuiCommandHandlerBase { Q_OBJECT public: FavouriteHubRemovedHandler( boost::function sender ) : GuiCommandHandlerBase( "favouriteHubRemoved", sender, NUM_PARAMS ) {} protected: virtual void handleCommand( const anylist& params ); private: static const short NUM_PARAMS = 1; signals: void favHubRemoved( const string& ); }; class FavouriteHubListHandler : public GuiCommandHandlerBase { Q_OBJECT public: FavouriteHubListHandler( boost::function sender ) : GuiCommandHandlerBase( "favouriteHubList", sender, NUM_PARAMS ) {} protected: virtual void handleCommand( const anylist& params ); private: static const short NUM_PARAMS = 1; signals: void hubList( const QList& ); }; class RunningSessionsHandler : public GuiCommandHandlerBase { Q_OBJECT public: RunningSessionsHandler(boost::function sender ) : GuiCommandHandlerBase("runningSessions", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void sessionInfo(int id,const QString& hubname,const QString& url,const QList); void queueList(const QList&); }; class SessionCreatedHandler : public GuiCommandHandlerBase { Q_OBJECT public: SessionCreatedHandler(boost::function sender ) : GuiCommandHandlerBase("sessionCreated", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 1; signals: void sessionCreated(int); }; //! Handles the sharedDirs remote procedure call. class SharedDirsHandler : public GuiCommandHandlerBase { Q_OBJECT public: SharedDirsHandler(boost::function sender ) : GuiCommandHandlerBase("sharedDirs", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 1; signals: void sharedDirs(const QList); }; //! Handles the searchResults remote procedure call. class SearchResultsHandler : public GuiCommandHandlerBase { Q_OBJECT public: SearchResultsHandler(boost::function sender ) : GuiCommandHandlerBase("searchResults", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void searchResults(int,QList&); }; //! Handles queueEvent class QueueEventHandler : public GuiCommandHandlerBase { Q_OBJECT public: QueueEventHandler(boost::function sender ) : GuiCommandHandlerBase("queueEvent", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 1; signals: void queueItemAdded(const QueueItem&); void queueItemRemoved(int id); void queueItemFinshed(int id); void sourcesUpdated(int id, QList sources); void statusUpdated(int id, int status, int currentSource, int priority); }; //! Handles finishedEvent class FinishedEventHandler : public GuiCommandHandlerBase { Q_OBJECT public: FinishedEventHandler(boost::function sender ) : GuiCommandHandlerBase("finishedEvent", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void itemAdded(const FinishedItem&); void itemRemoved(int); void allRemoved(int); }; //! Handles transferEvent class TransferEventHandler : public GuiCommandHandlerBase { Q_OBJECT public: TransferEventHandler(boost::function sender ) : GuiCommandHandlerBase("transferEvent", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; FileTransfer createTransfer(FileTransfer::Type type,const anylist& ft); signals: void transferStarting(const FileTransfer&); void transferTick( const QList& ); void transferComplete( const FileTransfer& ); void transferFailed( const FileTransfer&,const QString& ); }; class UserFileListHandler : public GuiCommandHandlerBase { Q_OBJECT public: UserFileListHandler(boost::function sender ) : GuiCommandHandlerBase("userFileListing", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void fileListing( const UserFileModelPtr& model ); }; //! Handles the userRemoved command. class UserRemovedHandler : public GuiCommandHandlerBase { Q_OBJECT public: UserRemovedHandler(boost::function sender ) : GuiCommandHandlerBase("userRemoved", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 2; signals: void userRemoved(int session, int id); }; class HashInfoHandler : public GuiCommandHandlerBase { Q_OBJECT public: HashInfoHandler(boost::function sender ) : GuiCommandHandlerBase("hashInfo", sender,NUM_PARAMS ) {} protected: virtual void handleCommand(const anylist& params); private: static const short NUM_PARAMS = 4; signals: void userRemoved(int session, int id); }; } #endif dc-qt-0.2.0.alpha/ui/mainwindow.h0000644000175000017500000000366410433640765015612 0ustar whitewhite#ifndef MAINWINDOW_H #define MAINWINDOW_H #include "ui_mainwindow.h" #include "backendconnection.h" #include "settingsdialog.h" #include "commandhandlers.h" #include "sessionmanager.h" #include "searchmanager.h" #include "globalusermodel.h" #include "queuemodel.h" #include "finishedmodel.h" #include "transferlistmodel.h" #include "userfilemodel.h" #include #include #include #include class ConnectDialog; class QLabel; using namespace ui_cmd_handlers; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(); virtual ~MainWindow(); /** * Connects to the backend. TODO add code for connecting to another instance when already connected */ bool connectToBackend(const char* hostname,int port); public slots: /** * Connects to the backend using local settings. */ void connectToBackend(); protected: virtual void closeEvent(QCloseEvent*); private: Ui::MainWindow ui; QLabel *shareStatusLbl; boost::shared_ptr backendConnection; QPointer settingsDialog; QPointer sessionManager; QPointer searchManager; QPointer connectDialog; QPointer queueModel; QPointer finishedModel; QPointer transferModel; boost::shared_ptr< rpc::RpcClientDriver > driver; boost::shared_ptr< GlobalUserModel > userModel; int backendRetriesLeft; //! Registers the command handlers void registerCommandHandlers(); QString password; private slots: void on_actionConnect_triggered(); void on_actionSettings_triggered(); void on_actionSearch_triggered(); void on_actionForceAttempt_triggered(); void on_actionCancelDownload_triggered(); void userFileListing( const UserFileModelPtr& model ); void onDisconnectPressed(); void updateTotalShareStatus(qint64); void onQueueContextMenu(const QPoint&); }; #endif dc-qt-0.2.0.alpha/ui/res.qrc0000644000175000017500000000154510433640765014561 0ustar whitewhite images/browse.png images/exit.png images/publichubs.png images/remove.png images/search.png images/settings.png images/user-dcpp-op.png images/user-dcpp-passive-op.png images/user-dcpp-passive.png images/user-dcpp.png images/user-normal-op.png images/user-normal.png images/user-passive-op.png images/user-passive.png images/download.png images/downloadto.png images/dldir.png images/dldirto.png images/tthsearch.png images/filelist.png dc-qt-0.2.0.alpha/ui/userfiledialog.h0000644000175000017500000000215710433640765016430 0ustar whitewhite/* * userfiledialog.h * ui * * Created by Mikael Gransell on 4/13/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #ifndef USER_FILE_DIALOG_H #define USER_FILE_DIALOG_H #include #include #include "backendconnection.h" #include "userfilemodel.h" #include "ui_userfilelisting.h" class GlobalUserModel; class UserFileDialog : public QDialog { Q_OBJECT public: UserFileDialog( const UserFileModelPtr& mdl, BackendConnectionPtr backendConn, boost::shared_ptr userModel, QWidget* parent = NULL ); ~UserFileDialog() { } public slots: void on_treeView_customContextMenuRequested( const QPoint& pos ); void on_treeView_doubleClicked(); void onDownload(); void onDownloadTo(); private: void download( const QModelIndex& index ); void downloadTo( const QModelIndex& index, const QString& path ); QString formatFileName( const UserFileModel::TreeItem* item ) const; void createMenu(); boost::shared_ptr contextMenu; Ui::UserFileDialog ui; BackendConnectionPtr backendConnection; UserFileModelPtr model; }; #endif dc-qt-0.2.0.alpha/ui/log.h0000644000175000017500000000150010433640765014202 0ustar whitewhite// // C++ Interface: log // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #ifndef LOG_H__ #define LOG_H__ #include #include //! Logging interface class Log { public: virtual void info(const char* format, ...) = 0; virtual void info(const QString&) = 0; virtual void error(const char* format, ...) = 0; virtual void error(const QString&) = 0; virtual void warn(const char* format, ...) = 0; virtual void warn(const QString&) = 0; virtual void debug(const char* format, ...) = 0; virtual void debug(const QString&) = 0; virtual void msg(const QString&,const QColor& color) = 0; virtual ~Log() {} }; extern Log* logger; #endif dc-qt-0.2.0.alpha/ui/filelog.cpp0000644000175000017500000000434410433640765015406 0ustar whitewhite// // C++ Implementation: filelog // // Description: // // // Author: Arsenij Vodjanov , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #include "filelog.h" #include #include #include #define FLOG_ENABLE // This should be retrieved from gui settings #define FLOG_FILE_NAME "/tmp/qtclient.log" FileLog::FileLog() { time.start(); QString msg("--- New log started on %1"); printMessage(msg.arg(QDateTime::currentDateTime().toString("ddd MMMM d yyyy"))); } void FileLog::info(const char* format, ...) { #ifdef FLOG_ENABLE va_list va; va_start(va,format); printMessage(format,va); va_end(va); #endif } void FileLog::info(const QString& msg) { #ifdef FLOG_ENABLE printMessage(msg); #endif } void FileLog::error(const char* format, ...) { #ifdef FLOG_ENABLE va_list va; va_start(va,format); printMessage(format,va); va_end(va); #endif } void FileLog::error(const QString& msg) { #ifdef FLOG_ENABLE printMessage(msg); #endif } void FileLog::warn(const char* format, ...) { #ifdef FLOG_ENABLE va_list va; va_start(va,format); printMessage(format,va); va_end(va); #endif } void FileLog::warn(const QString& msg) { #ifdef FLOG_ENABLE printMessage(msg); #endif } void FileLog::debug(const char* format, ...) { #ifdef FLOG_ENABLE va_list va; va_start(va,format); printMessage(format,va); va_end(va); #endif } void FileLog::debug(const QString& msg) { #ifdef FLOG_ENABLE printMessage(msg); #endif } void FileLog::msg(const QString& msg,const QColor&) { #ifdef FLOG_ENABLE printMessage(msg); #endif } FileLog::~FileLog() { #ifdef FLOG_ENABLE printMessage("--- End of log"); #endif } void FileLog::printMessage(const QString msg) { #ifdef FLOG_ENABLE time.restart(); QFile file(FLOG_FILE_NAME); if (!file.open(QIODevice::Append | QIODevice::Text)) return; QTextStream out(&file); out << time.toString("hh:mm:ss.zzz") << ": " << msg; if (!msg.endsWith("\n")) out << endl; file.close(); #endif } void FileLog::printMessage(const char* format, va_list va) { #ifdef FLOG_ENABLE QString msg; msg.vsprintf(format,va); printMessage(msg); #endif } dc-qt-0.2.0.alpha/ui/transferlistmodel.h0000644000175000017500000000341210433640765017166 0ustar whitewhite#ifndef TRANSFER_LIST_MODEL_H__ #define TRANSFER_LIST_MODEL_H__ #include "global.h" #include "filetransfer.h" #include #include class TransferListModel : public QAbstractTableModel { Q_OBJECT public: //!< Column indexes enum eTransferColumnHeader { COL_USER = 0, //!< User nick COL_FILE_NAME, //!< stripped path filename COL_PROGRESS_BAR, //!< data() for this column returns QVariant( QList ) COL_SIZE_LEFT, COL_SIZE_TOTAL, COL_AVG_SPEED, COL_STATUS, NUM_COLUMNS }; //! Index into QList returned by data() for COL_PROGRESS_BAR enum eProgressData { PDATA_IS_DOWNLOAD, //!< bool, true if this transfer is a download PDATA_START_POS, //!< qlonglong, start position PDATA_POS, //!< qlonglong, write position in file PDATA_ACTUAL, //!< qlonglong, bytes transferred this sessions PDATA_SIZE, //!< qlonglong, target size PDATA_SECONDS_LEFT, //!< int, estimated time left, in seconds PDATA_MAX_INDEX }; TransferListModel() {} virtual ~TransferListModel() {} int rowCount ( const QModelIndex& ) const {return transfers.size();} int columnCount ( const QModelIndex& ) const {return NUM_COLUMNS;} QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; FileTransfer data(int row) {Q_ASSERT(row>=0 && row < transfers.size());return transfers[row];} public slots: void onTransferStart( const FileTransfer& ); void onTransferTick( const QList& ); void onTransferComplete( const FileTransfer& ); void onTransferFailed( const FileTransfer&,const QString& ); private: QList transfers; }; #endif dc-qt-0.2.0.alpha/ui/nicetreeview.cpp0000644000175000017500000000217010433640765016451 0ustar whitewhite// // C++ Implementation: nicetreeview // // Description: // // // Author: Rikard Bjorklind , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include "nicetreeview.h" #include #include #include "log.h" NiceTreeView::NiceTreeView(QWidget *parent) : QTreeView(parent) { } NiceTreeView::~NiceTreeView() { } /* void NiceTreeView::paintEvent( QPaintEvent * event ) { int rowCount = model()->rowCount( ); if(rowCount) { QTreeView::paintEvent(event); } else { QPainter painter(this); painter.setPen(Qt::blue); painter.setFont(QFont("Arial", 30)); painter.drawText(rect(), Qt::AlignCenter, "Click or drag items here to add something"); } } void NiceTreeView::dragEnterEvent( QDragEnterEvent * event ) { QStringList sl = event->mimeData()->formats(); for(int i =0;iinfo(s); } } */ void NiceTreeView::mousePressEvent( QMouseEvent * event ) { if(event->button()==Qt::LeftButton && !indexAt(event->pos()).isValid()) { emit leftMousePressed(); } else QTreeView::mousePressEvent(event); } dc-qt-0.2.0.alpha/ui/shareitemmodel.h0000644000175000017500000000405310433640765016431 0ustar whitewhite// // C++ Interface: shareitemmodel // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #ifndef SHAREITEMMODEL_H #define SHAREITEMMODEL_H #include "global.h" #include #include using namespace std; //! Represents an item in the ShareItemModel. struct ShareItem { ShareItem() {} ShareItem(const QString& v,const QString& r,qint64 s) { virtualDir=v; realDir=r; shareSize=s; } QString virtualDir; QString realDir; qint64 shareSize; }; /** Data model for shared directories / files. @author Rikard Björklind */ class ShareItemModel : public QAbstractTableModel { Q_OBJECT public: ShareItemModel(); virtual ~ShareItemModel() {} /* * From QAbstractTableModel */ int rowCount ( const QModelIndex& ) const { return items.size()>0?items.size():1; } int columnCount ( const QModelIndex& ) const { return items.size()>0?3:1; } QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ); virtual Qt::DropActions supportedDropActions () const; /* Public interface */ void add (const ShareItem& item) { items.push_back(item); emit layoutChanged(); } void add (const QString& name,const QString& dir); const QString& getName(int row) { return items[row].virtualDir; } const QString& getDir(int row) { return items[row].realDir; } void remove (int row); void clear(); virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual QStringList mimeTypes () const; signals: void dirDropped(const QString&); private: vector items; }; #endif dc-qt-0.2.0.alpha/ui/createfavourite.ui0000644000175000017500000000670710433640765017015 0ustar whitewhite CreateFavouriteDialog 0 0 256 205 Create Favourite 9 6 0 6 Password: Name: Server: Nick: Connect automatically on startup true 0 6 Qt::Horizontal 131 31 Create Cancel cancelButton clicked() CreateFavouriteDialog reject() 205 178 127 102 dc-qt-0.2.0.alpha/ui/commandhandlersinclude.h0000644000175000017500000000051310433640765020127 0ustar whitewhite#ifndef COMMANDHANDLER_INCLUDES_H__ #define COMMANDHANDLER_INCLUDES_H__ #include #include #include #include #include "rpcdriver/rpccommandhandler.h" #include "global.h" #include "rpctypes.h" #include #include #include #include #endif dc-qt-0.2.0.alpha/ui/globalusermodel.h0000644000175000017500000000155410433640765016612 0ustar whitewhite// // C++ Interface: globalusermodel // // Description: // // // Author: Rikard Bjorklind , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #ifndef GLOBALUSERMODEL_H #define GLOBALUSERMODEL_H #include #include #include "user.h" /** Keeps a record of all users. Needed for easy access by all components who deals with users at some point. TODO: how are we going to clean this list when user objects are released in the backend? */ class GlobalUserModel : public QObject { Q_OBJECT public: GlobalUserModel(QObject *parent = 0); ~GlobalUserModel(); User* getUser(int id); public slots: void usersUpdated(int,QList); void userRemoved(int,int); void sessionInfo(int,const QString&,const QString&,const QList); private: QHash userMap; }; #endif dc-qt-0.2.0.alpha/ui/queuemodel.cpp0000644000175000017500000000623610433640765016134 0ustar whitewhite// // C++ Implementation: QueueModel // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #include "queuemodel.h" #include #include "log.h" #include "user.h" #include "util.h" QVariant QueueModel::data ( const QModelIndex & index, int role ) const { User *u; if(!index.isValid()) return QVariant(); if(index.row() < 0 || index.row() >= itemList.size()) return QVariant(); if(index.column() < 0 || index.column()>6) return QVariant(); if(role == Qt::DisplayRole) { int i = index.row(); switch(index.column()) { case 0: return itemList[i]->status ? tr("RUN") : tr("WAIT"); case 1: return itemList[i]->target; case 2: return Util::bytesToStr(itemList[i]->size); case 3: return itemList[i]->downloadedBytes; case 4: if(itemList[i]->currentSource==-1) return QVariant(); //u = sessionCfg->findUser(itemList[i]->currentSource); u = userModel->getUser( itemList[i]->currentSource); if(u) return u->nick; return itemList[i]->currentSource; case 5: return itemList[i]->priority; } } return QVariant(); } QVariant QueueModel::headerData ( int section, Qt::Orientation orientation, int role ) const { if (role != Qt::DisplayRole) return QVariant(); if(orientation==Qt::Horizontal) { if(section==0) return tr("Status"); if(section==1) return tr("Target"); if(section==2) return tr("Size"); if(section==3) return tr("Downloaded"); if(section==4) return tr("Current Source"); if(section==5) return tr("Priority"); } return QVariant(); } void QueueModel::onItemAdded( const QueueItem& item) { logger->debug("onItemAdded: %d",item.id); items[item.id] = item; itemList.append( &items[item.id] ); emit layoutChanged(); } void QueueModel::onItemsAdded( const QList< QueueItem > &ql ) { for(int i = 0;i < ql.size(); i++ ) { items[ql[i].id] = ql[i]; itemList.append( &items[ql[i].id] ); } emit layoutChanged(); } void QueueModel::onItemRemoved( int id ) { logger->debug("onItemRemoved: %d",id); itemList.removeAll(&items[id]); items.remove(id); emit layoutChanged(); } void QueueModel::onFinished( int id) { logger->debug("queueFinished: %d",id); // hmm skip this for now... } void QueueModel::onSourcesUpdated( int id, QList sources) { logger->debug("sourcesUpdated: %d",id ); items[id].sources = sources; if(sources.size()==0) { items[id].currentSource=-1; items[id].status=0; } emit layoutChanged(); } void QueueModel::onStatusUpdated(int id,int status,int currentSource,int priority) { logger->debug("statusUpdated: %id",id); items[id].status = status; items[id].currentSource = currentSource; items[id].priority = priority; int index = itemList.indexOf(&items[id],0); emit dataChanged(createIndex(index,4),createIndex(index,4)); } QueueItem * QueueModel::getItem( int row ) const throw( IndexOutOfBoundsException ) { if(row < 0 || row>= itemList.size()) throw IndexOutOfBoundsException(); return itemList[row]; } dc-qt-0.2.0.alpha/ui/userlistmodel.h0000644000175000017500000000424410433640765016324 0ustar whitewhite// // C++ Interface: UserListModel // // Description: // Defines the UserList data model // // Author: Rikard Björklind , (C) 2005.2006 // // Copyright: See COPYING file that comes with this distribution // // #ifndef USER_LIST_H__ #define USER_LIST_H__ #include #include #include #include "user.h" class UserListModel : public QAbstractTableModel { Q_OBJECT public: UserListModel() : QAbstractTableModel() { iconNormal = QIcon(":/images/user-normal.png"); iconOp= QIcon(":/images/user-normal-op.png"); iconDcpp= QIcon(":/images/user-dcpp.png"); iconDcppOp= QIcon(":/images/user-dcpp-op.png"); iconDcppPassive= QIcon(":/images/user-dcpp-passive.png"); iconPassive= QIcon(":/images/user-passive.png"); iconPassiveOp= QIcon(":/images/user-passive-op.png"); iconDcppPassiveOp= QIcon(":/images/user-dcpp-passive-op.png"); updateSignals = true; } ~UserListModel() {} // QAbstractTableModel methods... int rowCount ( const QModelIndex& ) const { //return userIndexMap.size(); return users.size(); } int columnCount ( const QModelIndex& ) const { return 3; // Nick, share, description } QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; User* getUser(const QModelIndex& i) { return users[i.row()]; } void setUser(User*); User* getUser(int userId) { return userIdMap.value(userId); } void removeUser(int userId); void sort(int col,Qt::SortOrder order = Qt::AscendingOrder); //! Used to turn of emission of the layoutchanhed signal, default true. void enableUpdateSignals(bool yes) { updateSignals=yes; } void signalLayoutChanged() { emit layoutChanged(); } protected: bool updateSignals; QHash userIdMap; QList users; QIcon iconNormal,iconOp,iconDcpp,iconDcppOp,iconDcppPassive,iconPassive,iconPassiveOp,iconDcppPassiveOp; }; #endif dc-qt-0.2.0.alpha/ui/connectdialog.cpp0000644000175000017500000000322510433640765016573 0ustar whitewhite/* * connctdialog.cpp * ui * * Created by Mikael Gransell on 4/13/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #include "connectdialog.h" #include "publichubswidget.h" #include "favouritehubswidget.h" ConnectDialog::ConnectDialog( const BackendConnectionPtr& backendConn, QWidget* parent ) : QDialog( parent ), backendConnection( backendConn ) { // Create hub lists and add them to the tab widget that we contain ui.setupUi( this ); // Remove the first tab that is automatically created by designer publicHubs = new PublicHubs( backendConn, ui.tabWidget ); ui.tabWidget->addTab( publicHubs, tr("Public Hubs") ); favouriteHubs = new FavouriteHubs( backendConn, ui.tabWidget ); ui.tabWidget->addTab( favouriteHubs, tr("Favourite Hubs") ); ui.tabWidget->removeTab(0); connect(publicHubs, SIGNAL(close()), this, SLOT(accept())); connect(favouriteHubs, SIGNAL(close()), this, SLOT(accept())); } void ConnectDialog::publicHubList( const QList& hubs ) { publicHubs->hubList(hubs); } void ConnectDialog::favouriteHubList( const QList& hubs ) { favouriteHubs->setHubs(hubs); } void ConnectDialog::favouriteHubAdded( const rpc_types::FavouriteHub& hub ) { favouriteHubs->addHub(hub); } void ConnectDialog::favouriteHubRemoved( const string& hub ) { favouriteHubs->removeHub(hub); } void ConnectDialog::getLists() { publicHubs->on_refreshButton_pressed(); favouriteHubs->refresh(); } void ConnectDialog::on_quickConnectButton_pressed() { QString addr = ui.addressEdit->text(); if( !addr.isEmpty() ) { backendConnection->createSession( addr ); } done(QDialog::Accepted); }dc-qt-0.2.0.alpha/ui/userfilemodel.cpp0000644000175000017500000001232410433640765016621 0ustar whitewhite// // C++ Implementation: UserFileModel // // Description: // // // Author: Mikael Gransell , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #include "userfilemodel.h" #include #include QVariant UserFileModel::data( const QModelIndex &index, int role ) const { QVariant ret; // If we access an item that is out of range if (!index.isValid()) return QVariant(); // Get the item this concerns TreeItem *item = static_cast(index.internalPointer()); // Check if it wants the text that should be displayed or the decorator. switch (role) { case Qt::DisplayRole: ret = item->data(index.column()); break; case Qt::DecorationRole: // only display icon for the first column if ( index.column() == 0 ) { // Get an icon from the icon provider ret = m_pIconProvider->icon( item->isDir() ? QFileIconProvider::Folder : QFileIconProvider::File ); } default: break; } return ret; } Qt::ItemFlags UserFileModel::flags( const QModelIndex &index ) const { if (!index.isValid()) return Qt::ItemIsEnabled; return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } QVariant UserFileModel::headerData( int section, Qt::Orientation orientation, int role ) const { if (role != Qt::DisplayRole) return QVariant(); if(orientation==Qt::Horizontal) { switch( section ) { case TreeItem::FILE_COLUMN: return tr("File Name"); case TreeItem::SIZE_COLUMN: return tr("Size"); case TreeItem::TTH_COLUMN: return tr("TTH"); } } return QVariant(); } QModelIndex UserFileModel::index( int row, int column, const QModelIndex &parent ) const { TreeItem *parentItem; if (!parent.isValid()) parentItem = root; else parentItem = static_cast(parent.internalPointer()); TreeItem *childItem = parentItem->child(row); if (childItem) return createIndex(row, column, childItem); else return QModelIndex(); } QModelIndex UserFileModel::parent( const QModelIndex &index ) const { if (!index.isValid()) return QModelIndex(); TreeItem *childItem = static_cast(index.internalPointer()); TreeItem *parentItem = childItem->parent(); if (parentItem == root) return QModelIndex(); return createIndex(parentItem->row(), 0, parentItem); } int UserFileModel::rowCount( const QModelIndex &parent ) const { TreeItem *parentItem; if (!parent.isValid()) parentItem = root; else parentItem = static_cast(parent.internalPointer()); return parentItem->childCount(); } int UserFileModel::columnCount(const QModelIndex &parent) const { if (parent.isValid()) return static_cast(parent.internalPointer())->columnCount(); else return root->columnCount(); } UserFileModel::TreeItem* UserFileModel::getItem( const QModelIndex& index ) const { if ( !index.isValid() ) throw std::out_of_range("Bad QModelIndex"); TreeItem *item = static_cast(index.internalPointer()); return item; } int UserFileModel::getUserId() const { return userId; } bool UserFileModel::setTree( const QString& tree ) { root = new TreeItem( "", NULL ); // Start parsing the tree.s handleSubTree( tree, root ); // Calculate the size of each node. root->calculateSize(); emit layoutChanged(); return true; } void UserFileModel::handleSubTree( const QString& tree, TreeItem* parent ) const { // Check if this is a directory int start = 0; int endDir = -1; while ( (start = tree.indexOf( '/', endDir + 1 )) != -1 ) { // Retrieve directory name QString dirName = tree.mid( endDir + 1, start - (endDir + 1) ); TreeItem* item = new TreeItem( dirName, parent ); //logger->info( "Adding directory " + dirName ); // Find end of this dir endDir = start + 1; int level = 1; while ( level ) { QChar c = tree[endDir]; // Go down a level if we find a new dir if( c == '/' ) level++; // Go up if we find the end of a dir if( c == '\\' ) level--; // Step forward endDir++; } QString dir = tree.mid( start + 1, endDir - start - 1 ); handleSubTree( dir, item ); } // Find the end of this directory int endFiles = tree.indexOf( '\\', endDir + 1 ); // Get the files string QString files = tree.mid( endDir + 1, endFiles ); //logger->info( "files: " + files ); // Split all files and go through them QStringList fileList = files.split( '*' ); for ( int i = 0; i < fileList.size(); i++ ) { addFile( fileList[i], parent ); } } void UserFileModel::addFile( const QString& file, TreeItem* parent ) const { // Split the file with sep : QStringList lst = file.split( '|' ); if ( lst.size() >= 2 ) { // Pos 1 is the file name QString name = lst[0]; // Pos 2 is the size QString size = lst[1]; // Pos 3 is TTH QString tth = lst[2]; // Create item TreeItem* item = new TreeItem( name, parent ); item->setSize( size.toLongLong() ); item->setTTH( tth ); //logger->info( "Added file: " + name + " with size: " + size + " and tth: " + tth ); } else { //logger->error( "Bad file string format: " + file ); } } dc-qt-0.2.0.alpha/ui/publichubswidget.cpp0000644000175000017500000000677210433640765017340 0ustar whitewhite/* * publichubswidget.cpp * ui * * Created by Mikael Gransell on 3/21/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #include #include "publichubswidget.h" #include "util.h" int PublicHubs::PublicHubsModel::Entry::sortCol = 0; Qt::SortOrder PublicHubs::PublicHubsModel::Entry::sortOrder = Qt::AscendingOrder; PublicHubs::PublicHubs( const BackendConnectionPtr& backendConn, QWidget* parent ) : QWidget( parent ), backendConnection(backendConn), model( new PublicHubsModel( this ) ) { ui.setupUi( this ); ui.hubList->setModel(model.get()); ui.hubList->header()->setClickable(true); ui.hubList->header()->setSortIndicatorShown(true); } void PublicHubs::hubList( const QList& hubs ) { model->setHubs( hubs ); } PublicHubs::PublicHubsModel::PublicHubsModel( QObject* parent ) : QAbstractTableModel( parent ) { } void PublicHubs::on_connectButton_pressed() { QModelIndex index = ui.hubList->selectionModel()->currentIndex(); backendConnection->createSession(model->getUrl( index.row() )); emit close(); } void PublicHubs::on_hubList_doubleClicked() { on_connectButton_pressed(); } void PublicHubs::on_refreshButton_pressed() { backendConnection->getHubList(true); } QVariant PublicHubs::PublicHubsModel::data( const QModelIndex& index, int role ) const { if(role==Qt::DisplayRole) { switch(index.column()) { case 0: return hubEntries[shownEntries[index.row()]].getData().name.c_str(); case 1: return hubEntries[shownEntries[index.row()]].getData().server.c_str(); case 2: return hubEntries[shownEntries[index.row()]].getData().description.c_str(); case 3: return hubEntries[shownEntries[index.row()]].getData().country.c_str(); case 4: return Util::bytesToStr(hubEntries[shownEntries[index.row()]].getData().minShare); case 5: return hubEntries[shownEntries[index.row()]].getData().users; } } return QVariant(); } QVariant PublicHubs::PublicHubsModel::headerData( int section, Qt::Orientation orientation, int role ) const { if( orientation==Qt::Horizontal && role==Qt::DisplayRole ) { switch(section) { case 0: return tr("Name"); case 1: return tr("Server"); case 2: return tr("Description"); case 3: return tr("Country"); case 4: return tr("MinShare"); case 5: return tr("Users"); } } return QVariant(); } const QString PublicHubs::PublicHubsModel::getUrl( int row ) const { return hubEntries[shownEntries[row]].getData().server.c_str(); } void PublicHubs::PublicHubsModel::setHubs( const QList & hubs) { if(!hubs.empty()) { hubEntries.clear(); shownEntries.clear(); QList::const_iterator it = hubs.begin(); int index = 0; while(it != hubs.end() ) { hubEntries.push_back(*it); ++it; shownEntries+=index; index++; } emit layoutChanged(); } } void PublicHubs::PublicHubsModel::sort( int col, Qt::SortOrder order ) { PublicHubs::PublicHubsModel::Entry::sortCol = col; PublicHubs::PublicHubsModel::Entry::sortOrder = order; qSort(hubEntries); applyFilter( filterPattern ); emit layoutChanged(); } void PublicHubs::PublicHubsModel::applyFilter( const QString & pattern ) { filterPattern = pattern; shownEntries.clear(); for(int i=0;i < hubEntries.size();i++) { if( QString::fromStdString(hubEntries[i].getData().name).contains(pattern,Qt::CaseInsensitive )) shownEntries+=i; } emit layoutChanged(); } void PublicHubs::on_filerEdit_textChanged( ) { model->applyFilter( ui.filerEdit->text() ); } dc-qt-0.2.0.alpha/ui/backendconnection.cpp0000644000175000017500000002004410433640765017427 0ustar whitewhite#include #include #include #include #include #include "backendconnection.h" #include "log.h" #include "searchentry.h" #include "util.h" #include using namespace std; using namespace rpc; void BackendConnection::authenticate( const QString & password ) { boost::any p = password.toStdString(); CmdPtr cmd(new anylist); cmd->push_back( string("authenticate") ); cmd->push_back(p); driver->queueCommand(-1,cmd); } void BackendConnection::createSession( const QString& u ) { boost::any url = u.toStdString(); CmdPtr cmd(new anylist); cmd->push_back( string("createSession") ); cmd->push_back(url); driver->queueCommand(-1,cmd); } void BackendConnection::sendChat(int session,const QString& msg) { CmdPtr cmd(new anylist); cmd->push_back( string("sendChat") ); cmd->push_back( session ); cmd->push_back( msg.toStdString() ); driver->queueCommand(-1,cmd); } void BackendConnection::sendSearch(int session, int64 size, int sizeMode, int typeMode, const QString& search) { CmdPtr cmd(new anylist); cmd->push_back( string("search") ); cmd->push_back( session ); cmd->push_back( search.toStdString() ); cmd->push_back( size ); cmd->push_back( sizeMode ); cmd->push_back( typeMode ); driver->queueCommand(-1,cmd); } void BackendConnection::getSharedDirs() { CmdPtr cmd(new anylist); cmd->push_back( string("getSharedDirectories") ); driver->queueCommand(-1,cmd); } void BackendConnection::addShare(const QString& name,const QString& dir) { CmdPtr cmd(new anylist); cmd->push_back( string("addShare") ); cmd->push_back(name.toStdString()); cmd->push_back(dir.toStdString()); driver->queueCommand(-1,cmd); } void BackendConnection::delShare(const QString& name) { CmdPtr cmd(new anylist); cmd->push_back( string("removeShare") ); cmd->push_back(name.toStdString()); driver->queueCommand(-1,cmd); } void BackendConnection::requestRunningSessions() { CmdPtr cmd(new anylist); cmd->push_back( string("requestRunningSessions") ); driver->queueCommand(-1,cmd); } void BackendConnection::downloadFile(const SearchEntry& file) { logger->debug("Downloading " + file.getPath() + file.getFileName()); CmdPtr cmd(new anylist); cmd->push_back( string("downloadFile") ); cmd->push_back( file.getFile() ); cmd->push_back( file.getType() == SearchEntry::DIRECTORY ? (int64)-1 : file.getFileSize() ); cmd->push_back( file.getUserId() ); cmd->push_back( string("") ); cmd->push_back( file.getTTH().toStdString() ); driver->queueCommand(-1,cmd); } void BackendConnection::downloadFile( int uId, const QString& file, int64 size, const QString& tth ) { logger->debug( "Downloading " + file ); CmdPtr cmd(new anylist); cmd->push_back( string("downloadFile") ); cmd->push_back( file.toStdString() ); cmd->push_back( size ); cmd->push_back( uId ); cmd->push_back( string("") ); cmd->push_back( tth.toStdString() ); driver->queueCommand(-1,cmd); } void BackendConnection::downloadFileTo(const SearchEntry& file, const QString& dir ) { logger->debug("Downloading " + file.getPath() + file.getFileName()); CmdPtr cmd(new anylist); cmd->push_back( string("downloadFile") ); cmd->push_back( file.getFile() ); cmd->push_back( file.getType() == SearchEntry::DIRECTORY ? -1 : file.getFileSize() ); cmd->push_back( file.getUserId() ); cmd->push_back(dir.toStdString()); cmd->push_back( file.getTTH().toStdString() ); driver->queueCommand(-1,cmd); } void BackendConnection::downloadFileTo( int uId, const QString& file, int64 size, const QString& tth, const QString& dir ) { logger->debug( "Downloading " + file + " to " + dir ); CmdPtr cmd(new anylist); cmd->push_back( string("downloadFile") ); cmd->push_back( file.toStdString() ); cmd->push_back( size ); cmd->push_back( uId ); cmd->push_back( dir.toStdString() ); cmd->push_back( tth.toStdString() ); driver->queueCommand(-1,cmd); } void BackendConnection::getUserFileList( int userId ) { logger->debug( "Requesting file list for user with id:" + QString::number(userId) ); CmdPtr cmd(new anylist); cmd->push_back( string("getUserFileList") ); cmd->push_back( userId ); driver->queueCommand(-1,cmd); } void BackendConnection::tellBackendToDie() { CmdPtr cmd(new anylist); cmd->push_back( string("die") ); driver->queueCommand(-1,cmd); } void BackendConnection::getHubList( bool refresh ) { CmdPtr cmd(new anylist); cmd->push_back( string("getHubList") ); cmd->push_back( refresh ); driver->queueCommand(-1,cmd); } void BackendConnection::getFavouriteHubs( ) { CmdPtr cmd(new anylist); cmd->push_back( string("getFavouriteHubs") ); driver->queueCommand(-1,cmd); } void BackendConnection::addFavouriteHub( const rpc_types::FavouriteHub &e ) { CmdPtr cmd(new anylist); cmd->push_back( string("addFavouriteHub") ); cmd->push_back( e.nick ); cmd->push_back( e.userDescription ); cmd->push_back( e.name ); cmd->push_back( e.server ); cmd->push_back( e.description ); cmd->push_back( e.password ); cmd->push_back( e.autoConnect ); driver->queueCommand(-1,cmd); } void BackendConnection::removeFavouriteHub( const QString &server ) { CmdPtr cmd(new anylist); cmd->push_back( string("removeFavouriteHub") ); cmd->push_back( server.toStdString() ); driver->queueCommand(-1,cmd); } void BackendConnection::closeSession( int session ) { CmdPtr cmd(new anylist); cmd->push_back( string("closeSession") ); cmd->push_back( session ); driver->queueCommand(-1,cmd); } void BackendConnection::getSettings( QList keys ) { CmdPtr cmd(new anylist); cmd->push_back( string("getSettings") ); // convert the qlist to an anylist anylist k; for(int i=0;ipush_back(k); driver->queueCommand(-1,cmd); } void BackendConnection::setSettings(QList > settings) { CmdPtr cmd(new anylist); cmd->push_back( string("setSettings") ); anylist keys,values; for(int i=0;ipush_back(keys); cmd->push_back(values); driver->queueCommand(-1,cmd); } void BackendConnection::sendPassword( int session, const QString& pass ) { CmdPtr cmd(new anylist); cmd->push_back( string("sendPassword") ); cmd->push_back( session ); cmd->push_back( pass.toStdString() ); driver->queueCommand(-1,cmd); } void BackendConnection::removeQueueItem( int id ) { logger->info(QString("Removing QueueItem with id %1").arg(id)); CmdPtr cmd(new anylist); cmd->push_back( string("removeQueueItem") ); cmd->push_back( id ); driver->queueCommand(-1,cmd); } void BackendConnection::forceConnectionAttempt( int userId ) { logger->info(QString("Forcing attempt on user with id %1").arg(userId)); CmdPtr cmd(new anylist); cmd->push_back( string("connectToUser") ); cmd->push_back( userId ); driver->queueCommand(-1,cmd); } void BackendConnection::die( ) { logger->info("BackendConnection::die()"); CmdPtr cmd(new anylist); cmd->push_back( string("die") ); driver->queueCommand(-1,cmd); } BackendConnection::~ BackendConnection( ) { logger->info("Destructing backendconnection"); } void BackendConnection::removeSource( int qid, int uid ) { logger->debug("BackendConnection::removeSource: " + QString::number( qid ) + ", " + QString::number( uid )); CmdPtr cmd(new anylist); cmd->push_back( string("removeSource") ); cmd->push_back( qid ); cmd->push_back( uid ); driver->queueCommand(-1,cmd); } dc-qt-0.2.0.alpha/ui/session.h0000644000175000017500000000260110433640765015107 0ustar whitewhite// // C++ Interface: session // // Description: // // // Author: Rikard Bjorklind , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #ifndef SESSION_H #define SESSION_H #include #include #include "ui_hub.h" class QMennu; class UserListModel; class User; /** Holds the session ui. @author Rikard Bjorklind */ class Session : public QWidget { Q_OBJECT public: Session(int aId, QWidget *parent = 0); ~Session(); int getId() {return myId;} qint64 getTotalShared() {return shared;} public slots: void onFailed(const QString&); void onPrivateChatMessage(const QString& from,const QString& msg); void onUsersUpdated(QList users); void onChatMessage(const QString&); void onUserRemoved(int id); void onHubStats(qint64 totshared); void onGetFileList(); void onOpenChat() {} void onAddFav() {} // Auto-slots void on_chatEdit_returnPressed(); void on_userView_doubleClicked( const QModelIndex& index); void on_userView_customContextMenuRequested( const QPoint& pos ); private: void createMenu(); void getFileList( const QModelIndex& index ); Ui::HubForm ui; UserListModel* userModel; boost::shared_ptr contextMenu; int myId; qint64 shared; signals: void sendChat(int,const QString&); void getUserFileList(int); }; #endif dc-qt-0.2.0.alpha/ui/main.cpp0000644000175000017500000000222510433640765014705 0ustar whitewhite#include "mainwindow.h" #include "filelog.h" #include "rpcdriver/rpcdriver.h" #include #include #include #include #include namespace opt = boost::program_options; using std::string; Log* logger = new FileLog; int main(int argc, char *argv[]) { opt::options_description desc("Allowed options"); desc.add_options() ("help", "Display help message") ("addr", opt::value()->default_value("localhost"), "Address to connect to") ("port", opt::value()->default_value(6161), "Specify port"); opt::variables_map vm; try { opt::store(opt::parse_command_line(argc, argv, desc), vm); } catch( const opt::unknown_option& e ) { std::cerr << "Invalid option " << e.what() << std::endl; } if(vm.count("help")) { std::cout << desc << std::endl; return 1; } QApplication app(argc, argv); MainWindow *mw = new MainWindow; mw->show(); //mw->connectToBackend(vm["addr"].as().c_str(), port); // TODO use the above function instead if parameters was actually given -> overrides settings. mw->connectToBackend(); return app.exec(); } dc-qt-0.2.0.alpha/ui/searchdock.ui0000644000175000017500000000260210433640765015721 0ustar whitewhite Form 0 0 400 300 Form 9 6 9 6 Tab 1 Tab 2 dc-qt-0.2.0.alpha/ui/userfilelisting.ui0000644000175000017500000000346210433640765017030 0ustar whitewhite UserFileDialog 0 0 621 318 Qt::CustomContextMenu Dialog 9 6 Qt::CustomContextMenu QAbstractItemView::ExtendedSelection Search 9 6 Find Next dc-qt-0.2.0.alpha/ui/finishedmodel.cpp0000644000175000017500000000376310433640765016603 0ustar whitewhite// // C++ Implementation: FinishedModel // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #include "finishedmodel.h" #include #include "log.h" QVariant FinishedModel::data ( const QModelIndex & index, int role ) const { if(!index.isValid()) return QVariant(); if(index.row() < 0 || index.row() >= itemList.size()) return QVariant(); if(index.column() < 0 || index.column()>4) return QVariant(); if(role == Qt::DisplayRole) { int i = index.row(); switch(index.column()) { case 0: return itemList[i]->type==0?tr("Upload"):tr("Download"); case 1: return itemList[i]->target; case 2: return itemList[i]->user; case 3: return itemList[i]->hub; } } return QVariant(); } QVariant FinishedModel::headerData ( int section, Qt::Orientation orientation, int role ) const { if (role != Qt::DisplayRole) return QVariant(); if(orientation==Qt::Horizontal) { if(section==0) return tr("Type"); if(section==1) return tr("Target"); if(section==2) return tr("User"); if(section==3) return tr("Hub"); } return QVariant(); } void FinishedModel::onItemAdded( const FinishedItem& item) { logger->debug("FinishedModel::onItemAdded: %d",item.id); items[item.id] = item; itemList.append( &items[item.id] ); emit layoutChanged(); } void FinishedModel::onItemRemoved( int id ) { logger->debug("FinishedModel::onItemRemoved: %d",id); itemList.removeAll(&items[id]); items.remove(id); emit layoutChanged(); } void FinishedModel::onAllRemoved(int type) { logger->debug("FinishedModel::onAllRemoved: %d",type); QList::iterator it = itemList.begin(); while(it != itemList.end()) { FinishedItem *fi = *it; if(fi->type == type) { it = itemList.erase(it); items.remove(fi->id); } else it++; } } dc-qt-0.2.0.alpha/ui/queuemodel.h0000644000175000017500000000251510433640765015575 0ustar whitewhite#ifndef QUEUE_MODEL_H__ #define QUEUE_MODEL_H__ #include "global.h" #include "filetransfer.h" #include "exceptions.h" #include #include #include "queueitem.h" #include "globalusermodel.h" #include //! Transfer queue data model. class QueueModel : public QAbstractTableModel { Q_OBJECT public: QueueModel( boost::shared_ptr aUserModel ) throw() : userModel(aUserModel) {} virtual ~QueueModel() throw() {} int rowCount ( const QModelIndex& ) const {return itemList.size();} int columnCount ( const QModelIndex& ) const {return 6;} QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; QueueItem* getItem(int row) const throw(IndexOutOfBoundsException); public slots: void onItemAdded( const QueueItem& ); void onItemsAdded( const QList& ); void onItemRemoved( int ); void onFinished( int ); void onSourcesUpdated( int, QList ); void onStatusUpdated(int,int,int,int); private: QMap items; QList itemList; boost::shared_ptr userModel; }; #endif dc-qt-0.2.0.alpha/ui/searchwidget.cpp0000644000175000017500000001210310433640765016426 0ustar whitewhite// // C++ Implementation: searchwidget // // Description: // // // Author: Rikard Bjorklind , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include "searchwidget.h" #include "../backend/CommonTypes.h" #include "log.h" #include #include SearchWidget::SearchWidget(QWidget *parent) : QWidget(parent) { ui.setupUi(this); ui.searchView->setModel(&model); ui.searchView->header()->setClickable(true); ui.searchView->header()->setSortIndicatorShown(true); ui.searchView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui.searchView,SIGNAL(customContextMenuRequested ( const QPoint&)),SLOT(onContextMenu(const QPoint&))); contextMenu = new QMenu(this); /*QAction* dlAction = */contextMenu->addAction(QIcon(":/images/download.png"), tr("Download"),this,SLOT(onContextDownload())); /*QAction* dltoAction = */contextMenu->addAction(QIcon(":/images/downloadto.png"), tr("Download to..."),this,SLOT(onContextDownloadTo())); /*QAction* dldirAction = */contextMenu->addAction(QIcon(":/images/dldir.png"), tr("Download whole directory"),this,SLOT(onContextDownloadDir() )); /*QAction* dldirtoAction = */contextMenu->addAction(QIcon(":/images/dldirto.png"), tr("Download directory to..."),this,SLOT(onContextDownloadDirTo() )); /*QAction* tthSearchAction = */contextMenu->addAction(QIcon(":/images/tthsearch.png"), tr("Search for alternates" ),this, SLOT(onContextTTHSearch())); /*QAction* getFileListAction = */contextMenu->addAction(QIcon(":/images/filelist.png"), tr("Get file list" ), this, SLOT(onContextGetFileList())); } SearchWidget::~SearchWidget() { logger->debug("SearchWidget dtor"); } void SearchWidget::on_searchButton_pressed( ) { qint64 size = ui.sizeSpin->value(); switch(ui.sizeTypeCombo->currentIndex()) { case 3: // gib size*=1024; case 2: //mb size*=1024; case 1: size*=1024; default: ; } int sizemode = ui.sizeModeCombo->currentIndex()==0 ? backend::SIZE_ATLEAST : backend::SIZE_ATMOST; int typemode = ui.typeCombo->currentIndex(); logger->info(QString("emitting search with size: %1 sizemode: %2 typemode: %3 text: %4"). arg(size).arg(sizemode).arg(typemode).arg(ui.searchCombo->currentText())); model.clear(); emit search(0,size,sizemode,typemode,ui.searchCombo->currentText(),this); } void SearchWidget::on_searchCombo_activated( const QString &) { on_searchButton_pressed(); } void SearchWidget::searchResults( int session, const QList< SearchEntry > sr) { model.onSearchResult( session, sr ); } void SearchWidget::on_searchView_doubleClicked( const QModelIndex &index ) { download(index); } void SearchWidget::download( const QModelIndex &index ) { try { if (index.isValid()) { SearchEntry entry = model.getEntry( index.row() ); logger->debug( "Downloading file:" + entry.getFileName() ); emit downloadFile( entry ); } else logger->error("SearchWidget::download() : index.isValid() == false \n"); } catch(const std::out_of_range& e) { logger->error("SearchWidget::download() : out_of_range exception\n"); } } void SearchWidget::downloadTo( const QModelIndex &index ) { if(!index.isValid()) return; SearchEntry entry = model.getEntry(index.row()); QString dir = QFileDialog::getExistingDirectory ( this, tr("Select destination directory"), QString()); if(!dir.isEmpty()) emit downloadFileTo(entry, dir); } void SearchWidget::onContextMenu( const QPoint &p ) { if( ui.searchView->indexAt(p).isValid() ) { contextMenu->exec(QCursor::pos()); } } void SearchWidget::onContextDownload( ) { download( ui.searchView->currentIndex() ); } void SearchWidget::onContextDownloadTo( ) { downloadTo( ui.searchView->currentIndex() ); } void SearchWidget::onContextDownloadDir( ) { QModelIndex index = ui.searchView->currentIndex(); SearchEntry entry = model.getEntry( index.row() ); emit downloadFile( entry.getUserId(), entry.getPath(), -1, QString() ); } void SearchWidget::onContextDownloadDirTo( ) { QModelIndex index = ui.searchView->currentIndex(); SearchEntry entry = model.getEntry( index.row() ); QString dir = QFileDialog::getExistingDirectory ( this, tr("Select destination directory"), QString()); if(!dir.isEmpty()) emit downloadFileTo(entry.getUserId(), entry.getPath(), -1, QString(), dir); } void SearchWidget::onContextTTHSearch( ) { QModelIndex index = ui.searchView->currentIndex(); SearchEntry entry = model.getEntry( index.row() ); if(!entry.getTTH().isEmpty()) emit search(0,entry.getFileSize(),backend::SIZE_ATLEAST,backend::TYPE_TTH,entry.getTTH(),NULL); else emit search(0,entry.getFileSize(),backend::SIZE_ATLEAST,backend::TYPE_ANY,entry.getFileName(),NULL); } void SearchWidget::onContextGetFileList( ) { QModelIndex index = ui.searchView->currentIndex(); SearchEntry entry = model.getEntry( index.row() ); emit getUserFileList( entry.getUserId() ); } void SearchWidget::on_hideZeroSlots_stateChanged( int state ) { model.enableFilter( state == Qt::Checked ); } dc-qt-0.2.0.alpha/ui/global.h0000644000175000017500000000030310433640765014661 0ustar whitewhite#ifndef GLOBAL_H__ #define GLOBAL_H__ #include #include #include //typedef qint64 int64; //#define int64 qint64 typedef std::list anylist; #endif dc-qt-0.2.0.alpha/ui/createfavouritedialog.cpp0000644000175000017500000000157610433640765020341 0ustar whitewhite/* * createfavouritedialog.cpp * ui * * Created by Mikael Gransell on 4/18/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #include "createfavouritedialog.h" #include "rpctypes.h" CreateFavouriteDialog::CreateFavouriteDialog( const BackendConnectionPtr& backendConn, QWidget* parent ) : QDialog(parent), backendConnection(backendConn) { ui.setupUi(this); } void CreateFavouriteDialog::on_createButton_clicked() { rpc_types::FavouriteHub hubEntry; hubEntry.name = ui.nameEdit->text().toStdString(); hubEntry.server = ui.serverEdit->text().toStdString(); hubEntry.nick = ui.nickEdit->text().toStdString(); hubEntry.password = ui.pwdEdit->text().toStdString(); hubEntry.autoConnect = ui.autoConnectCheckBox->isChecked(); // Add the favourite and close the dialog backendConnection->addFavouriteHub(hubEntry); done(QDialog::Accepted); }dc-qt-0.2.0.alpha/ui/settingsdialog.cpp0000644000175000017500000001644310433640765017010 0ustar whitewhite// // C++ Implementation: settingsdialog // // Description: // // // Author: Rikard Bjorklind , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include "settingsdialog.h" #include "shareitemmodel.h" #include "log.h" #include SettingsDialog::SettingsDialog(boost::shared_ptr aBackendConnection,QWidget *parent) : QDialog(parent),backendConnection(aBackendConnection) { ui.setupUi(this); // Create the shareitem model for the shared dir treeview. shareItemModel = new ShareItemModel; ui.sharedView->setModel(shareItemModel); ui.sharedView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui.sharedView,SIGNAL(customContextMenuRequested ( const QPoint&)),SLOT(onContextMenu(const QPoint&))); connect(shareItemModel,SIGNAL(dirDropped( const QString& )),SLOT(onDirDropped( const QString&))); // Init local settings QSettings settings("dc-qt.sf.net","dcqt"); BackendConnectionType backendConnectionType = (BackendConnectionType)settings.value("bctype",(int)USE_LOCAL_BACKEND).toInt(); QString backendConnectionURL = settings.value("bcurl","localhost").toString(); int localPort = settings.value("bclocalport",6161).toInt(); int remotePort = settings.value("bcremoteport",6161).toInt(); srand(time(NULL)); QString defaultPassword = QString::number(rand() % 100000 + 100000); QString password = settings.value("bcpassword",defaultPassword).toString(); // Set the loaded settings in the gui ui.localBackendPort->setValue(localPort); ui.remoteBackendPort->setValue(remotePort); ui.remoteBackendURL->setText(backendConnectionURL); ui.passwordEdit->setText(password); // Preselect the radio button if(backendConnectionType==USE_LOCAL_BACKEND) ui.localBackendRadio->setChecked(true); else ui.remoteBackendRadio->setChecked(true); connect(ui.sharedView,SIGNAL(leftMousePressed()),SLOT(onLeftMouse())); contextMenu = new QMenu(this); /*QAction* removeAction = */contextMenu->addAction( tr("Remove") ); } SettingsDialog::~SettingsDialog() { } QList< QString > SettingsDialog::getRequiredSettings( ) { QList settings; settings += "NICK"; settings += "DESCRIPTION"; settings += "EMAIL"; settings += "CONNECTION_TYPE"; settings += "SERVER"; settings += "IN_PORT"; settings += "UDP_PORT"; settings += "DOWNLOAD_DIRECTORY"; settings += "TEMP_DOWNLOAD_DIRECTORY"; return settings; } void SettingsDialog::settingsInfo(const QList& keys,const QList& values) { QListIterator ki(keys); QListIterator vi(values); while(ki.hasNext()) { const QString key = ki.next(); const QVariant value = vi.next(); if(key=="NICK") ui.nickEdit->setText( value.toString() ); else if(key=="DESCRIPTION") ui.descriptionEdit->setText( value.toString() ); else if(key=="EMAIL") ui.emailEdit->setText( value.toString() ); else if(key=="CONNECTION_TYPE") ui.activeCheck->setChecked( value.toInt()==0 ); else if(key=="SERVER") ui.ipEdit->setText(value.toString()); else if(key=="IN_PORT") ui.tcpEdit->setText(QString::number(value.toInt())); else if(key=="UDP_PORT") ui.udpEdit->setText(QString::number(value.toInt())); else if(key=="DOWNLOAD_DIRECTORY") ui.finisheddirEdit->setText(value.toString()); else if(key=="TEMP_DOWNLOAD_DIRECTORY") ui.dldirEdit->setText(value.toString()); } } void SettingsDialog::showEvent(QShowEvent*) { backendConnection->getSettings(getRequiredSettings()); backendConnection->getSharedDirs(); } void SettingsDialog::on_okButton_pressed() { bool ok1,ok2; int tcpport = ui.tcpEdit->text().toInt(&ok1); int udpport = ui.udpEdit->text().toInt(&ok2); if(!ok1) { QMessageBox::critical(this,tr("Settings Error"),tr("TCP port must be a number")); return; } if(!ok2) { QMessageBox::critical(this,tr("Settings Error"),tr("UDP port must be a number")); return; } QList > settings; settings += QPair("NICK",ui.nickEdit->text()); settings += QPair("DESCRIPTION",ui.descriptionEdit->text()); settings += QPair("EMAIL",ui.emailEdit->text()); settings += QPair("CONNECTION_TYPE",ui.activeCheck->isChecked()?0:1); settings += QPair("SERVER",ui.ipEdit->text()); settings += QPair("IN_PORT",tcpport); settings += QPair("UDP_PORT",udpport); settings += QPair("DOWNLOAD_DIRECTORY",ui.finisheddirEdit->text()); settings += QPair("TEMP_DOWNLOAD_DIRECTORY",ui.dldirEdit->text()); backendConnection->setSettings(settings); // Save local settings QSettings ls("dc-qt.sf.net","dcqt"); ls.setValue("bctype", ui.localBackendRadio->isChecked() ? USE_LOCAL_BACKEND : USE_REMOTE_BACKEND); ls.setValue("bcurl", ui.remoteBackendURL->text()); ls.setValue("bclocalport", ui.localBackendPort->value()); ls.setValue("bcremoteport", ui.remoteBackendPort->value()); ls.setValue("bcpassword", ui.passwordEdit->text()); accept(); } void SettingsDialog::on_dldirButton_pressed() { // TODO //if( BackendConnection::instance()->isConnectionLocal()) // { QString dir = QFileDialog::getExistingDirectory(this,tr("Choose incomplete directory"), QDir::homePath()); if(dir!=QString::null && !dir.isEmpty()) ui.dldirEdit->setText(dir); // } // else // QMessageBox::information(this,tr("Problematic request"),tr("You cannot browse when connected to a remote backend."),tr("Ok")); } void SettingsDialog::on_finisheddirButton_pressed() { // TODO //if( BackendConnection::instance()->isConnectionLocal()) // { // logger->info(findirEdit->text()); QString dir = QFileDialog::getExistingDirectory(this,tr("Choose finished directory"), QDir::homePath()); if(dir!=QString::null && !dir.isEmpty()) ui.finisheddirEdit->setText(dir); // } // else // QMessageBox::information(this,tr("Problematic request"),tr("You cannot browse when connected to a remote backend."),tr("Ok")); } void SettingsDialog::sharedDirs( const QList dirs) { shareItemModel->clear(); for(int i=0;iadd( dirs[i] ); } /* void SettingsDialog::on_removeShareButton_pressed( ) { QModelIndex current = ui.sharedView->currentIndex(); QString name = shareItemModel->getDir(current.row()); backendConnection->delShare(name); shareItemModel->remove(current.row()); } */ void SettingsDialog::onDirDropped( const QString &dir ) { QString name = QInputDialog::getText(0,tr("Enter name for share"), "Enter a name for the share " + dir); if(!name.isEmpty() && !name.isNull()) { backendConnection->addShare(name,dir); shareItemModel->add(name,dir); } } void SettingsDialog::onLeftMouse( ) { QString vName = QInputDialog::getText(this,tr("Enter name"),tr("Enter a name for this share")); if(!vName.isEmpty()) { QString dir = QFileDialog::getExistingDirectory(this,tr("Choose a directory")); if(!dir.isEmpty()) { backendConnection->addShare(vName,dir); shareItemModel->add(vName,dir); } } } void SettingsDialog::onContextMenu( const QPoint & ) { QAction* a = contextMenu->exec(QCursor::pos()); if(a) { QModelIndex current = ui.sharedView->currentIndex(); QString name = shareItemModel->getDir(current.row()); backendConnection->delShare(name); shareItemModel->remove(current.row()); } } dc-qt-0.2.0.alpha/ui/shareitemmodel.cpp0000644000175000017500000000576610433640765017000 0ustar whitewhite// // C++ Implementation: shareitemmodel // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #include "shareitemmodel.h" #include #include "log.h" ShareItemModel::ShareItemModel() { } QVariant ShareItemModel::data ( const QModelIndex & index, int role ) const { if(!index.isValid()) return QVariant(); // Special case if(role == Qt::DisplayRole && items.size()==0) return tr("Click or drag to add directories"); if(role == Qt::TextColorRole && items.size()==0) return QColor(100,100,100,255); if(role == Qt::TextAlignmentRole && items.size()==0) return Qt::AlignCenter; if(index.row() < 0 || index.row() >= items.size()) return QVariant(); if(index.column() < 0 || index.column()>2) return QVariant(); if(role == Qt::DisplayRole) { switch(index.column()) { case 0: return items[index.row()].virtualDir; case 1: return items[index.row()].realDir; case 2: if(items[index.row()].shareSize==-1) return "pending"; return items[index.row()].shareSize; } } return QVariant(); } QVariant ShareItemModel::headerData ( int section, Qt::Orientation orientation, int role ) const { if (role != Qt::DisplayRole) return QVariant(); if(items.size()==0) return QVariant(); if(orientation==Qt::Horizontal) { if(section==0) return "Name"; if(section==1) return "Directory"; if(section==2) return "Size"; } return QVariant(); } void ShareItemModel::add(const QString& name,const QString& dir) { items.push_back(ShareItem(name,dir,-1)); emit layoutChanged(); } void ShareItemModel::remove(int row) { vector::iterator it = items.begin(); while(row--) it++; items.erase(it); emit layoutChanged(); } void ShareItemModel::clear( ) { items.clear(); } bool ShareItemModel::dropMimeData( const QMimeData * data, Qt::DropAction /*action*/, int /*row*/, int /*column*/, const QModelIndex & /*parent*/ ) { if(data->hasUrls()) { QList urls = data->urls(); for(int i =0;i < urls.size();i++) { QString url = urls[i].toLocalFile(); if(!url.isEmpty()) { // Obtain a name for this url //QString name = QInputDialog::getText(0,"Enter a name", "Enter a name for " + url); //if(!name.isEmpty() && !name.isNull()) // add(name,url); emit dirDropped(url); } } } return true; } Qt::DropActions ShareItemModel::supportedDropActions( ) const { return Qt::ActionMask; } Qt::ItemFlags ShareItemModel::flags(const QModelIndex &index) const { Qt::ItemFlags defaultFlags = QAbstractTableModel::flags(index); if (index.isValid()) return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags; else return Qt::ItemIsDropEnabled | defaultFlags; } QStringList ShareItemModel::mimeTypes( ) const { QStringList sl; sl+="text/uri-list"; return sl; } dc-qt-0.2.0.alpha/ui/userfiledialog.cpp0000644000175000017500000000767510433640765016775 0ustar whitewhite/* * userfiledialog.cpp * ui * * Created by Mikael Gransell on 4/26/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #include "log.h" #include "userfiledialog.h" #include "globalusermodel.h" UserFileDialog::UserFileDialog( const UserFileModelPtr& mdl, BackendConnectionPtr backendConn, boost::shared_ptr userModel, QWidget* parent ) : QDialog(parent), contextMenu(new QMenu(this)), backendConnection(backendConn), model( mdl ) { ui.setupUi(this); ui.treeView->setModel( model.get() ); setWindowTitle(userModel->getUser(model->getUserId())->nick); createMenu(); } void UserFileDialog::on_treeView_customContextMenuRequested( const QPoint& pos ) { // Show the menu contextMenu->popup( ui.treeView->mapToGlobal(pos) ); } void UserFileDialog::on_treeView_doubleClicked() { logger->debug( "Double click download" ); // Try to get all the selected indexes and issue a download for each one. QModelIndexList selected = ui.treeView->selectionModel()->selectedIndexes(); for( int i = 0; i < selected.size() - 1; i++ ) { QModelIndex index = selected[i]; if( !model->getItem(index)->isDir() ) { download( index ); } } } void UserFileDialog::onDownload() { logger->debug( "Download triggered" ); // Try to get all the selected indexes and issue a download for each one. QModelIndexList selected = ui.treeView->selectionModel()->selectedIndexes(); for( int i = 0; i < selected.size() - 1; i++ ) { download( selected[i] ); } } void UserFileDialog::onDownloadTo() { logger->debug( "DownloadTo triggered" ); QString dir = QFileDialog::getExistingDirectory( this, tr("Choose a download directory") ); if( !dir.isEmpty() ){ dir += "/"; // Try to get all the selected indexes and issue a download for each one. QModelIndexList selected = ui.treeView->selectionModel()->selectedIndexes(); for( int i = 0; i < selected.size() - 1; i++ ) { downloadTo( selected[i], dir ); } } } void UserFileDialog::download( const QModelIndex& index ) { try { // Throws std::out_of_range UserFileModel::TreeItem* item = model->getItem( index ); if ( item ) { QString file = formatFileName( item ); int64 size = item->isDir() ? -1 : item->getSize(); QString tth = item->getTTH(); logger->debug( "Downloading: " + file + " with size " + QString::number(size) + " and tth:" + tth ); backendConnection->downloadFile( model->getUserId(), file, size, tth ); } } catch(const std::out_of_range& e) { logger->error("Bad index when trying to download file\n"); } } void UserFileDialog::downloadTo( const QModelIndex& index, const QString& path ) { try { // Throws std::out_of_range UserFileModel::TreeItem* item = model->getItem( index ); if ( item ) { QString file = formatFileName( item ); int64 size = item->isDir() ? -1 : item->getSize(); QString tth = item->getTTH(); logger->debug( "Downloading: " + file + " with size " + QString::number(size) + " and tth:" + tth + " to " + path ); backendConnection->downloadFileTo( model->getUserId(), file, size, tth, path ); } } catch(const std::out_of_range& e) { logger->error("Bad index when trying to download file\n"); } } QString UserFileDialog::formatFileName( const UserFileModel::TreeItem* item ) const { QString file = item->getFullName(); // Strip the first part of the path since this is the user name file = file.section( '/', 2 ); // If this is a directory we need to add the final / if ( item->isDir() ) { file += '/'; } return file; } void UserFileDialog::createMenu() { QAction* downloadAct = contextMenu->addAction( tr("Download") ); connect(downloadAct, SIGNAL(triggered()), this, SLOT(onDownload())); QAction* downloadToAct = contextMenu->addAction( tr("Download to...") ); connect(downloadToAct, SIGNAL(triggered()), this, SLOT(onDownloadTo())); } dc-qt-0.2.0.alpha/ui/searchwidget.h0000644000175000017500000000312310433640765016075 0ustar whitewhite#ifndef SEARCHWIDGET_H #define SEARCHWIDGET_H #include #include "ui_search.h" #include "searchtablemodel.h" #include /** Contains the search widget. Implements associated operations @author Rikard Bjorklind */ class SearchWidget : public QWidget { Q_OBJECT public: SearchWidget(QWidget *parent = 0); ~SearchWidget(); //bool isEmpty() { return model.isEmpty(); } public slots: //! Called on arriving results void searchResults(int,const QList); private: Ui::searchForm ui; SearchTableModel model; QMenu *contextMenu; private slots: void on_searchButton_pressed(); void on_searchCombo_activated(const QString&); void on_searchView_doubleClicked(const QModelIndex&); void on_hideZeroSlots_stateChanged(int); //! Downloads a file given a search result index. void download(const QModelIndex&); void downloadTo(const QModelIndex&); void onContextMenu(const QPoint&); void onContextDownload(); void onContextDownloadTo(); void onContextDownloadDir(); void onContextDownloadDirTo(); void onContextTTHSearch(); void onContextGetFileList(); signals: void search(int session, qint64 size, int sizeMode, int typeMode, const QString& search, SearchWidget* originator); void downloadFile( const SearchEntry& ); void downloadFile( int uId, const QString& file, int64 size, const QString& tth ); void downloadFileTo( const SearchEntry&, const QString& ); void downloadFileTo( int uId, const QString& file, int64 size, const QString& tth, const QString& dir ); void getUserFileList(int); }; #endif dc-qt-0.2.0.alpha/ui/connectdialog.ui0000644000175000017500000000276210433640765016433 0ustar whitewhite connectDialog 0 0 923 558 Connect 9 6 Tab 1 Quick Connect 9 6 Connect dc-qt-0.2.0.alpha/ui/searchentry.h0000644000175000017500000001074110433640765015757 0ustar whitewhite #ifndef _SEARCHRESULT_H_ #define _SEARCHRESULT_H_ #include "global.h" #include "log.h" #include #include #include class SearchEntry { public: SearchEntry(const std::string &file_as_in_dcpp, const QString& n, const QString& hName, int uId, int64 fSize, int uSlots, int fSlots, int t, const QString& tthIn, bool isFileStringUTF8 = false) : file( file_as_in_dcpp ), nick( n ), hubName( hName ), userId( uId ), fileSize( fSize ), userSlots( uSlots ), freeSlots( fSlots ), type( static_cast( t ) ), tth( tthIn ), isUTF8( isFileStringUTF8 ), fileName(""), filePath("") { QTextCodec *codec; if (isUTF8) codec = QTextCodec::codecForName("utf-8"); else codec = QTextCodec::codecForName("Windows-1252"); // if can't find matching codec, fall back on default codec for C-strings if (!codec) codec = QTextCodec::codecForCStrings(); QString fstr = codec->toUnicode( file.c_str() ); // Check if this is a directory or a file. if( type == DIRECTORY ) { // Get the second last section, i.e. the part before the last '\' fileName = fstr.section( '\\', -2 ); } else { // Get the last part of the path fileName = fstr.section('\\', -1); } filePath = fstr.left( fstr.lastIndexOf( fileName ) ); logger->debug("SearchEntry() : file is \"%s\", fileName is \"%s\"", file.c_str(), fileName.toLatin1().constData()); } virtual ~SearchEntry(){} enum eType { FILE, DIRECTORY }; /*! Returns full path + filename string, in original encoding from dc++ */ const std::string &getFile() const { return file; } /*! Returns unicode file name without path, only for use in the GUI */ const QString& getFileName() const { return fileName; } /*! Returns unicode file path without file name, only for use in the GUI */ const QString& getPath() const { return filePath; } /** */ const QString& getNick() const { return nick; } /** */ const QString& getHubName() const { return hubName; } /** */ int getUserId() const { return userId; } /** */ int64 getFileSize() const { return fileSize; } /** */ int getUserSlots() const { return userSlots; } /** */ int getFreeSlots() const { return freeSlots; } /** */ eType getType() const { return type; } /** */ const QString& getTTH() const { return tth; } /** Returns true if the string returned by getFile() has utf-8 encoding */ bool getUTF8() const { return isUTF8; } /** */ void setFileName( const QString& name ) { fileName = name; } /** */ void setFileName( const std::string& name ) { fileName = name.c_str(); } /** */ void setNick( const QString& n ) { nick = n; } /** */ void setNick( const std::string& n ) { nick = n.c_str(); } /** */ void setHubName( const QString& name ) { hubName = name; } /** */ void setHubName( const std::string& name ) { hubName = name.c_str(); } /** */ void setFileSize( int64 s ) { fileSize = s; } /** */ void setUserSlots( int u ) { userSlots = u; } /** */ void setFreeSlots( int f ) { freeSlots = f; } /** */ void setType( eType t ) { type = t; } // SearchEntry& operator=(const SearchEntry& rhs) // { // if( this == &rhs ) // return *this; // // // // return *this; // } static int sortElement; //!< Defines the element to sort on. UGLY SHITCODE. enum {SORT_FILENAME, SORT_USER, SORT_SIZE, SORT_PATH, SORT_SLOTS, SORT_HUBNAME, SORT_TYPE, SORT_TTH}; bool operator < (const SearchEntry& s) const { switch(sortElement) { case SORT_FILENAME: if(type != s.type) return s.type < type; return fileName < s.fileName; case SORT_USER: return nick < s.nick; case SORT_SIZE: return fileSize < s.fileSize; case SORT_PATH: return filePath < s.filePath; case SORT_SLOTS: return freeSlots < s.freeSlots; case SORT_HUBNAME: return hubName < s.hubName; case SORT_TYPE: return type < s.type; case SORT_TTH: return tth < s.tth; } return false; } private: /** Unmodified full path + filename string, as received from dc++ */ std::string file; /** */ QString nick; /** */ QString hubName; /** */ int userId; /** */ int64 fileSize; /** */ int userSlots; /** */ int freeSlots; /** */ eType type; /** */ QString tth; /** True if the file string is originally encoded with utf-8 */ bool isUTF8; /// Name of the file QString fileName; /// Path to the file on the remote users share QString filePath; }; #endif dc-qt-0.2.0.alpha/ui/publichublist.ui0000644000175000017500000000277310433640765016475 0ustar whitewhite PublicHubForm 0 0 749 534 Form 9 6 0 6 Filter: Connect Refresh dc-qt-0.2.0.alpha/ui/hub.ui0000644000175000017500000000344410433640765014376 0ustar whitewhite HubForm 0 0 603 455 Form 9 6 Qt::Horizontal Qt::Horizontal 0 6 Qt::CustomContextMenu 10 true false dc-qt-0.2.0.alpha/ui/images/0000755000175000017500000000000010467035227014517 5ustar whitewhitedc-qt-0.2.0.alpha/ui/images/tthsearch.png0000644000175000017500000000173310433640765017220 0ustar whitewhitePNG  IHDRabKGD pHYs  tIME 0JhIDATxm[h[usrnI&mfu|qsy { :/xэ)">:D>`LƦtn ,MN'Ysr=PdǏ>O q/gOGȚ븗j}UǝÇ_mzlen!OBO<9])(vANR$I%1հsϏJ@m㺪Xs^TiF J)_ٵ|w#ܡҦK9(x3H'bZc!rBzzc;v!‰j@"! 0FE,AEzbp(d (eXU iQFDJ)jWK"C|#l0ׯ_D56ZmBg^o>3]p%-i-^q}Y`Sٻ;Lkpg z,-IENDB`dc-qt-0.2.0.alpha/ui/images/folders.bmp0000644000175000017500000000446610433640765016671 0ustar whitewhiteBM6 6(0 ceccecceccecceccecceccecceccecceccecceccecceccecceccecceccecceccecceccecceccecceccecceccecceccecuk֦֦֦֦ΦΚΚΚΚcec}yyuqqmeeeececcec}yqmeececs۵۵۵ӭӭ˽纥ceckkkkkkkk9֜ececkkkk9es۵۵۵ӭүƛcfc!{{{{{{{{Bޜecec{{{{cecΆ{۵۵ڳӭѨbeb)ƜJecec)Jeƒ{۴۵ԭӭbeb1ΜRececcecΚڸ۵ڴѱcec1ΜZmcec1Zmަٷڵ˽cec)qcec{cecަڹ˽cec))))))!!cec)))!ަ˽cec1Δyceccecަ˽cec1!!}1!}ަ˽cec1)1ާΚcec111)11ާBBBcecަަ{cecަަަަަަަަަcecdc-qt-0.2.0.alpha/ui/images/user-normal-op.png0000644000175000017500000000134210433640765020107 0ustar whitewhitePNG  IHDRsO/bKGD pHYs  ~IDAT(m_HQgܦ  aYMDVuE7IWA ET%HAYiE9kjL77}۷tQ:{ߋ>9{A2 q{nAMcO 5j11I?Eȱ 1ΟĹ¡ɱY:1:unu=ݱj:N$GMłGX"YߵjPMdErP ͎) KF$&kw7FQ`v&M| #3k*1ҺXv}xЃݿCɌQtx!KE+Y:[;xͷ0<ݬ"D"L ¥=.񼲚AV©E4JӅa}w,[Woݤ_ ŋH*ʆ*߱^maNSMW `"bۋ4R$ނxJ Z,+_j|AWQ2TfRk| kOquVcak/p&i肕}.^iZ>0{o5NK+jYU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aaaaaaaaaaaaaaaaaaaaa:;<̿QLI̵qvވވވވvqęUUUUutMOOD_3V'?-'?0jdlǑ~eWR0F|hrNJΨ؅ؾ}СːؽyβjƧY΢xWѹ}ֿǑԭɗrcrPV7c zifΨO4̡FIkAEѯ߼zi?YԣFI½Нޮձm͢ƨ荔<;?½М֨Å͋ӸibfdhlONQswtqq.Yʼr<җрًрgqgPתJ_ǩ$$$//////////////////////:;<GIIʔ:;<ۥ:;<MOOdzvވqɩغ,,ԣԣUUILMяE V-b(@pSԻֶfgqU*cEeBeIRJXh~S3bBeIiRhN[W}Սq^}ꀱ.>]>_?hPƄZ9`AaBZ: ˇ½ęתŴͤӯJIL½׫braOƫϱƤѧY$:;<////////////////////////////GII//////////////:;<:;<dc-qt-0.2.0.alpha/ui/images/browse.png0000644000175000017500000000143010433640765016526 0ustar whitewhitePNG  IHDR bKGD pHYs  ~tIME 08#IDAT8˥KQr۞dBl2 nȻ?( 7« Yjf/{暏s9sbՁ9=Iq} f_HUlu6YfgSx< tXQ-.jm U&1pKo=z73(&I&?rjtwOFc6Ӿ$t"٩`H`U봷VhΎwIH$$f3ߡei`4¾Os$ SX*]kC)POp kpÊ?lwf 6S%X*!7;]:5XM,6`XgoJ;:;YO1' Wg7^b}. #5 K[46H%UC`ZDs56^mh`6AA/O+z#=r}E/-'m['Ϝ/ݔ#K^eqmyKbD?{;~IXAYp=l :bNp ocڿa\.,eHsߟ[h5}adgJ64F#%HEἢ5CcŬ,o69 5`8øj @U RR[bV)&4L&3so&3s޹qƳ>?8/f> 7~{pD&[<4uǺzP|#[P"ޏ?z蝟ɹL$r,r(r/~(@HZUyu-c0b[Xv!Jy*f lZߵΞW.4}ݎ8kR:CBÛ $۞5\TƉAb/>]"ֆ(6DG2L] BU3R7g]&pow$KH/AjQsbRHͮxS:!afī:K\Ed#*)Jr**x첣-6!V-mšVsnij$v؝\nV Zah'}moz!IrE|Si<6q1\Z͖6C= aMId]+CwU=)㑼 [lc%h31>ám$V .x o6t/t4[ +TGʾ:NۗĺDED[:u jbv>/Cw)L炗<qIENDB`dc-qt-0.2.0.alpha/ui/images/user-dcpp.png0000644000175000017500000000112210433640765017125 0ustar whitewhitePNG  IHDR ͣ9bKGD pHYs  ~IDAT(}]HQ|eQR[`H1 ѫ 26bHBԈ I.BK7s9;QиRleimWLF;.*f@δ H9dӠt;ϧ$uTyg*h v)iꛬۡ~D3]cۻ^lh"S̾X35jX4#x #$)l5 RԞiZvNKiv>KLE{R[Kro0+U'i#L޺G}df8tջ9Z1Rt2}Дco%lTߓbXAIvMTѰVOfiBB=7̭hl&vc7EhJϿ d>twWMYkғq!/auE?AieIENDB`dc-qt-0.2.0.alpha/ui/images/publichubs.png0000644000175000017500000000177210433640765017376 0ustar whitewhitePNG  IHDR bKGD pHYs  ~tIME (N?#IDAT8˅OUv la҅@֦(ijbHjQW kM$  BkS 3~bZ(^yyH&Xǃ}DOBb_$Gb{CzG7_| g_ױGoWA>?Y uRȝۯB5 2{`=dz5a) A:.#v\y.Jqy~P:@+į4r<*j`d) E#dVf, -ت`# ZΆVH4˻X5j*lC  gCs_nP\TҨ٪DOBGJ* Y-kYs.Th=ɇtoΓ24Uh+R\n1, ݯH˫(]]Z篧464m{L5^S*,e V-+z᯾tݟ| ⻤6cX Bp)M+;^Mr ]j<Dv\3V/S kKlN^fbXOnr{ 4(.hbY|1zHU. n Wks>Yϰhro<.)Nuy\2m\i֮IZu׫lXGsDSxa(ezQQ]Z.U(ar4K:j\xbxLL]ð rS.n ,Drbd2 5]^{Tf>S C!WټD&vM} 1wA$o^㭷1|/\=?Y#jo7$k@7(IENDB`dc-qt-0.2.0.alpha/ui/images/user-passive-op.png0000644000175000017500000000120610433640765020270 0ustar whitewhitePNG  IHDRV%bKGD pHYs  ~&IDAT(υ[HaϝlQԊ .K/0&" HPȐȃقtevM.IGO~UD)$%MDk>GhmRk]%RĻ4xV-#s DpB (3\|y裢8cY)V>D*wao{=†w!hX]n&/-␏4AkE}4{2~_d嶴t֓0ώ08*HF;SM6u9 t]JvʉcVvI#V‰zcEqwbE+jJ7[̝ Xy6pe!0?)%-IENDB`dc-qt-0.2.0.alpha/ui/images/remove.png0000644000175000017500000000157010433640765016527 0ustar whitewhitePNG  IHDRasBIT|dtEXtSoftwarewww.inkscape.org< IDAT8mOLw?۷o2*i^PBkRRE\L`7o$͐yp]311q l]\ h!fF,ŵHmZ޶ }y](J !zMEz*͎?*K㥃o0իv_?vˑOXpa&H $ 8ҙ$X^Y~u}8p>J@es&bGw7NR:'4M5 Z4*ubXm6@'P,R.;ى泾>Ѩd/'4MU|>qqYݥn Q3 ڜN܁@kZi8YXlL(JL?g[x pȿ|{.E$|o[[F.Ǜt_$>&fy|٤=v^L&i[[% `dl iU== >|ȉHr{({8BfFhu =yBh`LeǮ_79I]Qp*)xphb>{&fC!C4*-ۍ ˥KbxTQX2mnm۷U>79Ndek_b;Ğˉ5M].KS6 pG8,՗x ,q"Hss'uʇt7V;(VPWI:'}$4M=c^52^ PZ39L͎/?+[ IENDB`dc-qt-0.2.0.alpha/ui/images/user-passive.png0000644000175000017500000000064410433640765017661 0ustar whitewhitePNG  IHDR&N:bKGD pHYs  ~DIDAT(ϝKa.i$ " AKK[M MFK[P^KAA~Y W<{8s AH}z[{,bAimnϥUS3^ty^Lu6kZ$J<#?!<ibMt)[u٫bpb4G)36&ώ<6T(f#qF%oCt\z~UOƢIENDB`dc-qt-0.2.0.alpha/ui/images/dldir.png0000644000175000017500000000207010433640765016324 0ustar whitewhitePNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?% XT1X0|/Ьc'^2Xd'_X8X}>v#uo}uh8?b߼_ q_9YQׯ v V_Yt?FEĢʛ/?  ??I d˗@'108:7@  &6V/L  ~`)_GRW[o?@C/ëtD,$0# 0@t oy0X(Á @/T~p)qn}fQUF  @~s2:O f/_ @sGt`e4{sßOXA?++fv1| r< : 21 A{! h4y؅N\g`xà wcxó><|{!#.c3d*Ѐ1ǯ ~gJ8l$.ƿs/by'*?P 3w0 70&_0>y;܀\4$8} 7`}H߿~,3#@U4733 D (yp{S3nv&`S_7d C0gdeamIENDB`dc-qt-0.2.0.alpha/ui/images/downloadto.png0000644000175000017500000000065010433640765017402 0ustar whitewhitePNG  IHDRabKGD@ pHYs  tIME :tEXtCommentCreated with The GIMPd%n IDAT8˵q0 E3),['.@ .)\uݐd$0w9/g4. "qSYHJ$A2 _(sRJa[u]{UU~D}>v@]׾ @qM04*%bI.j[6a #Da9l utƢi n 2V&|i|`_g!?[5ٝ9bKǻ-8w?(KVIENDB`dc-qt-0.2.0.alpha/ui/images/settings.png0000644000175000017500000000174110433640765017072 0ustar whitewhitePNG  IHDR bKGD pHYs  ~tIME .- AnIDAT8˕]L[u= )-0!E[(3`bx'$ư;c,1:/-%\83hm0  -~E h|9>'+*(OiV_8ZDy ~sQ/7 CM&MIKZI_.Q / e ߨ+|s H^~38kCEZr#Z{$vߘ֦0abYy6Em2yq d/d0[aiU'^!EUPFhPX"JDJ\:E[ c#WcsǘdZHnw8ZKxO0J[܅EW)v۟ϿKӿ鿎:Gn6qPr0DZTNRP$uٹuTMLOy|tc3;lњ1!},Q̋u6 :5U0>]y͆DXe.fϤ)]~HU9{P^՞A@$dMIwzm=xPEimY#fK3<0yOIE)5*3mSZDs56^mh`6AA/O+z#=r}E/-'m['Ϝ/ݔ#K^eqmyKbD?{;~IXAYp=l :bNp ocڿa@G G BA?RSVY[\tustusʼccdϽĢgh^ZUXʻܪΪ՞Ϊ1R%09{9bJk]It7ف>_SRNg,ҵo붎m%vyz}zqyzvyz}zqyzRSVK}>DqVlb@[RSVK}>DqVlb@[RSVK}>DqVlb@[c< &##G $RSVY[\`Yp?d6{Bc< BA?BA?RSVbmzccdòĢ}~ghghig | //ullLKSK}:%09Ԟ BjPyaԎ3^z7OiRQQo)vՂn;IUJ"!;Eڦʠ껹y{IUJ"!;E EIUJ"!;Eڦʠ껹y{IUJ"!;E E/{K>DUXb@[/{K>DUXb@[~/{K>DUXb@[IUJ"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.png0000644000175000017500000000046210433640765017040 0ustar whitewhitePNG  IHDRV%bKGD@ pHYs  ~tIME !IDAT(m0B` .ރ~yd$;w -c-@꽱H|>%sU3B2F ;[ Pv@;.P4?WY_kCm(,$˲y+#I4,ºiL!-s=wfqXR7ܘ=^ IENDB`dc-qt-0.2.0.alpha/ui/images/user-dcpp-op.png0000644000175000017500000000134210433640765017545 0ustar whitewhitePNG  IHDRsO/bKGD pHYs  ~IDAT(m]HQ;7ۜL,M5-*3..n2 MT*]}(4EeaYYZ.7|7vX9{?H@yuhZ%C 䦭 nph C df C|ڐȹ:#7Ŗ:kM-X&_؅퍖Ӈf6c_/gH4BB$,!DrтB?b^ňsCݸjWݢu@?gc閦 `)%Og?؋Wn~iML"z_Ҽ';C->+km GQi_w쨉PG8q[mh 7/7ZazTe}Ue1WDrz̠!XبC`E9G3Ԧ!ztug8Ԙ>&\jrh]Oee,!xGE{Z9i<+(nY(mƾؚx~#h]mXOiq4PxʬL ) %YXD҉JsD DIENDB`dc-qt-0.2.0.alpha/ui/sessionmanager.cpp0000644000175000017500000000701710433640765017003 0ustar whitewhite// // C++ Implementation: sessionmanager // // Description: // // // Author: Rikard Bjorklind , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include "sessionmanager.h" #include "session.h" #include SessionManager::SessionManager( QTabWidget * aSessionTabs, boost::shared_ptr< BackendConnection > aConnection, QObject * parent ) : QObject(parent), backendConnection(aConnection), sessionTabs(aSessionTabs) { connect( sessionTabs, SIGNAL(currentChanged(int)), SLOT(onActiveSessionChanged(int))); } SessionManager::~SessionManager() { } void SessionManager::createSession( int id ) { if(!sessionMap.contains(id)) { Session* session = new Session(id); // no parent here since we add it to a tabbar. // This connect forwards chat signals from the session to us so that we send them to the backend. QObject::connect(session,SIGNAL(sendChat( int,const QString&)),this,SLOT(sendChat( int, const QString& ))); QObject::connect(session,SIGNAL(getUserFileList(int)),this,SLOT(getUserFileList( int ))); sessionMap[id] = session; sessionTabs->addTab(session,tr("Connecting...")); } } void SessionManager::hubUpdated( int id, const QString& hubName) { if(sessionMap.contains(id)) { Session* session = sessionMap[id]; int index = sessionTabs->indexOf(session); QString hubn = hubName; if(hubName.length() > 30) { hubn.truncate( 30 ); hubn = hubn + "..."; } sessionTabs->setTabText(index,hubn); sessionTabs->setCurrentIndex(index); } } void SessionManager::connectionFailed( int id, const QString& reason) { if(sessionMap.contains(id)) { sessionMap[id]->onFailed(reason); } else QMessageBox::critical(0,tr("Connection Failed"),tr("Connection failed: ") + reason); } void SessionManager::privateChat(int id,const QString& from,const QString& msg) { if(sessionMap.contains(id)) sessionMap[id]->onPrivateChatMessage(from,msg); } void SessionManager::usersUpdated( int id , QList< User * > users ) { if(sessionMap.contains(id)) sessionMap[id]->onUsersUpdated(users); } void SessionManager::chatMessage( int id, const QString &msg ) { if(sessionMap.contains(id)) sessionMap[id]->onChatMessage(msg); } void SessionManager::sendChat( int id, const QString &msg ) { backendConnection->sendChat(id,msg); } void SessionManager::getUserFileList( int userId ) { backendConnection->getUserFileList( userId ); } void SessionManager::sessionInfo( int id, const QString &hubName, const QString &/*url*/, const QList< User * > users ) { createSession( id ); hubUpdated( id,hubName ); usersUpdated( id,users ); // TODO put the url in the session so that the fav command works. } void SessionManager::closeCurrentSession( ) { try { Session* session = qobject_cast(sessionTabs->currentWidget()); sessionTabs->removeTab(sessionTabs->currentIndex()); sessionMap.remove( session->getId() ); backendConnection->closeSession( session->getId() ); delete session; } catch(...) {} } void SessionManager::userRemoved( int session, int userid ) { if(sessionMap.contains( session )) sessionMap[session]->onUserRemoved(userid); } void SessionManager::onHubStats( int session, qint64 sharesize) { if(sessionMap.contains(session)) { sessionMap[session]->onHubStats(sharesize); if( sessionTabs->currentWidget() == sessionMap[session] ) emit currentHubTotalShare( sharesize ); } } void SessionManager::onActiveSessionChanged( int /*session*/ ) { Session* sess = (Session*)sessionTabs->currentWidget(); emit currentHubTotalShare( sess->getTotalShared() ); } dc-qt-0.2.0.alpha/ui/backendconnection.h0000644000175000017500000000427310433640765017102 0ustar whitewhite// // C++ Interface: backendconnection // // // Author: rilleb and mickyg // // Copyright: See COPYING file that comes with this distribution // // #ifndef BACKENDCONNECTION_H #define BACKENDCONNECTION_H #include #include #include #include #include "global.h" #include #include #include "rpctypes.h" class SearchEntry; /** Simply the RPC interface. Converts ordinary method calls to RPC calls which are sent to the other side. BIG NOTE: The RPC Driver does not accept values of type int64. Therefore, use int64 from rpcdriver/types.h (this applies to x86_64 only). */ class BackendConnection : public QObject { Q_OBJECT public: BackendConnection(boost::shared_ptr< rpc::RpcClientDriver > aDriver) : driver(aDriver) {} ~BackendConnection(); public slots: void authenticate( const QString& password ); void createSession( const QString& url ); void getSharedDirs(); void addShare(const QString& name,const QString& dir); void delShare(const QString& name); void getHubList(bool refresh); void getFavouriteHubs(); void getSettings(QList keys); void setSettings(QList > ); void sendChat(int session,const QString& msg); void sendSearch(int session, int64 size, int sizeMode, int typeMode, const QString& search); void requestRunningSessions(); void downloadFile( const SearchEntry& file ); void downloadFileTo( const SearchEntry& file, const QString& dir ); void downloadFile( int uId, const QString& file, int64 size, const QString& tth ); void downloadFileTo( int uId, const QString& file, int64 size, const QString& tth, const QString& dir ); void tellBackendToDie(); void getUserFileList( int userId ); void addFavouriteHub(const rpc_types::FavouriteHub&); void removeFavouriteHub(const QString& server); void closeSession( int session ); void sendPassword( int session, const QString& ); void removeQueueItem(int id); void forceConnectionAttempt(int userId); void removeSource(int qid, int uid); void die(); private: boost::shared_ptr< rpc::RpcClientDriver > driver; }; typedef boost::shared_ptr BackendConnectionPtr; #endif dc-qt-0.2.0.alpha/ui/favouritehublist.ui0000644000175000017500000000354210433640765017216 0ustar whitewhite FavouriteHubsForm 0 0 588 414 Form 9 6 0 6 Add Favourite Remove Favourite Qt::Horizontal 40 20 Connect true dc-qt-0.2.0.alpha/ui/globalusermodel.cpp0000644000175000017500000000157110433640765017144 0ustar whitewhite// // C++ Implementation: globalusermodel // // Description: // // // Author: Rikard Bjorklind , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include "globalusermodel.h" GlobalUserModel::GlobalUserModel(QObject *parent) : QObject(parent) { } GlobalUserModel::~GlobalUserModel() { } User* GlobalUserModel::getUser( int id ) { if( userMap.contains(id) ) return userMap[id]; return NULL; } void GlobalUserModel::usersUpdated( int , QList ulst) { for(int i=0;i < ulst.size();i++) { User* u = ulst[i]; userMap[u->id] = u; } } void GlobalUserModel::userRemoved( int , int userid) { userMap.remove( userid); } void GlobalUserModel::sessionInfo( int , const QString &, const QString &, const QList< User * > ulst ) { for(int i=0;i < ulst.size();i++) { User* u = ulst[i]; userMap[u->id] = u; } } dc-qt-0.2.0.alpha/ui/finisheditem.h0000644000175000017500000000053310433640765016076 0ustar whitewhite// // C++ Interface: FinishedItem // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #ifndef FINISHED_ITEM_H__ #define FINISHED_ITEM_H__ struct FinishedItem { int id; int type; QString target; QString user; QString hub; }; #endif dc-qt-0.2.0.alpha/ui/rpctypes.h0000644000175000017500000000207510433640765015302 0ustar whitewhite #ifndef RPC_TYPES_H_ #define RPC_TYPES_H_ #include #include #include using std::string; using std::list; namespace rpc_types { class FavouriteHub { public: string nick; string userDescription; string name; string server; string description; string password; bool autoConnect; bool operator==(const FavouriteHub& rhs) { return rhs.server==server; } }; class Share { public: string virtualName; string realName; int64 bytesShared; }; class HubEntry { public: string name; string server; string description; string country; string rating; int reliability; int64 shared; int64 minShare; int users; int minSlots; int maxHubs; int maxUsers; /// The amount of elements a hub entry should contain static const unsigned short HUB_ENTRY_SIZE = 12; }; class User { public: string nick; int flags; string email; string description; string connection; string tag; int64 shared; int hubslots; int userid; }; class SessionInfo { public: int id; string hubname; string url; list users; }; } #endif dc-qt-0.2.0.alpha/ui/filetransfer.h0000644000175000017500000000305610433640765016115 0ustar whitewhite// // C++ Interface: filetransfer // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #ifndef FILETRANSFER_H__ #define FILETRANSFER_H__ #include "global.h" #include "log.h" #include struct FileTransfer { enum Type {UPLOAD=0,DOWNLOAD=1}; Type type; qint64 pos; qint64 startpos; qint64 actual; qint64 size; qint64 averageSpeed; qint64 secondsLeft; qint64 bytesLeft; QString filename; QString localfilename; QString tth; QString status; int userid; //! This method might be quite incorrect, we have to check dc++ behaviour a little better. bool operator==(const FileTransfer& ft) const { // quick rejection test logger->debug("comparing files"); if(type==ft.type) logger->debug("type samma"); if(type!=ft.type) return false; // Use TTH if available for both //if(!tth.isEmpty() && !ft.tth.isEmpty()) { // logger->debug("tthcomp:" + QString::number(tth==ft.tth?1:0 ));; // return tth==ft.tth; //} logger->debug("userid: " + QString::number(userid) + ", " + QString::number(ft.userid) + ", " + filename + ", " + ft.filename); // No tth, use filename, user return userid==ft.userid && filename==ft.filename; } QString toString() const { return QString("Type: ") + QString::number(type) + "\nFilename: " + filename + "\nsize: " + QString::number(size) + " userid:"+QString::number(userid); } }; #endif dc-qt-0.2.0.alpha/ui/nicetreeview.h0000644000175000017500000000136010433640765016116 0ustar whitewhite// // C++ Interface: nicetreeview // // Description: // // // Author: Rikard Bjorklind , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #ifndef NICETREEVIEW_H #define NICETREEVIEW_H #include /** A TreeView with some slight improvements @author Rikard Bjorklind */ class NiceTreeView : public QTreeView { Q_OBJECT public: NiceTreeView(QWidget *parent = 0); virtual ~NiceTreeView(); signals: void leftMousePressed(); protected: // Overridden from QWidget // virtual void paintEvent ( QPaintEvent * event ); // virtual void dragEnterEvent(QDragEnterEvent *event); virtual void mousePressEvent ( QMouseEvent * event ); }; #endif dc-qt-0.2.0.alpha/ui/blockallocator.h0000644000175000017500000000523110433640765016421 0ustar whitewhite#ifndef __blockallocator_h__ #define __blockallocator_h__ #include #include using namespace std; typedef unsigned char byte; //! Custom memory allocator for single items template class BlockAllocator { public: void* operator new(size_t) { //cerr << "blocknew\n"; return s_Store.AllocateBlock(); } void operator delete(void* pBlock) { //cerr << "blockdelete" << endl; s_Store.ReleaseBlock((T*)pBlock); } static T* AllocateBlock() { return s_Store.AllocateBlock(); } static void ReleaseBlock(T* pBlock) { s_Store.ReleaseBlock(pBlock); } private: struct BlockStore { BlockStore() : ppNextBlock(0) {} ; ~BlockStore() { size_t iNum = batches.size(); for (size_t i=0; i BatchPtrVector; byte** ppNextBlock; // Pointer to the next available block pointer BatchPtrVector batches; // Array of pointers to batches }; static BlockStore s_Store; }; #endif dc-qt-0.2.0.alpha/ui/commandhandlers.cpp0000644000175000017500000005512310433640765017125 0ustar whitewhite/*! \file commandhandlers.cpp \brief Implements the exposed RPC methods. This file contains implementations of the handleCommand() methods of the RPC handler classes. */ #include "commandhandlers.h" #include "global.h" #include "log.h" #include "user.h" #include "shareitemmodel.h" #include "finisheditem.h" #include #include #include using namespace std; using namespace boost; namespace ui_cmd_handlers { using std::list; /** * Parses an anylist of user structs and returns a QList which contains user pointers. * */ QList parseUserList(const anylist& users) { anylist::const_iterator uit = users.begin(); QList parsedUsers; for(;uit!=users.end();uit++) { User* user = new User; // Fast, not slow! :) anylist userprops = boost::any_cast(*uit); anylist::const_iterator pit = userprops.begin(); user->id = boost::any_cast(*pit); pit++; user->nick = boost::any_cast(*pit).c_str(); pit++; user->flags = any_cast(*pit); pit++; user->email = any_cast(*pit).c_str(); pit++; user->description = any_cast(*pit).c_str(); pit++; user->connection = any_cast(*pit).c_str(); pit++; user->tag = any_cast(*pit).c_str(); pit++; user->shared = any_cast(*pit); pit++; user->numSlots = any_cast(*pit); parsedUsers.append(user); } return parsedUsers; } void HubConnectedHandler::handleCommand(const anylist& params) { try { logger->info("hubConnected!"); int sessionId = boost::any_cast(params.front()); emit hubConnected(sessionId); } catch( const boost::bad_any_cast& e ) {} } void HubUpdatedHandler::handleCommand(const anylist& params) { try { logger->info("hubUpdated!"); anylist::const_iterator it = params.begin(); int sessionId = boost::any_cast(*it); it++; QString hubName = (boost::any_cast(*it)).c_str(); emit hubUpdated(sessionId,hubName); } catch( const boost::bad_any_cast& e ) {} } void HubStatsHandler::handleCommand(const anylist& params) { try { anylist::const_iterator it = params.begin(); int sessionId = boost::any_cast(*it); it++; int64 shared = boost::any_cast(*it); emit hubStats(sessionId,shared); } catch( const boost::bad_any_cast& e ) { throw RpcHandlerException("HubStatsHandler","Bad AnyCast"); } } void ConnectionFailedHandler::handleCommand(const anylist& params) { try { logger->info("connectionFailed!"); anylist::const_iterator it = params.begin(); int sessionId = boost::any_cast(*it); it++; QString reason = (boost::any_cast(*it)).c_str(); emit connectionFailed(sessionId,reason); } catch( const boost::bad_any_cast& e ) {} } void PrivateChatHandler::handleCommand( const anylist& params) { try { logger->debug("privateChat!"); anylist::const_iterator it = params.begin(); int sessionId = boost::any_cast(*it); it++; QString from = (boost::any_cast(*it)).c_str(); it++; QString msg((boost::any_cast(*it)).c_str()); emit privateChat(sessionId,from,msg); } catch( const boost::bad_any_cast& e ) {} } void ChatMessageHandler::handleCommand( const anylist& params) { try { logger->debug("publicChat!"); anylist::const_iterator it = params.begin(); int sessionId = boost::any_cast(*it); it++; QString msg = (boost::any_cast(*it)).c_str(); emit chatMessage(sessionId,msg); } catch( const boost::bad_any_cast& e ) { logger->error("bad anycast in chatmessage"); } } void UsersUpdatedHandler::handleCommand( const anylist& params) { try { QList parsedUsers; //logger->debug("usersUpdated!"); anylist::const_iterator it = params.begin(); int sessionId = boost::any_cast(*it); it++; // ................................................................ // TODO: This will result in a deep copy of the entire list??!! // We need to solve it! anylist users = boost::any_cast(*it); /*anylist::const_iterator uit = users.begin(); for(;uit!=users.end();uit++) { User* user = new User; // Fast, not slow! :) anylist userprops = boost::any_cast(*uit); anylist::const_iterator pit = userprops.begin(); user->id = boost::any_cast(*pit); pit++; user->nick = boost::any_cast(*pit).c_str(); pit++; user->flags = any_cast(*pit);pit++; user->email = any_cast(*pit).c_str();pit++; user->description = any_cast(*pit).c_str();pit++; user->connection = any_cast(*pit).c_str();pit++; user->tag = any_cast(*pit).c_str(); pit++; user->shared = any_cast(*pit); pit++; user->numSlots = any_cast(*pit); parsedUsers.append(user); }*/ parsedUsers = parseUserList(users); emit usersUpdated( sessionId, parsedUsers ); } catch( const boost::bad_any_cast& e ) { logger->error("badanycast in usersupdated."); } } void settingsInfoHandler::handleCommand(const anylist& params) { try { QList keys; QList values; anylist::const_iterator pi = params.begin(); const anylist& k = boost::any_cast(*pi); pi++; const anylist& v = boost::any_cast(*pi); anylist::const_iterator ki = k.begin(); while(ki!=k.end()) { keys.append(QString(boost::any_cast(*ki).c_str())); ki++; } anylist::const_iterator vi = v.begin(); while(vi!=v.end()) { if((*vi).type()==typeid(string)) values.append(QString(boost::any_cast(*vi).c_str())); else if((*vi).type()==typeid(int)) values.append(boost::any_cast(*vi)); else if((*vi).type()==typeid(bool)) values.append(boost::any_cast(*vi)); else if((*vi).type()==typeid(int64)) values.append((qlonglong)boost::any_cast(*vi)); vi++; } emit settingsInfo( keys, values ) ; } catch (const boost::bad_any_cast& e) { cout << "bad any cast" << endl; } catch (...) { cout << "exception" << endl; } } void PublicHubListHandler::handleCommand( const anylist& params ) { try { // The parameters should consist of a list of lists. // Iterate through the list and cast each item to a list which // is treated as a hub entry and converted. QList hubEntries; const anylist& hubs = boost::any_cast(params.front()); anylist::const_iterator hubsIt = hubs.begin(); while(hubsIt != hubs.end()) { const anylist& hub = boost::any_cast(*hubsIt); if( hub.size() == rpc_types::HubEntry::HUB_ENTRY_SIZE ) { anylist::const_iterator hubIt = hub.begin(); rpc_types::HubEntry hubEntry; hubEntry.name = boost::any_cast(*hubIt); ++hubIt; hubEntry.server = boost::any_cast(*hubIt); ++hubIt; hubEntry.description = boost::any_cast(*hubIt); ++hubIt; hubEntry.country = boost::any_cast(*hubIt); ++hubIt; hubEntry.rating = boost::any_cast(*hubIt); ++hubIt; hubEntry.reliability = boost::any_cast(*hubIt); ++hubIt; hubEntry.shared = boost::any_cast(*hubIt); ++hubIt; hubEntry.minShare = boost::any_cast(*hubIt); ++hubIt; hubEntry.users = boost::any_cast(*hubIt); ++hubIt; hubEntry.minSlots = boost::any_cast(*hubIt); ++hubIt; hubEntry.maxHubs = boost::any_cast(*hubIt); ++hubIt; hubEntry.maxUsers = boost::any_cast(*hubIt); hubEntries.append(hubEntry); } ++hubsIt; } emit hubList(hubEntries); } catch( const boost::bad_any_cast& e ){ logger->error(e.what()); throw RpcHandlerException("HubList","Bad AnyCast"); } } void SessionCreatedHandler::handleCommand(const anylist& params) { try { logger->info("SessionCreated"); int sessionId = boost::any_cast(params.front()); emit sessionCreated(sessionId); } catch( const boost::bad_any_cast& e ) { logger->error("sessioncreated bad anycast"); } } void RunningSessionsHandler::handleCommand( const anylist& params) { try { logger->debug("runningSessions!"); anylist::const_iterator it = params.begin(); anylist sessions = any_cast(*it); it++; anylist queue = any_cast(*it); // Parse the sessions list anylist::const_iterator sessionIt = sessions.begin(); for(;sessionIt!=sessions.end();sessionIt++) { // Each element in the sessions list is a SessionInfo struct, which is sent as a list of course. anylist si = any_cast(*sessionIt); anylist::const_iterator infoIt = si.begin(); int sessionId = boost::any_cast(*infoIt); infoIt++; QString hubName = (boost::any_cast(*infoIt)).c_str(); infoIt++; QString url = (boost::any_cast(*infoIt)).c_str(); infoIt++; // Now comes the list of users anylist userlist = any_cast(*infoIt); QList parsedUsers = parseUserList(userlist); emit sessionInfo( sessionId,hubName,url,parsedUsers ); } QList queueItemList; for(anylist::const_iterator qlit=queue.begin();qlit!=queue.end();qlit++) { anylist qitem = any_cast(*qlit); anylist::const_iterator qit = qitem.begin(); QueueItem qi; qi.id = any_cast(*qit); qit++; qi.target = any_cast(*qit).c_str(); qit++; qi.size = any_cast(*qit); qit++; qi.downloadedBytes = any_cast(*qit); qit++; qi.status = any_cast(*qit); qit++; qi.priority = any_cast(*qit); qit++; qi.currentSource = any_cast(*qit); qit++; if(qit!=qitem.end()) { anylist sources = any_cast(*qit); anylist::const_iterator slit = sources.begin(); while(slit!=sources.end()) { qi.sources += any_cast(*slit); slit++; } } queueItemList+=qi; } emit queueList(queueItemList); } catch( const boost::bad_any_cast& e ) { logger->error("bad anycast in runningSessions"); throw RpcHandlerException("runningSessions","Bad anycast"); } } void SharedDirsHandler::handleCommand( const anylist & params ) { try { logger->debug("sharedDirs"); anylist dirs = any_cast(params.front()); anylist::const_iterator it = dirs.begin(); QList shares; for(;it!=dirs.end();it++) { anylist item = any_cast(*it); anylist::iterator sit = item.begin(); QString virtualName((any_cast(*sit)).c_str()); sit++; QString realName((any_cast(*sit)).c_str()); sit++; int64 bytesShared(any_cast(*sit)); ShareItem shareItem(virtualName,realName,bytesShared); shares+=shareItem; } emit sharedDirs( shares ); } catch( const boost::bad_any_cast& e ) { logger->error("shareddirs bad anycast"); } } void SearchResultsHandler::handleCommand( const anylist & params ) { try { QList results; logger->debug("searchResults"); anylist::const_iterator it = params.begin(); int session = any_cast(*it); it++; anylist srs = any_cast(*it); for(it=srs.begin();it!=srs.end();it++) { anylist sr = any_cast(*it); //logger->debug(QString("a struct with %1 elements").arg(sr.size())); anylist::const_iterator srit = sr.begin(); string file = any_cast(*srit); srit++; int fileisutf8 = any_cast(*srit); srit++; QString fileName(any_cast(*srit).c_str()); srit++; QString userName(any_cast(*srit).c_str()); srit++; QString hubName(any_cast(*srit).c_str()); srit++; int userId(any_cast(*srit)); srit++; int64 fileSize = any_cast(*srit); srit++; int sluts = any_cast(*srit); srit++; int freeSlots = any_cast(*srit); srit++; int type = any_cast(*srit); srit++; QString tth(any_cast(*srit).c_str()); SearchEntry se(file,userName,hubName,userId,fileSize,sluts,freeSlots,type,tth,fileisutf8!=0); results += se; } emit searchResults( session, results ); } catch( const boost::bad_any_cast& e ) { logger->error("searchresults bad anycast"); } } void QueueEventHandler::handleCommand( const anylist & params ) { try { logger->debug("queueEvent"); anylist::const_iterator it = params.begin(); int eventType = any_cast(*it); it++; switch(eventType) { case 1: // add { // Next param is a queueItem anylist qitem = any_cast(*it); anylist::const_iterator qit = qitem.begin(); QueueItem qi; qi.id = any_cast(*qit); qit++; qi.target = any_cast(*qit).c_str(); qit++; qi.size = any_cast(*qit); qit++; qi.downloadedBytes = any_cast(*qit); qit++; qi.status = any_cast(*qit); qit++; qi.priority = any_cast(*qit); qit++; qi.currentSource = any_cast(*qit); //qit++; //if(qit!=params.end()) { // anylist sourcearr = any_cast(*qit); // anylist::iterator sourceit = sourcearr.begin(); // for(;sourceit!=sourcearr.end();sourceit++) qi.sources+=any_cast(*sourceit); //} logger->debug("emitting queueItemAdded"); emit queueItemAdded( qi ); break; } case 2: // remove { // Second param: id int id = any_cast(*it); logger->debug("emitting queueItemRemoved"); emit queueItemRemoved( id ); break; } case 3: // finished { int id = any_cast(*it); logger->debug("emitting queueItemFinshed"); emit queueItemFinshed( id ); break; } case 4: // sourcesupdated { int id = any_cast(*it); it++; anylist sources = any_cast(*it); QList sourceList; for(anylist::iterator sit=sources.begin();sit!=sources.end();sit++) sourceList+=any_cast(*sit); logger->debug("emitting sourcesUpdated"); emit sourcesUpdated( id, sourceList ); break; } case 5: { // statusupdated int id = any_cast(*it); it++; int status = any_cast(*it); it++; int currSrc = any_cast(*it); it++; int priority = any_cast(*it); it++; logger->debug("emitting statusUpdated"); emit statusUpdated( id, status, currSrc, priority ); break; } default: logger->error("Wrong eventType in queueEvent!"); } } catch( const boost::bad_any_cast& e ) { logger->error("queueevent bad anycast"); } } void FinishedEventHandler::handleCommand( const anylist & params ) { try { logger->debug("finishedEvent"); anylist::const_iterator it = params.begin(); int eventType = any_cast(*it); it++; int transferType = any_cast(*it); it++; switch(eventType) { case 1: // add { // A FinishedItem anylist fi = any_cast(*it); anylist::iterator fit = fi.begin(); FinishedItem fitem; fitem.id = any_cast(*fit); fit++; fitem.target = any_cast(*fit).c_str(); fit++; fitem.user = any_cast(*fit).c_str(); fit++; fitem.hub = any_cast(*fit).c_str(); fitem.type = transferType; emit itemAdded(fitem); } break; case 2: // remove { int id = any_cast(*it); emit itemRemoved( id ); } break; case 3: // removeAll emit allRemoved(transferType); break; } } catch( const boost::bad_any_cast& e ) { logger->error("finishedevent bad anycast"); } } void TransferEventHandler::handleCommand( const anylist & params ) { //logger->debug("transferEvent"); anylist::const_iterator it = params.begin(); int eventType = any_cast(*it); //logger->debug(QString("eventType: %1").arg(eventType)); it++; FileTransfer::Type transferType = static_cast(any_cast(*it)); //logger->debug(QString("transfertype: %1").arg(transferType)); it++; if(eventType==0 ) emit transferStarting( createTransfer(transferType,any_cast(*it)) ); else if(eventType==1) { QList tl; anylist ftlst = any_cast(*it); for(anylist::iterator fit = ftlst.begin();fit!=ftlst.end();fit++) tl+=createTransfer( transferType, any_cast(*fit)); emit transferTick( tl ); } else if(eventType==2) emit transferComplete( createTransfer(transferType,any_cast(*it)) ); else if(eventType==3) { anylist ft = any_cast(*it); it++; QString errorMsg = any_cast(*it).c_str(); emit transferFailed( createTransfer(transferType,ft), errorMsg ); } } FileTransfer TransferEventHandler::createTransfer( FileTransfer::Type type, const anylist & ft ) { anylist::const_iterator it = ft.begin(); FileTransfer f; f.type = type; f.pos = any_cast(*it); it++; f.startpos = any_cast(*it); it++; f.actual = any_cast(*it);it++; f.size = any_cast(*it);it++; f.averageSpeed = any_cast(*it);it++; f.secondsLeft = any_cast(*it);it++; f.bytesLeft = any_cast(*it);it++; f.filename = any_cast(*it).c_str();it++; if(type==FileTransfer::UPLOAD) {f.localfilename = any_cast(*it).c_str();it++;} f.tth = any_cast(*it).c_str();it++; f.userid = any_cast(*it);it++; return f; } void UserFileListHandler::handleCommand( const anylist& params ) { try { logger->debug("File lising"); anylist::const_iterator it = params.begin(); int userId = any_cast(*it); ++it; string fileTree = any_cast(*it); QString temp = fileTree.c_str(); // Create a new model and emit it UserFileModelPtr model( new UserFileModel( userId, temp ) ); emit fileListing( model ); } catch( const boost::bad_any_cast& e ) { logger->error(e.what()); } } void FavouriteHubListHandler::handleCommand( const anylist& params ) { try { logger->debug("Favourite hub list"); anylist::const_iterator paramIt = params.begin(); const anylist& favHubList = any_cast(*paramIt); anylist::const_iterator favHubListIt = favHubList.begin(); QList hubs; while( favHubListIt != favHubList.end() ) { const anylist& favHub = any_cast(*favHubListIt); anylist::const_iterator favHubIt = favHub.begin(); rpc_types::FavouriteHub hubEntry; hubEntry.nick = any_cast(*favHubIt); ++favHubIt; hubEntry.userDescription = any_cast(*favHubIt); ++favHubIt; hubEntry.name = any_cast(*favHubIt); ++favHubIt; hubEntry.server = any_cast(*favHubIt); ++favHubIt; hubEntry.description = any_cast(*favHubIt); ++favHubIt; hubEntry.password = any_cast(*favHubIt); ++favHubIt; hubEntry.autoConnect = any_cast(*favHubIt); hubs.push_back(hubEntry); ++favHubListIt; } emit hubList( hubs ); } catch( const boost::bad_any_cast& e ) { logger->error(e.what()); } } void UserRemovedHandler::handleCommand( const anylist& params ) { try { anylist::const_iterator it = params.begin(); int sessionId = any_cast(*it); ++it; int userId = any_cast(*it); emit userRemoved( sessionId, userId ); } catch( const boost::bad_any_cast& e ) { logger->error(e.what()); throw RpcHandlerException("userRemoved","Bad anycast"); } } void FavouriteHubAddedHandler::handleCommand( const anylist& params ) { try { logger->debug("Favourite hub added"); anylist::const_iterator paramIt = params.begin(); const anylist& favHub = any_cast(*paramIt); anylist::const_iterator favHubIt = favHub.begin(); rpc_types::FavouriteHub hubEntry; hubEntry.nick = any_cast(*favHubIt); ++favHubIt; hubEntry.userDescription = any_cast(*favHubIt); ++favHubIt; hubEntry.name = any_cast(*favHubIt); ++favHubIt; hubEntry.server = any_cast(*favHubIt); ++favHubIt; hubEntry.description = any_cast(*favHubIt); ++favHubIt; hubEntry.password = any_cast(*favHubIt); ++favHubIt; hubEntry.autoConnect = any_cast(*favHubIt); emit favHubAdded( hubEntry ); } catch( const boost::bad_any_cast& e ) { logger->error(e.what()); } } void FavouriteHubRemovedHandler::handleCommand( const anylist& params ) { try { logger->debug("Favourite hub removed"); anylist::const_iterator paramIt = params.begin(); const string server = any_cast(*paramIt); emit favHubRemoved( server ); } catch( const boost::bad_any_cast& e ) { logger->error(e.what()); } } void HashInfoHandler::handleCommand( const anylist& params ) { // TODO } } dc-qt-0.2.0.alpha/ui/userlistmodel.cpp0000644000175000017500000000726510433640765016665 0ustar whitewhite// // C++ Implementation: UserList // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #include "userlistmodel.h" #include "util.h" template typename BlockAllocator::BlockStore BlockAllocator::s_Store; QVariant UserListModel::data( const QModelIndex & index, int role ) const { if(index.row() < 0 || index.row() >= users.size()) return QVariant(); //User* u = userIndexMap.value(index.row()); User *u = users[index.row()]; if(u==0) return QVariant(); if(role==Qt::DisplayRole) { switch(index.column()) { case 0: return u->nick; case 1: return Util::bytesToStr(u->shared); case 2: return u->description; default: Q_ASSERT_X(false,"data","wrong column"); } } else if(role==Qt::DecorationRole) { if(index.column()==0) { bool op = u->flags & User::OP; bool passive = u->flags & User::PASSIVE; bool dcpp = u->flags & User::DCPLUSPLUS; if(op) { if(passive) { if(dcpp) return iconDcppPassiveOp; else return iconPassiveOp; } else if(dcpp) return iconDcppOp; else return iconOp; } else { if(passive) { if(dcpp) return iconDcppPassive; else return iconPassive;} else if(dcpp) return iconDcpp; else return iconNormal; } return iconNormal; } } return QVariant(); } QVariant UserListModel::headerData( int section, Qt::Orientation orientation, int role ) const { if( orientation==Qt::Horizontal && role==Qt::DisplayRole ) { switch(section) { case 0: return tr("Nick"); case 1: return tr("Shared"); case 2: return tr("Description"); } } return QVariant(); } void UserListModel::setUser( User *u ) { // See if the userid is already in the list. In that case, just copy the new values. if(userIdMap.contains(u->id)) { User* oldUser = userIdMap[u->id]; u->index = oldUser->index; (*oldUser) = *u; delete u; emit dataChanged(createIndex(oldUser->index,0),createIndex(oldUser->index,2)); } else { // Not in list - put it in. userIdMap[u->id] = u; //int index = userIndexMap.size(); int index = users.size(); u->index = index; //userIndexMap[index] = u; users.append(u); if(updateSignals) emit layoutChanged(); } } void UserListModel::removeUser( int userId ) { User* u = userIdMap.take(userId); if(u) { //userIndexMap.take(u->index); users.removeAt(u->index); for(int i=u->index;iindex=i; delete u; if(updateSignals) emit layoutChanged(); } } bool userNickLessThan(User* a,User*b) {return a->nick < b->nick;} bool userShareLessThan(User* a,User*b) {return a->shared < b->shared;} bool userDescLessThan(User* a,User*b) {return a->description < b->description;} bool userNickG(User* a,User*b) {return a->nick > b->nick;} bool userShareG(User* a,User*b) {return a->shared > b->shared;} bool userDescG(User* a,User*b) {return a->description > b->description;} void UserListModel::sort( int col, Qt::SortOrder order ) { if( order==Qt::AscendingOrder ) { switch(col) { case 0: qSort(users.begin(),users.end(),userNickLessThan);break; case 1: qSort(users.begin(),users.end(),userShareLessThan);break; case 2: qSort(users.begin(),users.end(),userDescLessThan);break; } } else { switch(col) { case 0: qSort(users.begin(),users.end(),userNickG);break; case 1: qSort(users.begin(),users.end(),userShareG);break; case 2: qSort(users.begin(),users.end(),userDescG);break; } } // Fix indexes for(int i=0;i < users.size();i++) users[i]->index = i; if(updateSignals) emit layoutChanged(); } dc-qt-0.2.0.alpha/ui/transferlistmodel.cpp0000644000175000017500000001134410433640765017524 0ustar whitewhite// // C++ Implementation: transferlistmodel // // Description: // // // Author: Rikard Björklind , (C) 2005 // // Copyright: See COPYING file that comes with this distribution // // #include #include "transferlistmodel.h" #include #include "util.h" #include "log.h" using namespace std; QVariant TransferListModel::data ( const QModelIndex & index, int role ) const { if(!index.isValid()) return QVariant(); if(index.row() < 0 || index.row() >= transfers.size()) return QVariant(); if(index.column() < 0 || index.column() >= NUM_COLUMNS) return QVariant(); if(role == Qt::DisplayRole) { int i = index.row(); switch(index.column()) { /* case 0: return transfers[i].pos; case 1: return transfers[i].startpos; case 2: return transfers[i].actual; case 3: return transfers[i].size; case 4: return transfers[i].averageSpeed; case 5: return transfers[i].secondsLeft; case 6: return transfers[i].bytesLeft; case 7: return transfers[i].filename; case 8: return transfers[i].localfilename; */ case COL_USER: return transfers[i].userid; case COL_FILE_NAME: return transfers[i].filename; case COL_SIZE_LEFT: return Util::bytesToStr(transfers[i].bytesLeft); case COL_SIZE_TOTAL: return Util::bytesToStr(transfers[i].size); case COL_AVG_SPEED: return Util::bytesToStr(transfers[i].averageSpeed); case COL_STATUS: return transfers[i].status; case COL_PROGRESS_BAR: { QList pdata; // Data position in the QList must match its index in the eProgressData enum. // This silly-looking loop populates the QList in the correct order. for (int ii=0; ii(transfers[i].startpos) ); break; case PDATA_POS: pdata.append( static_cast(transfers[i].pos) ); break; case PDATA_ACTUAL: pdata.append( static_cast(transfers[i].actual) ); break; case PDATA_SIZE: pdata.append( static_cast(transfers[i].size) ); break; case PDATA_SECONDS_LEFT: pdata.append( transfers[i].secondsLeft); break; default: break; } } return pdata; } default: break; } } return QVariant(); } QVariant TransferListModel::headerData ( int section, Qt::Orientation orientation, int role ) const { if (role != Qt::DisplayRole) return QVariant(); if(orientation==Qt::Horizontal) { switch(section) { case COL_USER: return tr("User"); case COL_FILE_NAME: return tr("File"); case COL_PROGRESS_BAR: return tr("Progress"); case COL_SIZE_LEFT: return tr("Size left"); case COL_SIZE_TOTAL: return tr("Total size"); case COL_AVG_SPEED: return tr("Avg. Speed"); case COL_STATUS: return tr("Status"); default: break; } /* if(section==0) return "Position"; if(section==1) return "StartPos"; if(section==2) return "Actual"; if(section==3) return "Size"; if(section==4) return "AvgSpeed"; if(section==5) return "TimeLeft"; if(section==6) return "BytesLeft"; if(section==7) return "Filename"; if(section==8) return "Localname"; */ } return QVariant(); } void TransferListModel::onTransferStart( const FileTransfer& f ) { logger->debug(f.toString()); if( !transfers.contains(f) ) transfers.append(f); emit layoutChanged(); } void TransferListModel::onTransferTick( const QList& fl) { //logger->debug("TransferListModel::onTransferTick"); int minIndex=2000000000; int maxIndex=0; bool newItems = false; for(int i=0;i < fl.size();i++) { if( !transfers.contains( fl[i] ) ) { transfers.append(fl[i]); newItems=true; } else { int ind = transfers.indexOf(fl[i]); transfers[ind] = fl[i]; if(ind < minIndex) minIndex=ind; if(ind > maxIndex) maxIndex=ind; } } if(newItems) emit layoutChanged(); if(maxIndex>=minIndex) emit dataChanged(createIndex(minIndex,0),createIndex(maxIndex,NUM_COLUMNS-1)); } void TransferListModel::onTransferComplete( const FileTransfer& f) { logger->info(QString("Transfer complete: ") + f.toString()); transfers.removeAll( f ); emit layoutChanged(); } void TransferListModel::onTransferFailed( const FileTransfer& f, const QString& errorMsg) { logger->error("Transfer failed: " + errorMsg); logger->info(f.toString()); //transfers.removeAll( f ); // Mark as failed, update status message field. int i = transfers.indexOf( f ); if( i != -1 ) { transfers[i].status = errorMsg; } emit layoutChanged(); } dc-qt-0.2.0.alpha/ui/searchmanager.cpp0000644000175000017500000001233310433640765016562 0ustar whitewhite#include "searchmanager.h" #include "../backend/CommonTypes.h" #include SearchManager::SearchManager(boost::shared_ptr aConnection,QObject *parent) : QObject(parent),backendConnection(aConnection), dockWidgetAdded(false) { QMainWindow *mw = static_cast(parent); displayMode = SHOW_AS_DOCKWINDOW; searchTabs = new QTabWidget(0); setupUi(mw); QPushButton* b = new QPushButton(searchTabs); QIcon i(":/images/remove.png"); b->setIcon(i); b->setFlat(true); b->setToolTip(tr("Close search")); searchTabs->setCornerWidget(b); connect(b,SIGNAL(pressed()),SLOT(onCloseCurrentSearch())); // create an initial search widget //activeSearch = new SearchWidget(0); //searchTabs->addTab(activeSearch,tr("Search")); //connect(activeSearch,SIGNAL(search( int , qint64 , int , int , const QString& )), // this,SLOT(search( int , qint64 , int , int , const QString & ))); //connect(activeSearch,SIGNAL(downloadFile(const SearchEntry&)),backendConnection.get(),SLOT(downloadFile(const SearchEntry&))); //connect(activeSearch,SIGNAL(downloadFile( int, const QString& , int64 , const QString& )),backendConnection.get(),SLOT(downloadFile( int, const QString& , int64 , const QString& ))); //connect(activeSearch,SIGNAL(downloadFileTo(const SearchEntry&, const QString&)),backendConnection.get(),SLOT(downloadFileTo(const SearchEntry&,const QString&))); //connect(activeSearch, //// SIGNAL(downloadFileTo( int, const QString&, int64, const QString&, const QString& )), // backendConnection.get(), // SLOT(downloadFileTo( int, const QString&, int64, const QString&, const QString& )) ); //connect(activeSearch,SIGNAL(getUserFileList(int)),backendConnection.get(),SLOT(getUserFileList(int))); activeSearch = newSearchWidget( tr("Search") ); } SearchManager::~SearchManager() { } void SearchManager::setupUi( QMainWindow* mw) { searchTabs->hide(); searchTabs->setParent(0); if(dialog) delete dialog; if(dock) delete dock; if(displayMode==SHOW_AS_DIALOG) { dialog = new QDialog; QVBoxLayout *layout = new QVBoxLayout(dialog); layout->addWidget(searchTabs); searchTabs->setParent(dialog); } else { dock = new QDockWidget(tr("Searches"),mw); searchTabs->setParent(dock); dock->setWidget(searchTabs); dock->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable); } searchTabs->show(); } void SearchManager::show(QMainWindow* mw ) { if(displayMode==SHOW_AS_DIALOG) dialog->show(); else { if(dock->isVisible()) { newSearchWidget( tr("Search") ); } if(!dockWidgetAdded) { mw->addDockWidget(Qt::RightDockWidgetArea,dock); dockWidgetAdded = true; } else dock->show(); } } void SearchManager::search( int session, qint64 size, int sizeMode, int typeMode, const QString & search, SearchWidget* destination ) { if( NULL == destination ) { activeSearch = newSearchWidget(search); } else { activeSearch = destination; } activeSearchType = typeMode; activeSearchString = search; searchTokens = activeSearchString.split(" "); backendConnection->sendSearch( session, size, sizeMode, typeMode, search ); } void SearchManager::searchResults( int session, QList &results) { // Filter QList< SearchEntry >::iterator it = results.begin(); while( it!=results.end() ) { if( (activeSearchType==backend::TYPE_TTH && activeSearchString!=it->getTTH()) || (activeSearchType!=backend::TYPE_TTH && !isSearchForActiveWidget(QString::fromStdString(it->getFile()))) ) { logger->debug("Erasing search because of filter"); it = results.erase(it); } else it++; } // Put them in the widget activeSearch->searchResults( session, results ); } SearchWidget * SearchManager::newSearchWidget(const QString& name) { SearchWidget *sw = new SearchWidget(0); searchTabs->addTab(sw,name); connect(sw,SIGNAL(search( int , qint64 , int , int , const QString&,SearchWidget* )), this,SLOT(search( int , qint64 , int , int , const QString &,SearchWidget* ))); connect(sw,SIGNAL(downloadFile(const SearchEntry&)),backendConnection.get(),SLOT(downloadFile(const SearchEntry&))); connect(sw,SIGNAL(downloadFile( int, const QString& , int64 , const QString& )),backendConnection.get(),SLOT(downloadFile( int, const QString& , int64 , const QString& ))); connect(sw,SIGNAL(downloadFileTo(const SearchEntry&, const QString&)),backendConnection.get(),SLOT(downloadFileTo(const SearchEntry&,const QString&))); connect(sw, SIGNAL(downloadFileTo( int, const QString&, int64, const QString&, const QString& )), backendConnection.get(), SLOT(downloadFileTo( int, const QString&, int64, const QString&, const QString& )) ); connect(sw,SIGNAL(getUserFileList(int)),backendConnection.get(),SLOT(getUserFileList(int))); return sw; } void SearchManager::onCloseCurrentSearch( ) { if(searchTabs->count() <= 1) return; SearchWidget* curr = qobject_cast( searchTabs->currentWidget() ); int curri = searchTabs->currentIndex(); searchTabs->removeTab(curri); if( curr == activeSearch ) activeSearch = 0; delete curr; } bool SearchManager::isSearchForActiveWidget( const QString& searchStr ) const { QStringList::const_iterator it = searchTokens.begin(); while( it != searchTokens.end() && searchStr.contains( *it, Qt::CaseInsensitive ) ) { ++it; } return it == searchTokens.end(); } dc-qt-0.2.0.alpha/ui/ui.pro0000644000175000017500000000451210433640765014415 0ustar whitewhite# File generated by kdevelop's qmake manager. # ------------------------------------------- # Subdir relative project main directory: . # Target is an application: FORMS += createfavourite.ui \ favouritehublist.ui \ hub.ui \ mainwindow.ui \ publichublist.ui \ search.ui \ searchdock.ui \ settings.ui \ connectdialog.ui \ userfilelisting.ui IDLS += settings.ui HEADERS += mainwindow.h \ backendconnection.h \ filelog.h \ settingsdialog.h \ publichubswidget.h \ rpctypes.h \ commandhandlers.h \ session.h \ sessionmanager.h \ userlistmodel.h \ user.h \ blockallocator.h \ shareitemmodel.h \ searchwidget.h \ searchmanager.h \ searchentry.h \ connectdialog.h \ searchtablemodel.h \ queueitem.h \ queuemodel.h \ filetransfer.h \ exceptions.h \ globalusermodel.h \ finisheditem.h \ finishedmodel.h \ transferlistitemdelegate.h \ transferlistmodel.h \ favouritehubswidget.h \ userfilemodel.h \ userfiledialog.h \ nicetreeview.h \ createfavouritedialog.h SOURCES += main.cpp \ mainwindow.cpp \ backendconnection.cpp \ filelog.cpp \ settingsdialog.cpp \ publichubswidget.cpp \ commandhandlers.cpp \ session.cpp \ sessionmanager.cpp \ userlistmodel.cpp \ shareitemmodel.cpp \ searchwidget.cpp \ searchmanager.cpp \ searchtablemodel.cpp \ queuemodel.cpp \ globalusermodel.cpp \ finishedmodel.cpp \ transferlistitemdelegate.cpp \ transferlistmodel.cpp \ favouritehubswidget.cpp \ connectdialog.cpp \ userfilemodel.cpp \ nicetreeview.cpp \ createfavouritedialog.cpp \ userfiledialog.cpp TEMPLATE = app TARGET += DEPENDPATH += . CONFIG += qt release INCPATH += . ../rpcdriver ../ ../backend /usr/include RESOURCES += res.qrc unix{ LIBS = -L../rpcdriver -L/usr/local/lib -lrpc -lboost_thread -lboost_program_options } dc-qt-0.2.0.alpha/ui/createfavouritedialog.h0000644000175000017500000000120710433640765017775 0ustar whitewhite/* * createfavouritedialog.h * ui * * Created by Mikael Gransell on 4/18/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #ifndef CREATE_FAVOURITE_DIALOG_H_ #define CREATE_FAVOURITE_DIALOG_H_ #include "backendconnection.h" #include #include "ui_createfavourite.h" class CreateFavouriteDialog : public QDialog { Q_OBJECT public: CreateFavouriteDialog( const BackendConnectionPtr& backendConn, QWidget* parent = NULL ); ~CreateFavouriteDialog() {} public slots: void on_createButton_clicked(); private: BackendConnectionPtr backendConnection; Ui::CreateFavouriteDialog ui; }; #endif dc-qt-0.2.0.alpha/ui/search.ui0000644000175000017500000001753710433640765015075 0ustar whitewhite searchForm 0 0 682 429 Form 9 6 0 6 5 5 0 0 Search 9 6 1 1 0 0 true 0 6 Size at least at most 1 0 1 0 9999 B KiB MiB GiB 0 6 Type: 1 0 1 0 Any type Audio Compressed Documents Executables Pictures Video Directories TTH 0 6 Qt::Horizontal 40 20 Search true Qt::Horizontal Hide results with zero slots Qt::Vertical 20 40 7 7 1 0 dc-qt-0.2.0.alpha/ui/user.h0000644000175000017500000000132210433640765014401 0ustar whitewhite#ifndef USER_H__ #define USER_H__ #include "global.h" #include "blockallocator.h" #include using namespace std; class User : public BlockAllocator { enum { OP_BIT, ONLINE_BIT, DCPLUSPLUS_BIT, PASSIVE_BIT, QUIT_HUB_BIT, HIDDEN_BIT, HUB_BIT, BOT_BIT }; public: enum { OP = 1<