dUpload::dUpload( const QString &file, QWidget *parent ) : QWidget( parent ) { ui.setupUi( this ); ui.progress->setVisible( false ); move( qApp->desktop()->screenGeometry().center() - rect().center() ); m_icon.addFile( ":/dUpload.ico" ); setWindowIcon( m_icon ); droparea = new dropArea( this ); connect( droparea, SIGNAL( changed( const QString &, const QString & ) ), this, SLOT( changed( const QString &, const QString & ) ) ); connect( droparea, SIGNAL( clicked() ), this, SLOT( clicked() ) ); ui.layout->addWidget( droparea, 0, 0 ); QAbstractEventDispatcher::instance()->installNativeEventFilter( this ); QNetworkProxyFactory::setUseSystemConfiguration( true ); m_netman = new QNetworkAccessManager(); connect( m_netman, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( finished( QNetworkReply * ) ) ); m_trayicon = new dTrayIcon( this ); m_webcam_creating = false; //new dPlayerMpc( this ); #ifdef Q_OS_WIN m_dll = new dDll(); connect( dSettings::instance(), &dSettings::settingsChanged, m_dll, &dDll::updateSettings ); #endif m_file = new dFile(); setUserlogin( QString() ); dExternal::instance( this ); dGlobalHotKey::instance()->shortcut("Alt+B"); dGlobalHotKey::instance()->shortcut("Alt+N"); dGlobalHotKey::instance()->shortcut("Alt+V"); dGlobalHotKey::instance()->shortcut("Alt+S"); dGlobalHotKey::instance()->shortcut("Alt+E"); dGlobalHotKey::instance()->shortcut("Alt+A"); dGlobalHotKey::instance()->shortcut("Ctrl+Shift+S"); dGlobalHotKey::instance()->shortcut("Ctrl+Shift+W"); dGlobalHotKey::instance()->shortcut("Ctrl+Shift+F"); dGlobalHotKey::instance()->shortcut("Ctrl+Shift+Alt+S"); dGlobalHotKey::instance()->shortcut("Ctrl+Shift+Alt+F"); connect( dGlobalHotKey::instance(), SIGNAL( hotKeyPressed( quint32 ) ), this, SLOT( hotKeyPressed( quint32 ) ) ); if ( QFileInfo( file ).isFile() ) changed( file ); }
void dUpload::keyPressEvent( QKeyEvent *event ) { #if defined( Q_WS_WIN ) || defined( Q_WS_MAC ) quint32 key = event->nativeVirtualKey(); #elif defined( Q_WS_X11 ) quint32 key = event->nativeScanCode(); #endif if ( key == nativeKeycode( 'T' ) || key == nativeKeycode( 'P' ) ) { if ( !m_filename.isEmpty() ) new dPreview( m_filename ); } else if ( key == nativeKeycode( 'H' ) ) { hide(); } else if ( key == nativeKeycode( 'B' ) ) { sendFromClipboard(); } else if ( key == nativeKeycode( 'N' ) ) { sendFromClipboard( 1 ); } else if ( key == nativeKeycode( 'W' ) ) { show( windowFlags() ^ Qt::WindowStaysOnTopHint ); } else if ( key == nativeKeycode( 'R' ) ) { dExternal::instance( this )->userRegister(); } else if ( key == nativeKeycode( 'A' ) ) { dExternal::instance( this )->userAuth(); } else if ( key == nativeKeycode( 'D' ) ) { setPasskey(); setUserlogin(); notify( "You're logged out" ); } else if ( key == nativeKeycode( 'L' ) ) { showLast(); } else if ( key == nativeKeycode( 'S' ) ) { dSettings::instance()->show(); } }