<autoinstall>false</autoinstall>
<autokdesu>false</autokdesu>
<envvars/>
+ <runarguments>
+ <qtrapids></qtrapids>
+ </runarguments>
+ <cwd>
+ <qtrapids>/home/vaatala/Projects/qtrapids/trunk</qtrapids>
+ </cwd>
+ <debugarguments>
+ <qtrapids></qtrapids>
+ </debugarguments>
</run>
<general>
- <activedir>src</activedir>
+ <activedir>src/gui</activedir>
</general>
<make>
<abortonerror>true</abortonerror>
<openfiles/>
</workspace>
<kdevfilecreate>
+ <filetypes/>
<useglobaltypes>
<type ext="ui" />
+ <type ext="qrc" />
<type ext="cpp" />
<type ext="h" />
<type ext="ts" />
- <type ext="qrc" />
</useglobaltypes>
</kdevfilecreate>
<kdevdocumentation>
<projectdoc>
<docsystem>Doxygen Documentation Collection</docsystem>
<docurl>qtrapids.tag</docurl>
+ <usermanualurl></usermanualurl>
</projectdoc>
</kdevdocumentation>
<substmap>
*/
class DownloadViewItem : public QTreeWidgetItem {
- public:
-
+ public:
DownloadViewItem(QTreeWidget* parent, int type) :
- QTreeWidgetItem(parent, type = QTreeWidgetItem::UserType)
- {
- };
+ QTreeWidgetItem(parent, type = QTreeWidgetItem::UserType) {};
DownloadViewItem(const QStringList& strings,
- int type = QTreeWidgetItem::UserType ) :
- QTreeWidgetItem (strings, type = Type)
- {
- };
+ int type = QTreeWidgetItem::UserType) :
+ QTreeWidgetItem (strings, type = Type) {};
/// @return An item comprising of string list, suitable for QTableView
static DownloadViewItem *getHeaderItem()
{
DownloadViewItem *item
- = new DownloadViewItem(QStringList() << "Name"
+ = new DownloadViewItem(QStringList()
+ << "Name"
<< "Size" << "Status"
<< "Progress" << "DL speed"
<< "UL speed" << "Seeds/Leechers"
- << "ratio" << "ETA");
+ << "Ratio" << "ETA");
return item;
}
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+
+
+#include <QDebug>
+
+
+#include <QToolBar>
+#include <QAction>
+#include <QFileDialog>
+
+#include "DownloadView.h"
+#include "SeedView.h"
+
#include "MainWindow.h"
+
+
MainWindow::MainWindow()
{
+
+ tabWidget_ = new QTabWidget();
+
+ /// @todo Exception handling
+ dlView_ = new DownloadView(this);
+ seedView_ = new SeedView(this);
+
+ tabWidget_->addTab(dlView_, "Downloads");
+ tabWidget_->addTab(seedView_, "Seeds");
+
+ // Tab widget as central widget.
+ setCentralWidget(tabWidget_);
+
+ QToolBar *toolBar = new QToolBar();
+ toolBar->addAction("Open");
+
+ addToolBar(Qt::TopToolBarArea, toolBar);
+
+ connect(toolBar, SIGNAL(actionTriggered(QAction*)), this, SLOT(handleToolBarAction(QAction*)));
+
}
}
+void MainWindow::handleToolBarAction(QAction* action)
+{
+
+ if (action->text() == "Open") {
+ QFileDialog *dialog = new QFileDialog( this, "Open torrent file", QString(), tr("Torrent files (*.torrent)"));
+ dialog->setFileMode(QFileDialog::ExistingFile);
+ dialog->show();
+ } else {
+ }
+
+
+}
+
class QTabWidget;
+class DownloadView;
+class SeedView;
/**
@author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
public slots:
private slots:
+ void handleToolBarAction(QAction* action);
private:
QTabWidget *tabWidget_;
-
-
+ DownloadView *dlView_;
+ SeedView *seedView_;
};
#endif
***************************************************************************/
#include "SeedView.h"
-SeedView::SeedView(QWidget* parent): QTreeWidget(parent)
+SeedView::SeedView(QWidget* parent):
+ QTreeWidget(parent)
{
+ setRootIsDecorated(false); // Hide branch lines, making one-level treeview (similar to list)
+ setHeaderItem(SeedViewItem::getHeaderItem());
}
// ratio
};
+/**
+ @class DownloadViewItem
+ @brief Represents one item row of DownloadView
+ */
+class SeedViewItem : public QTreeWidgetItem {
+
+ public:
+
+ SeedViewItem(QTreeWidget* parent, int type) :
+ QTreeWidgetItem(parent, type = QTreeWidgetItem::UserType) {};
+
+ SeedViewItem(const QStringList& strings, int type = QTreeWidgetItem::UserType ) :
+ QTreeWidgetItem (strings, type = Type) {};
+
+
+ /// @return An item comprising of string list, suitable for QTableView
+ /// header.
+ static SeedViewItem *getHeaderItem()
+ {
+ SeedViewItem *item
+ = new SeedViewItem(QStringList()
+ << "Name"
+ << "Size" << "Status"
+ << "Progress" << "UL speed" << "Seeds/Leechers"
+ << "Conn. peers"
+ << "Ratio");
+
+ return item;
+ }
+
+ /// @todo QTorrentHandle as one hidden column
+};
+
#endif
CONFIG -= release
-CONFIG += debug
+CONFIG += debug \
+ qtestlib
+
+DESTDIR = ../../
***************************************************************************/
#include <QApplication>
#include <QDebug>
-#include "DownloadView.h"
+#include <QTest>
+//#include "DownloadView.h"
+
+#include "MainWindow.h"
int main(int argc, char *argv[])
{
+
+
// Q_INIT_RESOURCE(application);
QApplication app(argc, argv);
+ MainWindow *mainWindow = new MainWindow();
+ mainWindow->show();
+ /*
DownloadView* dlw = new DownloadView(NULL);
//qtrapids * mw = new qtrapids();
dlw->show();
<< "Progress" << "DL speed"
<< "UL speed" << "Seeds/Leechers"
<< "ratio");
- dlwItem->insertChild(0, new DownloadViewItem(QStringList() << "Name"));
+ DownloadViewItem* dlwItem2 = new DownloadViewItem(QStringList() << "Name"
+ << "1000" << "Downloading"
+ << "23%" << "11"
+ << "0.1" << "0/2"
+ << "1.10");
+ //dlwItem->insertChild(0, new DownloadViewItem(QStringList() << "Name"));
dlw->insertTopLevelItem(0,dlwItem);
- qDebug() << dlw->columnCount();
+ dlw->insertTopLevelItem(1,dlwItem2);
+
+ for (unsigned i = 0; i < 10; ++i)
+ {
+ DownloadViewItem *editItem = dynamic_cast<DownloadViewItem*>
+ (dlw->itemAt(QPoint(0,0)));
+ editItem->setData ( 8, Qt::DisplayRole, QVariant("EDITED" + QString::number(i, 'g', 2)));
+ QTest::qSleep(2000);
+ }
+ */
+
+
return app.exec();
}