Revision 1795
| trunk/ChangeLog (revision 1795) | ||
|---|---|---|
| 6 | 6 |
| NNTPGrab 0.6.91 | |
| 7 | 7 |
+-----------------+ |
| 8 | 8 |
|
| 9 |
Released at Saturday December 18 2010 |
|
| 9 |
Released at Sunday December 19 2010 |
|
| 10 | 10 |
|
| 11 | 11 |
General changes: |
| 12 | 12 |
- Made the Qt frontend the default frontend for Win32, Win64 and OSX environments |
| trunk/client/gui_qt/NGApplication.cpp (revision 1795) | ||
|---|---|---|
| 1 |
#include |
|
| 2 |
|
|
| 3 |
#include "NGApplication.h" |
|
| 4 |
|
|
| 5 |
NGApplication::NGApplication(int &argc, char **argv) : |
|
| 6 |
QtSingleApplication(argc, argv) |
|
| 7 |
{
|
|
| 8 |
} |
|
| 9 |
|
|
| 10 |
bool NGApplication::event(QEvent *event) |
|
| 11 |
{
|
|
| 12 |
switch (event->type()) {
|
|
| 13 |
case QEvent::FileOpen: |
|
| 14 |
emit loadFile(static_cast |
|
| 15 |
return true; |
|
| 16 |
default: |
|
| 17 |
return QtSingleApplication::event(event); |
|
| 18 |
} |
|
| 19 |
} |
|
| trunk/client/gui_qt/gui_qt.pro (revision 1795) | ||
|---|---|---|
| 40 | 40 |
AutoImport.cpp \ |
| 41 | 41 |
DownloadQueueModel.cpp \ |
| 42 | 42 |
DownloadQueueItem.cpp \ |
| 43 |
DownloadQueueSelectionModel.cpp |
|
| 43 |
DownloadQueueSelectionModel.cpp \ |
|
| 44 |
NGApplication.cpp |
|
| 44 | 45 |
HEADERS += mainwindow.h \ |
| 45 | 46 |
QNNTPGrabGlue.h \ |
| 46 | 47 |
WidgetConfig.h \ |
| ... | ... | |
| 73 | 74 |
AutoImport.h \ |
| 74 | 75 |
DownloadQueueModel.h \ |
| 75 | 76 |
DownloadQueueItem.h \ |
| 76 |
DownloadQueueSelectionModel.h |
|
| 77 |
DownloadQueueSelectionModel.h \ |
|
| 78 |
NGApplication.h |
|
| 77 | 79 |
FORMS += mainwindow.ui \ |
| 78 | 80 |
WidgetConfig.ui \ |
| 79 | 81 |
WidgetDownloadQueue.ui \ |
| trunk/client/gui_qt/mainwindow.cpp (revision 1795) | ||
|---|---|---|
| 16 | 16 |
#include "icon_64x64.xpm" |
| 17 | 17 |
#pragma GCC diagnostic warning "-Wwrite-strings" |
| 18 | 18 |
|
| 19 |
MainWindow::MainWindow(QNNTPGrabGlue *glue, QtSingleApplication *app, QWidget *parent) : |
|
| 19 |
MainWindow::MainWindow(QNNTPGrabGlue *glue, NGApplication *app, QWidget *parent) : |
|
| 20 | 20 |
QMainWindow(parent), |
| 21 | 21 |
ui(new Ui::MainWindow) |
| 22 | 22 |
{
|
| ... | ... | |
| 71 | 71 |
|
| 72 | 72 |
this->setWindowIcon(icon); |
| 73 | 73 |
|
| 74 |
#ifdef Q_OS_MAC |
|
| 75 |
/* Register the file association for OSX (other platforms use a different method) */ |
|
| 76 |
connect(app, SIGNAL(loadFile(QString)), SLOT(loadNZBFile(QString))); |
|
| 77 |
#endif |
|
| 78 |
|
|
| 74 | 79 |
connect(ui->actionImportNZBFile, SIGNAL(triggered(void)), |
| 75 | 80 |
SLOT(actionImportNZB_activated(void))); |
| 76 | 81 |
connect(ui->actionPauseDownloadQueue, SIGNAL(triggered(void)), |
| ... | ... | |
| 145 | 150 |
QFile f(arg); |
| 146 | 151 |
if (f.exists()) {
|
| 147 | 152 |
/* Try to open it */ |
| 148 |
DialogImportNZB d(glue); |
|
| 149 |
d.readNZBFile(arg); |
|
| 150 |
d.exec(); |
|
| 153 |
loadNZBFile(arg); |
|
| 151 | 154 |
} |
| 152 | 155 |
} |
| 153 | 156 |
} |
| ... | ... | |
| 363 | 366 |
} |
| 364 | 367 |
} |
| 365 | 368 |
|
| 369 |
void MainWindow::loadNZBFile(QString filename) |
|
| 370 |
{
|
|
| 371 |
DialogImportNZB d(glue); |
|
| 372 |
d.readNZBFile(filename); |
|
| 373 |
d.exec(); |
|
| 374 |
} |
|
| 375 |
|
|
| 366 | 376 |
void MainWindow::showTrayIcon() |
| 367 | 377 |
{
|
| 368 | 378 |
QPixmap pixmap(icon_64x64_xpm); |
| trunk/client/gui_qt/DialogConnect.h (revision 1795) | ||
|---|---|---|
| 13 | 13 |
class DialogConnect : public QDialog {
|
| 14 | 14 |
Q_OBJECT |
| 15 | 15 |
public: |
| 16 |
DialogConnect(QtSingleApplication *app, QWidget *parent = 0); |
|
| 16 |
DialogConnect(NGApplication *app, QWidget *parent = 0); |
|
| 17 | 17 |
~DialogConnect(); |
| 18 | 18 |
|
| 19 | 19 |
protected: |
| ... | ... | |
| 24 | 24 |
MainWindow *w; |
| 25 | 25 |
QNNTPGrabGlue *glue; |
| 26 | 26 |
ConfigGuiOpts gui_opts; |
| 27 |
QtSingleApplication *app; |
|
| 27 |
NGApplication *app; |
|
| 28 | 28 |
|
| 29 | 29 |
void doConnect(QString hostname, int port); |
| 30 | 30 |
|
| trunk/client/gui_qt/NGApplication.h (revision 1795) | ||
|---|---|---|
| 1 |
#ifndef NGAPPLICATION_H |
|
| 2 |
#define NGAPPLICATION_H |
|
| 3 |
|
|
| 4 |
#include |
|
| 5 |
|
|
| 6 |
class NGApplication : public QtSingleApplication |
|
| 7 |
{
|
|
| 8 |
Q_OBJECT |
|
| 9 |
public: |
|
| 10 |
explicit NGApplication(int &argc, char **argv); |
|
| 11 |
|
|
| 12 |
protected: |
|
| 13 |
bool event(QEvent *event); |
|
| 14 |
|
|
| 15 |
signals: |
|
| 16 |
void loadFile(QString filename); |
|
| 17 |
}; |
|
| 18 |
|
|
| 19 |
#endif // NGAPPLICATION_H |
|
| trunk/client/gui_qt/DialogConnect.cpp (revision 1795) | ||
|---|---|---|
| 6 | 6 |
#include "QNNTPGrabGlue.h" |
| 7 | 7 |
#include "mainwindow.h" |
| 8 | 8 |
|
| 9 |
DialogConnect::DialogConnect(QtSingleApplication *app, QWidget *parent) : |
|
| 9 |
DialogConnect::DialogConnect(NGApplication *app, QWidget *parent) : |
|
| 10 | 10 |
QDialog(parent), |
| 11 | 11 |
ui(new Ui::DialogConnect) |
| 12 | 12 |
{
|
| trunk/client/gui_qt/mainwindow.h (revision 1795) | ||
|---|---|---|
| 3 | 3 |
|
| 4 | 4 |
#include |
| 5 | 5 |
#include |
| 6 |
#include |
|
| 7 | 6 |
|
| 7 |
#include "NGApplication.h" |
|
| 8 | 8 |
#include |
| 9 | 9 |
#include "ConfigGuiOpts.h" |
| 10 | 10 |
#include "WidgetUpdateInfo.h" |
| ... | ... | |
| 24 | 24 |
class MainWindow : public QMainWindow {
|
| 25 | 25 |
Q_OBJECT |
| 26 | 26 |
public: |
| 27 |
MainWindow(QNNTPGrabGlue *glue, QtSingleApplication *app, QWidget *parent = 0); |
|
| 27 |
MainWindow(QNNTPGrabGlue *glue, NGApplication *app, QWidget *parent = 0); |
|
| 28 | 28 |
~MainWindow(); |
| 29 | 29 |
|
| 30 | 30 |
void setShowNotificationOnFileDownloaded(bool enabled); |
| ... | ... | |
| 81 | 81 |
void trayIconActivated(QSystemTrayIcon::ActivationReason); |
| 82 | 82 |
|
| 83 | 83 |
void onMessageReceived(QString); |
| 84 |
|
|
| 85 |
void loadNZBFile(QString filename); |
|
| 84 | 86 |
}; |
| 85 | 87 |
|
| 86 | 88 |
#endif // MAINWINDOW_H |
| trunk/client/gui_qt/main.cpp (revision 1795) | ||
|---|---|---|
| 19 | 19 |
int main(int argc, char *argv[]) |
| 20 | 20 |
{
|
| 21 | 21 |
qInstallMsgHandler(messagehandler); |
| 22 |
QtSingleApplication a(argc, argv); |
|
| 22 |
NGApplication a(argc, argv); |
|
| 23 | 23 |
|
| 24 | 24 |
#ifdef WIN32 |
| 25 | 25 |
/* Initialise Winsock */ |
Also available in: Unified diff
NNTPGrab

