MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    // Setup UI
    ui->setupUi(this);
    // Set start tab as blank
    QLabel *newTab = new QLabel(ui->tabWidget);
    newTab->setText(tr("Neither camera connected nor file loaded."));
    newTab->setAlignment(Qt::AlignCenter);
    ui->tabWidget->addTab(newTab, "");
    ui->tabWidget->setTabsClosable(false);
    // Add "Connect to Camera" button to tab
    connectToCameraButton = new QPushButton();
    connectToCameraButton->setText(tr("Connect/Open"));
    ui->tabWidget->setCornerWidget(connectToCameraButton, Qt::TopLeftCorner);
    connect(connectToCameraButton,SIGNAL(released()),this, SLOT(connectToCamera()));
    connect(ui->tabWidget,SIGNAL(tabCloseRequested(int)),this, SLOT(disconnectCamera(int)));
    // Set focus on button
    connectToCameraButton->setFocus();
    connectToCameraButton->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_O));
    // Connect other signals/slots
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelpDialog()));
    connect(ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(showAboutQtDialog()));
    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->actionFullScreen, SIGNAL(toggled(bool)), this, SLOT(setFullScreen(bool)));
    connect(ui->actionConnect_Open, SIGNAL(triggered()), this, SLOT(connectToCamera()));
    // Create SharedImageBuffer object
    sharedImageBuffer = new SharedImageBuffer();

    addCodecs();
}
void Katapult::initAccel(QWidget *parent)
{
    globalAccel = new KGlobalAccel(parent);
    globalAccel->insert("show_katapult", i18n("Show Launcher"), i18n("Shows the Katapult launcher"), ALT+Key_Space, ALT+Key_Space,
                        this, SLOT(showLauncher()));
    globalAccel->readSettings();
    globalAccel->updateConnections();

    actions = new KActionCollection(parent);
    actionCollection()->clear();

    contextMenu()->clear();

    new KAction(i18n("Execute"), "exec", Key_Return, this, SLOT(execute()), actions, "execute");
    new KAction(i18n("Clear"), "editclear", Key_Left, this, SLOT(clearQuery()), actions, "clear");
    new KAction(i18n("Close"), "fileclose", Key_Escape, this, SLOT(hideLauncher()), actions, "close");
    new KAction(i18n("Complete Query"), "next", Key_Right, this, SLOT(completeQuery()), actions, "complete_query");
    new KAction(i18n("Show Context Menu"), "menu", CTRL+Key_C, this, SLOT(showContextMenu()), actions, "show_menu");

    KAction *actGlobAccel = KStdAction::keyBindings(this, SLOT(showGlobalShortcutsDialog()), actions);
    actGlobAccel->setText(i18n("Configure &Global Shortcuts..."));
    actGlobAccel->plug((QWidget *) contextMenu());

    KStdAction::keyBindings(this, SLOT(showShortcutsDialog()), actions)->plug((QWidget *) contextMenu());
    KStdAction::preferences(settings, SLOT(configure()), actions)->plug((QWidget *) contextMenu());

    contextMenu()->insertSeparator();
    KStdAction::aboutApp(this, SLOT(showAboutDialog()), actions)->plug((QWidget *) contextMenu());
    contextMenu()->insertSeparator();

    KStdAction::quit(this, SLOT(close()), actions)->plug((QWidget *) contextMenu());

    actions->readShortcutSettings();
}
Beispiel #3
0
/*!
  \internal
  \brief Establishes all connections.
 */
void Ui::MainWindow::establishConnections()
{
    Ui::CommonBar *commonBar = qobject_cast<Ui::CommonBar *>(actionManager->toolBar(Core::ID::COMMON_BAR));
    connect(commonBar, SIGNAL(antialiasingChanged(bool)), this, SIGNAL(antialiasingChanged(bool)));

    connect(newAction, SIGNAL(triggered()), this, SLOT(showProjectCreateDialog()));
    connect(openAction, SIGNAL(triggered()), this, SLOT(showOpenDialog()));
    //connect(actionManager->action(Core::ID::Action::NEW), SIGNAL(triggered()), this, SLOT(showPreferencesDialog()));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));

    // tool box actions
    connect(lineToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(lineToolAction, Core::ID::ACTION_DRAW_LINE);
    connect(textToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(textToolAction, Core::ID::ACTION_DRAW_TEXT);
    connect(curveToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(curveToolAction, Core::ID::ACTION_DRAW_CURVE);
    connect(ellipseToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(ellipseToolAction, Core::ID::ACTION_DRAW_ELLIPSE);
    connect(polygonToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(polygonToolAction, Core::ID::ACTION_DRAW_POLYGON);
    connect(rectangleToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(rectangleToolAction, Core::ID::ACTION_DRAW_RECT);
    connect(roundRectangleToolAction, SIGNAL(triggered()), mapper, SLOT(map()));
    mapper->setMapping(roundRectangleToolAction, Core::ID::ACTION_DRAW_ROUND_RECT);
    connect(mapper, SIGNAL(mapped(QString)), appCtx, SLOT(setCurrentAction(QString)));
    connect(mapper, SIGNAL(mapped(QString)), commonBar, SLOT(resetCommonBar(QString)));

    connect(ci, SIGNAL(foregroundColorChanged(QColor)), appCtx, SLOT(setPenColor(const QColor &)));
}
Beispiel #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    coordinatesIsNeeded(true)
{
    ui->setupUi(this);
    ui->enableGpsCheckbox->setChecked(coordinatesIsNeeded);
    ui->videoSlider->setEnabled(false);
    connect(ui->actionOpen, SIGNAL(triggered()), SLOT(openFile()));
    connect(&timer, SIGNAL(timeout()), this, SLOT(stepVideo()));
    connect(ui->videoSlider, SIGNAL(sliderMoved(int)), this, SLOT(startVideo(int)));
    connect(ui->videoSlider, SIGNAL(valueChanged(int)), this, SLOT(startVideo(int)));
    connect(ui->calcSpeedButton, SIGNAL(clicked()), this, SLOT(calculateSpeed()));
    connect(ui->enableGpsCheckbox, SIGNAL(stateChanged(int)), this, SLOT(changeGpsOutputState(int)));
    connect(ui->playPauseButton, SIGNAL(clicked()), this, SLOT(playPause()));
    connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stop()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    QStyle *pStyle = qApp->style();
    QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPlay);
    ui->playPauseButton->setIcon(icon);

    icon = pStyle->standardIcon(QStyle::SP_MediaStop);
    ui->stopButton->setIcon(icon);

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
}
Beispiel #5
0
MainWindow::MainWindow(QWidget *parent) :
   QMainWindow(parent),
   ui(new Ui::MainWindow),
   theCurImageIndex(0),
   theProcessingInProgressFlag(false)
{
   ui->setupUi(this);

   theDragModeStrings.insert(QGraphicsView::NoDrag, "No Drag Mode");
   theDragModeStrings.insert(QGraphicsView::RubberBandDrag, "Selection Mode");
   theDragModeStrings.insert(QGraphicsView::ScrollHandDrag, "Scroll Mode");

   connect(ui->thePic, SIGNAL(scrollModeChanged(QGraphicsView::DragMode)),
           this, SLOT(updateStatusBar(QGraphicsView::DragMode)));

   connect(ui->thePic, SIGNAL(rectangleSelected(QPoint,QPoint)),
           this, SLOT(rectangleSelection(QPoint,QPoint)));

   // List manipulation button handlers
   connect(ui->theUpButton, SIGNAL(clicked()),
           this, SLOT(movePageSelectionUp()));
   connect(ui->theDownButton, SIGNAL(clicked()),
           this, SLOT(movePageSelectionDown()));
   connect(ui->theDeleteButton, SIGNAL(clicked()),
           this, SLOT(deletePageSelection()));

   // Want to know when the Process Images button should be enabled.  The rectangleSelection and deletePageSelection
   // button are the two buttons that effect the number of items in the list
   connect(ui->thePic, SIGNAL(rectangleSelected(QPoint,QPoint)),
           this, SLOT(isImageProcessingAllowed()));
   connect(ui->theDeleteButton, SIGNAL(clicked()),
           this, SLOT(isImageProcessingAllowed()));

   connect(ui->theNextImageButton, SIGNAL(clicked()),
           this, SLOT(nextImage()));
   connect(ui->thePreviousImageButton, SIGNAL(clicked()),
           this, SLOT(previousImage()));

   connect(ui->theProcessImagesButton, SIGNAL(clicked()),
           this, SLOT(processImages()));
   connect(ui->theWritePdfButton, SIGNAL(clicked()),
           this, SLOT(writePdf()));

   // Connect menu buttons
   connect(ui->actionAbout, SIGNAL(triggered()),
           this, SLOT(showAboutDialog()));
   connect(ui->actionAbout_Qt, SIGNAL(triggered()),
           this, SLOT(showAboutQtDialog()));
   connect(ui->actionStart_Server, SIGNAL(triggered()),
           this, SLOT(startServerDialog()));
   connect(ui->actionOpen_Directory, SIGNAL(triggered()),
           this, SLOT(openDirectoryChooser()));

   updateStatusBar(ui->thePic->dragMode());
}
Beispiel #6
0
QAction *BApplicationPrivate::createStandardAction(BGuiTools::StandardAction type, QObject *parent)
{
    if (!testInit("BApplicationPrivate"))
        return 0;
    QAction *act = 0;
    switch (type) {
    case BGuiTools::SettingsAction:
        act = new QAction(parent);
        act->setMenuRole(QAction::PreferencesRole);
        act->setObjectName("ActionSettings");
        act->setIcon(BApplication::icon("configure"));
        act->setShortcut(QKeySequence::Preferences);
        connect(act, SIGNAL(triggered()), qs_func(), SLOT(showSettingsDialog()));
        break;
    case BGuiTools::HomepageAction:
        act = new QAction(parent);
        act->setObjectName("ActionHomepage");
        act->setIcon(BApplication::icon("gohome"));
        connect(act, SIGNAL(triggered()), qs_func(), SLOT(openHomepage()));
        break;
    case BGuiTools::HelpContentsAction:
        act = new QAction(parent);
        act->setObjectName("ActionHelpContents");
        act->setIcon(BApplication::beqtIcon("help_contents"));
        connect(act, SIGNAL(triggered()), qs_func(), SLOT(showHelpContents()));
        break;
    case BGuiTools::ContextualHelpAction:
        act = new QAction(parent);
        act->setObjectName("ActionContextualHelp");
        act->setIcon(BApplication::icon("help_contextual"));
        connect(act, SIGNAL(triggered()), qs_func(), SLOT(showContextualHelp()));
        break;
    case BGuiTools::WhatsThisAction:
        act = QWhatsThis::createAction(parent);
        act->setObjectName("ActionWhatsThis");
        act->setIcon(BApplication::beqtIcon("help_hint"));
        break;
    case BGuiTools::AboutAction:
        act = new QAction(parent);
        act->setMenuRole(QAction::AboutRole);
        act->setObjectName("ActionAbout");
        act->setIcon(BApplication::icon("help_about"));
        connect(act, SIGNAL(triggered()), qs_func(), SLOT(showAboutDialog()));
        break;
    default:
        return 0;
    }
    act->setProperty("beqt/standard_action_type", type);
    qs_func()->ds_func()->actions.insert(act, act);
    connect(act, SIGNAL(destroyed(QObject *)), qs_func()->ds_func(), SLOT(actionDestroyed(QObject *)));
    retranslateStandardAction(act);
    return act;
}
Beispiel #7
0
void MainWidget::createTrayIcon()
{    
    trayIcon = createTrayObject(this);
    trayIcon->init();

#ifndef Q_OS_WIN32
    trayIcon->setIcon("qcma_off");
#else
    trayIcon->setIcon("tray/qcma_off_16");
#endif
    trayIcon->show();

    connect(trayIcon, SIGNAL(openConfig()), this, SLOT(openConfig()));
    connect(trayIcon, SIGNAL(openManager()), this, SLOT(openManager()));
    connect(trayIcon, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
    connect(trayIcon, SIGNAL(showAboutDialog()), this, SLOT(showAboutDialog()));
    connect(trayIcon, SIGNAL(showAboutQt()), this, SLOT(showAboutQt()));
    connect(trayIcon, SIGNAL(stopServer()), this, SLOT(stopServer()));

    connect(managerForm, SIGNAL(deviceConnected(QString)), this, SLOT(deviceConnect(QString)));
    connect(managerForm, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect()));
    connect(managerForm, SIGNAL(messageSent(QString)), this, SLOT(receiveMessage(QString)));
}
void Classifier::initGui()
{
  mActionClassify = new QAction( QIcon( ":/classifier/icons/classifier.png" ), tr( "DTclassifier" ), this );
  mActionClassify->setWhatsThis( tr( "Raster classification using decision tree" ) );
  connect( mActionClassify, SIGNAL( triggered() ), this, SLOT( showMainDialog() ) );

  mActionAbout = new QAction( QIcon( ":/classifier/icons/about.png" ), tr( "About" ), this );
  mActionAbout->setWhatsThis( tr( "About DTclassifier" ) );
  connect( mActionAbout, SIGNAL( triggered() ), this, SLOT( showAboutDialog() ) );

  // Add the icon to the toolbar
  mIface->addToolBarIcon( mActionClassify );
  mIface->addPluginToMenu( tr( "DTclassifier" ), mActionClassify );
  mIface->addPluginToMenu( tr( "DTclassifier" ), mActionAbout );
}
Beispiel #9
0
void License::contextMenuEvent( QWidget *w, QContextMenuEvent *e )
{
    if ( !m_contextMenu ) {
        m_contextMenu = contextMenu();

        QAction *toggleAction = m_contextMenu->addAction( tr("&Full License"), this,
                                SLOT(toggleLicenseSize()) );
        toggleAction->setCheckable( true );
        toggleAction->setChecked( m_showFullLicense );

        m_contextMenu->addAction( tr("&Show Details"), this, SLOT(showAboutDialog()) );
    }

    Q_ASSERT( m_contextMenu );
    m_contextMenu->exec( w->mapToGlobal( e->pos() ) );
}
/*!
    \brief Grabs a screenshot of the full desktop and shows that as background. Above that background the
    AboutDialog 3D animation is shown. Also grabs the content of the AboutDialog itself.
 */
void AboutDialogGraphicsView::show() {
    // Because on X11 system the window decoration is only available after a widget has been shown once,
    // we can detect _windowTitleBarWidth here for the first time.
    _windowTitleBarWidth = _parentWindow->geometry().y() - _parentWindow->y();
    // If the _windowTitleBarWidth could not be determined, try it a second way. Even the chances are low to get good results.
    if ( _windowTitleBarWidth == 0 )
        _windowTitleBarWidth = _parentWindow->frameGeometry().height() - _parentWindow->geometry().height();
#ifdef Q_OS_LINUX
    if ( _windowTitleBarWidth == 0 ) {
        //TODO: 27 pixel is a fix value for the Ubuntu 10.4 default window theme and so just a workaround for that specific case.
        _windowPosOffset = 27;
        _windowTitleBarWidth = 27;
    }
#endif
    QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), QApplication::desktop()->availableGeometry().x(), QApplication::desktop()->availableGeometry().y(), geometry().width(), geometry().height() );
    QBrush brush(originalPixmap);
    QTransform transform;
    transform.translate(0, QApplication::desktop()->availableGeometry().y());
    brush.setTransform(transform);

    setBackgroundBrush(brush);

    _aboutDialogAsSplashScreen->setPixmap( QPixmap::grabWidget(_aboutDialog) );
    _graphicsProxyWidget->setGeometry( _aboutDialog->geometry() );
    _aboutDialog->hide();
    _graphicsProxyWidget->setPos( _parentWindow->geometry().x()+(_parentWindow->geometry().width()-_graphicsProxyWidget->geometry().width()) / 2, _parentWindow->y()+_windowTitleBarWidth-_windowPosOffset);

    QRectF r = _graphicsProxyWidget->boundingRect();
    _graphicsProxyWidget->setTransform(QTransform()
        .translate(r.width() / 2, -_windowTitleBarWidth)
        .rotate(270, Qt::XAxis)
        //.rotate(90, Qt::YAxis)
        //.rotate(5, Qt::ZAxis)
        //.scale(1 + 1.5 * step, 1 + 1.5 * step)
        .translate(-r.width() / 2, _windowTitleBarWidth));

    _graphicsProxyWidget->show();
    //_aboutDialogAsSplashScreen->show();
    QGraphicsView::show();

    connect(_timeLine, SIGNAL(finished()), this, SLOT(showAboutDialog()));
    _timeLine->setDirection(QTimeLine::Forward);
    _timeLine->start();
}
AboutDialogExtension::AboutDialogExtension(Workspace *workspace, QObject *parent) :
    WorkspaceExtension(workspace, parent)
{
	{ // About PaintField
		auto action = new QAction(this);
		action->setObjectName(_aboutActionName);
		connect(action, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
		
		addAction(action);
	}
	
	{ // About Qt
		auto action = new QAction(this);
		action->setObjectName(_aboutQtActionName);
		connect(action, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
		
		addAction(action);
	}
}
Beispiel #12
0
void KDENotifierTray::init()
{
    options = new QAction(tr("Settings"), this);
    reload = new QAction(tr("Refresh database"), this);
    backup = new QAction(tr("Backup Manager"), this);
    about = new QAction(tr("About QCMA"), this);
    about_qt = new QAction(tr("About Qt"), this);
    quit = new QAction(tr("Quit"), this);

    connect(options, SIGNAL(triggered()), this, SIGNAL(openConfig()));
    connect(backup, SIGNAL(triggered()), this, SIGNAL(openManager()));
    connect(reload, SIGNAL(triggered()), this, SIGNAL(refreshDatabase()));
    connect(about, SIGNAL(triggered()), this, SIGNAL(showAboutDialog()));
    connect(about_qt, SIGNAL(triggered()), this, SIGNAL(showAboutQt()));
    connect(quit, SIGNAL(triggered()), this, SIGNAL(stopServer()));

#if QT_VERSION < 0x050000
    KMenu *tray_icon_menu = new KMenu(this);
#else
    QMenu *tray_icon_menu = new QMenu(this);
#endif

    tray_icon_menu->addAction(options);
    tray_icon_menu->addAction(reload);
    tray_icon_menu->addAction(backup);
    tray_icon_menu->addSeparator();
    tray_icon_menu->addAction(about);
    tray_icon_menu->addAction(about_qt);
    tray_icon_menu->addSeparator();
    tray_icon_menu->addAction(quit);

    m_notifier_item = new KDENotifier("QcmaNotifier", this);
    m_notifier_item->setContextMenu(tray_icon_menu);
    m_notifier_item->setTitle("Qcma");
    m_notifier_item->setCategory(KStatusNotifierItem::ApplicationStatus);
    m_notifier_item->setIconByPixmap(QIcon(":/main/resources/images/qcma_off.png"));
    m_notifier_item->setStatus(KStatusNotifierItem::Active);
    m_notifier_item->setToolTipTitle(tr("Qcma status"));
    m_notifier_item->setToolTipIconByPixmap(QIcon(":/main/resources/images/qcma.png"));
    m_notifier_item->setToolTipSubTitle(tr("Disconnected"));
    m_notifier_item->setStandardActionsEnabled(false);
}
Beispiel #13
0
MainWindow::MainWindow() :
    StackedWindow(),
    m_serviceModel(new ServiceModel(this)),
    m_serviceAction(new ValueSelectorAction(this)),
    m_nowPlayingAction(new NowPlayingAction(this)),
    m_playFolderAction(new QAction(tr("Play folder"), this)),
    m_queueFolderAction(new QAction(tr("Queue folder"), this)),
    m_playUrlAction(new QAction(tr("Play URL"), this)),
    m_queueUrlAction(new QAction(tr("Queue URL"), this)),
    m_transfersAction(new QAction(tr("Transfers"), this)),
    m_settingsAction(new QAction(tr("Settings"), this)),
    m_aboutAction(new QAction(tr("About"), this))
{
    m_serviceAction->setText(tr("Service"));
    m_serviceAction->setModel(m_serviceModel);
    m_serviceAction->setValue(Settings::currentService());
    
    menuBar()->addAction(m_serviceAction);
    menuBar()->addAction(m_playFolderAction);
    menuBar()->addAction(m_queueFolderAction);
    menuBar()->addAction(m_playUrlAction);
    menuBar()->addAction(m_queueUrlAction);
    menuBar()->addAction(m_transfersAction);
    menuBar()->addAction(m_settingsAction);
    menuBar()->addAction(m_aboutAction);
    menuBar()->addAction(m_nowPlayingAction);
    
    connect(m_serviceAction, SIGNAL(valueChanged(QVariant)), this, SLOT(setService(QVariant)));
    connect(m_playFolderAction, SIGNAL(triggered()), this, SLOT(playFolder()));
    connect(m_queueFolderAction, SIGNAL(triggered()), this, SLOT(queueFolder()));
    connect(m_playUrlAction, SIGNAL(triggered()), this, SLOT(playUrl()));
    connect(m_queueUrlAction, SIGNAL(triggered()), this, SLOT(queueUrl()));
    connect(m_transfersAction, SIGNAL(triggered()), this, SLOT(showTransfers()));
    connect(m_settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog()));
    connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    connect(AudioPlayer::instance(), SIGNAL(statusChanged(AudioPlayer::Status)),
            this, SLOT(onPlayerStatusChanged(AudioPlayer::Status)));
    connect(Transfers::instance(), SIGNAL(transferAdded(Transfer*)), this, SLOT(onTransferAdded(Transfer*)));
    
    setService(Settings::currentService());
}
Beispiel #14
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle(QString(tr(APP_NAME)));
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(on_pushButton_clicked()));
    connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(copy2clipBoard()));
    connect(ui->textEdit_2, SIGNAL(textChanged()), this, SLOT(on_SMSTxt_Edit()));
    connect(ui->textEdit_3, SIGNAL(textChanged()), this, SLOT(on_addSMSTxt_Edit()));
    connect(ui->radioButton, SIGNAL(clicked()), this, SLOT(on_adjTime_Button_Edit()));
    connect(ui->radioButton_2, SIGNAL(clicked()), this, SLOT(on_adjTime_Button_Edit()));
    connect(ui->spinBox_8, SIGNAL(editingFinished()), this, SLOT(on_screenPara_Eidt()));
    connect(ui->spinBox_9, SIGNAL(editingFinished()), this, SLOT(on_screenPara_Eidt()));
    connect(ui->spinBox_5, SIGNAL(editingFinished()), this, SLOT(on_stayTime_Edit()));
    connect(ui->action_4, SIGNAL(changed()), this, SLOT(on_advPara_Check())),
    connect(ui->action_3, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    //connect(ui->spinBox_5, SIGNAL()
    ui->textEdit->setTextColor(Qt::blue);
    smsTxt = "";
    //ui->textEdit->setFont();
    on_SMSTxt_Edit();
    on_addSMSTxt_Edit();
    /*
#define CALL_SMS_INDEX 5
#define ADD_PHN_INDEX  6
#define DEL_PHN_INDEX  7
#define SET_SCREEN_PARA_INDEX 8
*/
    ui->smsTab->removeTab(CALL_SMS_INDEX);//CALL_SMS_INDEX);//->setVisible(false);
    ui->smsTab->removeTab(CALL_SMS_INDEX);//->setVisible(false);
    ui->smsTab->removeTab(CALL_SMS_INDEX);//->setVisible(false);
    ui->smsTab->removeTab(CALL_SMS_INDEX);//->setVisible(false);
    //ui->smsTab->removeTab();
    //ui->smsTab->removeTab();
}
RouterKeygen::RouterKeygen(QWidget *parent) :
    QMainWindow(parent), ui(new Ui::RouterKeygen), manualWifi(NULL),matcher(new WirelessMatcher()),
    calculator(NULL), loading(NULL), loadingText(NULL), aboutDialog(NULL), welcomeDialog(NULL){
    ui->setupUi(this);
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
    setWindowIcon(QIcon(":/big_icon.png"));
#endif
    connect(ui->calculateButton, SIGNAL( clicked() ), this,
            SLOT( manualCalculation() ));
    connect(ui->refreshScan, SIGNAL( clicked() ), this,
            SLOT( refreshNetworks() ));
    connect(ui->supportedNetworkslist, SIGNAL( cellClicked(int,int) ), this,
            SLOT( supportedNetworkRowSelected(int,int) ));
    connect(ui->unlikelyNetworkslist, SIGNAL( cellClicked(int,int) ), this,
            SLOT( unlikelyNetworkRowSelected(int,int) ));
    connect(ui->unsupportedNetworkslist, SIGNAL( cellClicked(int,int) ), this,
            SLOT( unsupportedNetworkRowSelected(int,int) ));

    connect(ui->actionDonate,SIGNAL(triggered()), this, SLOT(donatePaypal()));
    connect(ui->actionDonate_Google_Play, SIGNAL(triggered()),this, SLOT(donateGooglePlay()) );
    connect(ui->actionFeedback, SIGNAL(triggered()), this,SLOT(feedback()));
    connect(ui->actionAbout, SIGNAL(triggered()), this,SLOT(showAboutDialog()) );
    connect(ui->actionCheck_for_Updates, SIGNAL(triggered()), this,SLOT(checkUpdates()));
    ui->actionCheck_for_Updates->setEnabled(false); //It is enabled after the automatic update check
#if defined(Q_OS_MAC)


#endif
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
    connect(ui->forceRefresh, SIGNAL( stateChanged(int) ), this,
            SLOT( forceRefreshToggle(int) ));
#else
    ui->forceRefresh->setVisible(false); // it is not needed in Windows or Mac
#endif

    wifiManager = new QWifiManager();
    connect(wifiManager, SIGNAL( scanFinished(int) ), this,
            SLOT( scanFinished(int) ));
    loadingAnim = new QMovie(":/loading.gif");
    loadingAnim->setParent(this);
    //Auto-Complete!
    wordList << "Alice-" <<  "Arcor-" << "AXTEL-" << "AXTEL-XTREMO-" << "Bbox-" <<
            "BigPond" << "Blink" << "Cabovisao-" << "CONN" << "CYTA" << "Discus--"<<
            "DLink-" << "DMAX" << "EasyBox-" << "eircom" << "FASTWEB-1-" << "INFINITUM" <<
            "InfostradaWiFi-" << "InterCable" << "JAZZTEL_" << "MAXCOM" << "Megared" <<
            "MEO-" << "O2Wireless" << "Optimus" << "OptimusFibra" << "Orange-" << "OTE" <<
            "Otenet" << "PBS" << "privat" << "ptv" << "SKY" << "SpeedTouch" << "TECOM-AH4222-" <<
            "TECOM-AH4021-" << "TeleTu" << "Thomson" << "TN_private_" << "Vodafone-" << "WiFi" <<
            "wifimedia_R-" << "WLAN_" << "WLAN" << "YaCom";
    completer = new QCompleter(wordList, this);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setCompletionMode(QCompleter::PopupCompletion);
    ui->ssidInput->setCompleter(completer);
    ui->passwordsList->installEventFilter(this);

    // build menu
    trayMenu = new QMenu(this);
    trayIcon = new QSystemTrayIcon(this);
    // set up and show the system tray icon
    trayIcon->setIcon(QIcon(":/tray_icon.png"));
    trayIcon->setContextMenu(trayMenu);
    trayIcon->show();
    
    //Set widget ration
    ui->splitterVertical->setStretchFactor(0, 3);
    ui->splitterVertical->setStretchFactor(1, 2);
    
    settings = new QSettings("Exobel", "RouterKeygen");
    bool forceRefresh = settings->value(FORCE_REFRESH, false).toBool();
    wifiManager->setForceScan(forceRefresh);
    ui->forceRefresh->setChecked(forceRefresh);
    runInBackground = settings->value(RUN_IN_BACKGROUND, false).toBool();
    runOnStartUp = settings->value(RUN_ON_START_UP, false).toBool();
    qApp->setQuitOnLastWindowClosed(!runInBackground);

    startUpAction = ui->menuPreferences->addAction(tr("Run on Start up"));
    startUpAction->setCheckable(true);
    startUpAction->setChecked(runOnStartUp);
    connect(startUpAction, SIGNAL(toggled(bool)), this,
            SLOT(startUpRunToggle(bool)));

    runInBackgroundAction = ui->menuPreferences->addAction(tr("Run in the background"));
    runInBackgroundAction->setCheckable(true);
    runInBackgroundAction->setChecked(runInBackground);
    connect(runInBackgroundAction, SIGNAL(toggled(bool)), this,
            SLOT(backgroundRunToggle(bool)));

    //Set up the tray icon
    connect(trayMenu->addAction(tr("Open")),
            SIGNAL(triggered()), this, SLOT(show()));
    trayMenu->addSeparator();
    connect(trayMenu->addAction(tr("Vulnerable networks")),
            SIGNAL(triggered()), this, SLOT(show()));
    trayMenu->addAction(tr("None were detected"))->setEnabled(false);
    trayMenu->addSeparator();
    trayMenu->addAction(startUpAction);
    trayMenu->addAction(runInBackgroundAction);
    trayMenu->addSeparator();
    connect(trayMenu->addAction(tr("Quit")), SIGNAL(triggered()), qApp, SLOT(quit()));

    //Do an initial scan
    wifiManager->startScan();

    //Check for application updates, it fails silently
    automaticUpdateCheck = true;
    checkUpdates();
}
Beispiel #16
0
//}
Conn::Conn(Ui_MainWindow *parent)
{
        connect(parent->actionAbout, SIGNAL(triggered()),
                this, SLOT(showAboutDialog()));
}
Beispiel #17
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    m_transferMenu(new QMenu(tr("Download"), this)),
    m_packageMenu(new QMenu(tr("Package"), this)),
    m_addUrlsAction(new QAction(QIcon::fromTheme("general_add"), tr("Add URLs"), this)),
    m_importUrlsAction(new QAction(QIcon::fromTheme("general_toolbar_folder"), tr("Import URLs"), this)),
    m_retrieveUrlsAction(new QAction(QIcon::fromTheme("general_search"), tr("Retrieve URLs"), this)),
    m_clipboardUrlsAction(new QAction(QIcon::fromTheme("general_share"), tr("Clipboard URLs"), this)),
    m_queueAction(new QAction(QIcon("/etc/hildon/theme/mediaplayer/Play.png"), tr("Start all DLs"), this)),
    m_pauseAction(new QAction(QIcon("/etc/hildon/theme/mediaplayer/Pause.png"), tr("Pause all DLs"), this)),
    m_propertiesAction(new QAction(QIcon::fromTheme("general_information"), tr("Properties"), this)),
    m_transferQueueAction(new QAction(tr("Start"), this)),
    m_transferPauseAction(new QAction(tr("Pause"), this)),
    m_transferCancelAction(new QAction(tr("Remove"), this)),
    m_transferCancelDeleteAction(new QAction(tr("Remove and delete files"), this)),
    m_packageQueueAction(new QAction(tr("Start"), this)),
    m_packagePauseAction(new QAction(tr("Pause"), this)),
    m_packageCancelAction(new QAction(tr("Remove"), this)),
    m_packageCancelDeleteAction(new QAction(tr("Remove and delete files"), this)),
    m_settingsAction(new QAction(tr("Settings"), this)),
    m_pluginsAction(new QAction(tr("Load plugins"), this)),
    m_aboutAction(new QAction(tr("About"), this)),
    m_concurrentAction(new ValueSelectorAction(tr("Maximum concurrent DLs"), this)),
    m_nextAction(new ValueSelectorAction(tr("After current DLs"), this)),
    m_view(new QTreeView(this)),
    m_toolBar(new QToolBar(this)),
    m_activeLabel(new QLabel(QString("%1DLs").arg(TransferModel::instance()->activeTransfers()), this)),
    m_speedLabel(new QLabel(Utils::formatBytes(TransferModel::instance()->totalSpeed()) + "/s", this))
{
    setWindowTitle("QDL");
    setCentralWidget(m_view);
    addToolBar(Qt::BottomToolBarArea, m_toolBar);

    menuBar()->addAction(m_concurrentAction);
    menuBar()->addAction(m_nextAction);
    menuBar()->addAction(m_queueAction);
    menuBar()->addAction(m_pauseAction);
    menuBar()->addAction(m_settingsAction);
    menuBar()->addAction(m_pluginsAction);
    menuBar()->addAction(m_aboutAction);

    m_addUrlsAction->setShortcut(tr("Ctrl+N"));
    m_importUrlsAction->setShortcut(tr("Ctrl+O"));
    m_retrieveUrlsAction->setShortcut(tr("Ctrl+F"));
    m_propertiesAction->setShortcut(tr("Ctrl+I"));
    m_propertiesAction->setEnabled(false);
    m_clipboardUrlsAction->setShortcut(tr("Ctrl+U"));
    m_pluginsAction->setShortcut(tr("Ctrl+L"));

    m_transferMenu->addAction(m_transferQueueAction);
    m_transferMenu->addAction(m_transferPauseAction);
    m_transferMenu->addAction(m_transferCancelAction);
    m_transferMenu->addAction(m_transferCancelDeleteAction);

    m_packageMenu->addAction(m_packageQueueAction);
    m_packageMenu->addAction(m_packagePauseAction);
    m_packageMenu->addAction(m_packageCancelAction);
    m_packageMenu->addAction(m_packageCancelDeleteAction);

    m_concurrentAction->setModel(new ConcurrentTransfersModel(m_concurrentAction));
    m_concurrentAction->setValue(Settings::maximumConcurrentTransfers());
    m_nextAction->setModel(new ActionModel(m_nextAction));
    m_nextAction->setValue(Settings::nextAction());

    QLabel *speedIcon = new QLabel(m_toolBar);
    speedIcon->setPixmap(QIcon::fromTheme("general_received").pixmap(m_toolBar->iconSize()));

    QWidget *spacer1 = new QWidget(m_toolBar);
    spacer1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    
    QWidget *spacer2 = new QWidget(m_toolBar);
    spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    
    m_activeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    m_speedLabel->setMinimumWidth(m_speedLabel->fontMetrics().width("9999.99MB/s"));
    m_speedLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    m_toolBar->setAllowedAreas(Qt::BottomToolBarArea);
    m_toolBar->setContextMenuPolicy(Qt::PreventContextMenu);
    m_toolBar->setMovable(false);
    m_toolBar->addAction(m_addUrlsAction);
    m_toolBar->addAction(m_importUrlsAction);
    m_toolBar->addAction(m_retrieveUrlsAction);
    m_toolBar->addAction(m_clipboardUrlsAction);
    m_toolBar->addAction(m_propertiesAction);
    m_toolBar->addWidget(spacer1);
    m_toolBar->addWidget(m_activeLabel);
    m_toolBar->addWidget(spacer2);
    m_toolBar->addWidget(m_speedLabel);
    m_toolBar->addWidget(speedIcon);

    m_view->setModel(TransferModel::instance());
    m_view->setSelectionBehavior(QTreeView::SelectRows);
    m_view->setContextMenuPolicy(Qt::CustomContextMenu);
    m_view->setEditTriggers(QTreeView::NoEditTriggers);
    m_view->setExpandsOnDoubleClick(true);
    m_view->setItemsExpandable(true);
    m_view->setUniformRowHeights(true);
    m_view->setAllColumnsShowFocus(true);

    QHeaderView *header = m_view->header();
    
    if (!header->restoreState(Settings::transferViewHeaderState())) {
        const QFontMetrics fm = header->fontMetrics();
        header->resizeSection(0, 200);
        header->resizeSection(2, fm.width("999.99MB of 999.99MB (99.99%)"));
        header->resizeSection(3, fm.width("999.99KB/s"));
        header->hideSection(1); // Hide priority column
    }
    
    connect(Settings::instance(), SIGNAL(maximumConcurrentTransfersChanged(int)),
            this, SLOT(onMaximumConcurrentTransfersChanged(int)));
    connect(Settings::instance(), SIGNAL(nextActionChanged(int)), this, SLOT(onNextActionChanged(int)));
    
    connect(TransferModel::instance(), SIGNAL(captchaRequest(TransferItem*)), this, SLOT(showCaptchaDialog(TransferItem*)));
    connect(TransferModel::instance(), SIGNAL(settingsRequest(TransferItem*)), this, SLOT(showPluginSettingsDialog(TransferItem*)));
    connect(TransferModel::instance(), SIGNAL(activeTransfersChanged(int)), this, SLOT(onActiveTransfersChanged(int)));
    connect(TransferModel::instance(), SIGNAL(totalSpeedChanged(int)), this, SLOT(onTotalSpeedChanged(int)));

    connect(m_transferMenu, SIGNAL(aboutToShow()), this, SLOT(setTransferMenuActions()));
    connect(m_packageMenu, SIGNAL(aboutToShow()), this, SLOT(setPackageMenuActions()));

    connect(m_addUrlsAction, SIGNAL(triggered()), this, SLOT(showAddUrlsDialog()));
    connect(m_importUrlsAction, SIGNAL(triggered()), this, SLOT(showImportUrlsDialog()));
    connect(m_retrieveUrlsAction, SIGNAL(triggered()), this, SLOT(showRetrieveUrlsDialog()));
    connect(m_clipboardUrlsAction, SIGNAL(triggered()), this, SLOT(showClipboardUrlsDialog()));
    connect(m_queueAction, SIGNAL(triggered()), TransferModel::instance(), SLOT(queue()));
    connect(m_pauseAction, SIGNAL(triggered()), TransferModel::instance(), SLOT(pause()));
    connect(m_propertiesAction, SIGNAL(triggered()), this, SLOT(showCurrentItemProperties()));
    
    connect(m_transferQueueAction, SIGNAL(triggered()), this, SLOT(queueCurrentTransfer()));
    connect(m_transferPauseAction, SIGNAL(triggered()), this, SLOT(pauseCurrentTransfer()));
    connect(m_transferCancelAction, SIGNAL(triggered()), this, SLOT(cancelCurrentTransfer()));
    connect(m_transferCancelDeleteAction, SIGNAL(triggered()), this, SLOT(cancelAndDeleteCurrentTransfer()));

    connect(m_packageQueueAction, SIGNAL(triggered()), this, SLOT(queueCurrentPackage()));
    connect(m_packagePauseAction, SIGNAL(triggered()), this, SLOT(pauseCurrentPackage()));
    connect(m_packageCancelAction, SIGNAL(triggered()), this, SLOT(cancelCurrentPackage()));
    connect(m_packageCancelDeleteAction, SIGNAL(triggered()), this, SLOT(cancelAndDeleteCurrentPackage()));

    connect(m_settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog()));
    connect(m_pluginsAction, SIGNAL(triggered()), this, SLOT(loadPlugins()));
    connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));

    connect(m_concurrentAction, SIGNAL(valueChanged(QVariant)), this, SLOT(setMaximumConcurrentTransfers(QVariant)));
    connect(m_nextAction, SIGNAL(valueChanged(QVariant)), this, SLOT(setNextAction(QVariant)));

    connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
    connect(m_view->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
            this, SLOT(onCurrentRowChanged(QModelIndex)));
}
Beispiel #18
0
/**
 * @brief MenuActions::createActions
 * Creates all the action objects.
 */
void MenuActions::createActions()
{
   newAct = new QAction(QIcon(":/newicon.png"), tr("&New..."), parent());
   newAct->setShortcuts(QKeySequence::New);
   connect(newAct, SIGNAL(triggered()), parent()->parent(), SLOT(addWindow()));

   openAct = new QAction(QIcon(":/openicon.png"), tr("&Open..."), parent());
   openAct->setShortcuts(QKeySequence::Open);
   openAct->setStatusTip(tr("Open an existing file"));
   connect(openAct, SIGNAL(triggered()), this, SLOT(openFile()));

   saveAct = new QAction(QIcon(":/saveicon.png"), tr("&Save"), parent());
   saveAct->setShortcuts(QKeySequence::Save);
   saveAct->setStatusTip(tr("Save the document to disk"));
   connect(saveAct, SIGNAL(triggered()), this, SLOT(saveFile()));

   saveAsAct = new QAction(tr("Save &As..."), parent());
   saveAsAct->setShortcuts(QKeySequence::SaveAs);
   saveAsAct->setStatusTip(tr("Save the document under a new name"));

   copyRowsAct = new QAction(tr("Copy selected rows"), parent());
   copyRowsAct->setShortcuts(QKeySequence::Copy);
   connect(copyRowsAct, SIGNAL(triggered()), parent(), SLOT(copySelectedRows()));
   copyRowsAct->setEnabled(false);

   removeRowsAct = new QAction(tr("Remove the selected rows"), parent());
   removeRowsAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
   connect(removeRowsAct, SIGNAL(triggered()), parent(), SLOT(removeSelectedRows()));
   removeRowsAct->setEnabled(false);

   closeWindowAct = new QAction(tr("Close &window"), parent());
   closeWindowAct->setShortcuts(QKeySequence::Close);
   connect(closeWindowAct, SIGNAL(triggered()), parent(), SLOT(close()));

   exitAct = new QAction(tr("&Quit program"), parent());
   exitAct->setShortcuts(QKeySequence::Quit);
   exitAct->setStatusTip(tr("Exit the application"));
   connect(exitAct, SIGNAL(triggered()), parent()->parent(), SLOT(quit()));

   displaySidebarAct = new QAction(tr("Display sidebar"), parent());
   displaySidebarAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B));
   displaySidebarAct->setCheckable(true);
   displaySidebarAct->setChecked(true);
   connect(displaySidebarAct, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));

   displayFileToolbarAct = new QAction(tr("Display shortcut menu"), parent());
   displayFileToolbarAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
   displayFileToolbarAct->setCheckable(true);
   displayFileToolbarAct->setChecked(true);
   connect(displayFileToolbarAct, SIGNAL(triggered(bool)), this, SLOT(setMenubarVisible(bool)));

   displayFileSizeAct = new QAction(tr("Display file size"), parent());
   displayFileSizeAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
   displayFileSizeAct->setCheckable(true);
   displayFileSizeAct->setChecked(true);
   connect(displayFileSizeAct, SIGNAL(triggered(bool)), this, SLOT(setFileSizeVisible(bool)));

   aboutAct = new QAction(tr("&About"), parent());
   aboutAct->setStatusTip(tr("Show the application's About box"));
   connect(aboutAct, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
}
Beispiel #19
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    m_fileMenu(new QMenu(tr("&File"), this)),
    m_viewMenu(new QMenu(tr("&View"), this)),
    m_playbackMenu(new QMenu(tr("&Playback"), this)),
    m_transfersMenu(new QMenu(tr("&Downloads"), this)),
    m_editMenu(new QMenu(tr("&Edit"), this)),
    m_helpMenu(new QMenu(tr("&About"), this)),
    m_openFilesAction(new QAction(QIcon::fromTheme("document-open"), tr("&Open files"), this)),
    m_openUrlAction(new QAction(QIcon::fromTheme("folder-remote"), tr("Open &URL"), this)),
    m_addFilesAction(new QAction(QIcon::fromTheme("list-add"), tr("&Add files"), this)),
    m_addUrlAction(new QAction(QIcon::fromTheme("folder-remote"), tr("Add &URL"), this)),
    m_searchAction(new QAction(QIcon::fromTheme("edit-find"), tr("&Search"), this)),
    m_pluginsAction(new QAction(QIcon::fromTheme("view-refresh"), tr("Load &plugins"), this)),
    m_quitAction(new QAction(QIcon::fromTheme("application-exit"), tr("&Quit"), this)),
    m_showPlaybackQueueAction(new QAction(QIcon::fromTheme("music-library"), tr("Show &playback queue"), this)),
    m_showTransfersAction(new QAction(QIcon::fromTheme("folder-publicshare"), tr("Show &transfers"), this)),
    m_reloadAction(new QAction(QIcon::fromTheme("view-refresh"), tr("&Reload current tab"), this)),
    m_closeAction(new QAction(QIcon::fromTheme("list-remove"), tr("&Close current tab"), this)),
    m_playPauseAction(new QAction(QIcon::fromTheme("media-playback-start"), tr("&Play"), this)),
    m_stopAction(new QAction(QIcon::fromTheme("media-playback-stop"), tr("&Stop"), this)),
    m_previousAction(new QAction(QIcon::fromTheme("media-skip-backward"), tr("&Previous"), this)),
    m_nextAction(new QAction(QIcon::fromTheme("media-skip-forward"), tr("&Next"), this)),
    m_repeatAction(new QAction(QIcon::fromTheme("media-playlist-repeat"), tr("&Repeat"), this)),
    m_shuffleAction(new QAction(QIcon::fromTheme("media-playlist-shuffle"), tr("&Shuffle"), this)),
    m_stopAfterCurrentAction(new QAction(tr("Stop &after current track"), this)),
    m_clearAction(new QAction(QIcon::fromTheme("list-remove"), tr("&Clear playback queue"), this)),
    m_startTransfersAction(new QAction(QIcon::fromTheme("media-playback-start"), tr("&Start transfers"), this)),
    m_pauseTransfersAction(new QAction(QIcon::fromTheme("media-playback-pause"), tr("&Pause transfers"), this)),
    m_settingsAction(new QAction(QIcon::fromTheme("preferences-desktop"), tr("&Preferences"), this)),
    m_aboutAction(new QAction(QIcon::fromTheme("help-about"), tr("&About"), this)),
    m_positionSpacer(new QWidget(this)),
    m_positionSpacerAction(0),
    m_positionSlider(new QSlider(Qt::Horizontal, this)),
    m_positionSliderAction(0),
    m_positionLabel(new QLabel(this)),
    m_positionLabelAction(0),
    m_toolBar(new QToolBar(this)),
    m_widget(new QWidget(this)),
    m_tabWidget(new QTabWidget(m_widget)),
    m_nowPlayingMetaData(new ItemMetaData(m_widget)),
    m_layout(new QVBoxLayout(m_widget))
{
    setWindowTitle("MusiKloud2");
    
    // Initialise status bar
    statusBar();
    
    // Add menus
    menuBar()->addMenu(m_fileMenu);
    menuBar()->addMenu(m_viewMenu);
    menuBar()->addMenu(m_playbackMenu);
    menuBar()->addMenu(m_transfersMenu);
    menuBar()->addMenu(m_editMenu);
    menuBar()->addMenu(m_helpMenu);
    
    // Setup file menu
    m_fileMenu->addAction(m_openFilesAction);
    m_fileMenu->addAction(m_openUrlAction);
    m_fileMenu->addAction(m_addFilesAction);
    m_fileMenu->addAction(m_addUrlAction);
    m_fileMenu->addAction(m_searchAction);
    m_fileMenu->addSeparator();
    m_fileMenu->addAction(m_pluginsAction);
    m_fileMenu->addAction(m_quitAction);
    
    // Setup file menu actions
    m_openFilesAction->setShortcut(tr("Ctrl+O"));
    m_openUrlAction->setShortcut(tr("Ctrl+U"));
    m_addFilesAction->setShortcut(tr("Ctrl+Shift+O"));
    m_addUrlAction->setShortcut(tr("Ctrl+Shift+U"));
    m_searchAction->setShortcut(tr("Ctrl+Y"));
    m_pluginsAction->setShortcut(tr("Ctrl+L"));
    m_quitAction->setShortcut(tr("Ctrl+Q"));
    
    // Setup view menu
    m_viewMenu->addAction(m_showPlaybackQueueAction);
    m_viewMenu->addAction(m_showTransfersAction);
    m_viewMenu->addSeparator();
    m_viewMenu->addAction(m_reloadAction);
    m_viewMenu->addAction(m_closeAction);
    
    // Setup view menu actions
    m_reloadAction->setEnabled(false);
    m_closeAction->setShortcut(tr("Ctrl+W"));
    m_closeAction->setEnabled(false);
    
    // Setup playback menu
    m_playbackMenu->addAction(m_playPauseAction);
    m_playbackMenu->addAction(m_stopAction);
    m_playbackMenu->addAction(m_previousAction);
    m_playbackMenu->addAction(m_nextAction);
    m_playbackMenu->addSeparator();
    m_playbackMenu->addAction(m_repeatAction);
    m_playbackMenu->addAction(m_shuffleAction);
    m_playbackMenu->addAction(m_stopAfterCurrentAction);
    m_playbackMenu->addSeparator();
    m_playbackMenu->addAction(m_clearAction);
    
    // Setup playback menu actions
    m_playPauseAction->setShortcut(tr("Ctrl+Return"));
    m_stopAction->setShortcut(tr("Ctrl+."));
    m_previousAction->setShortcut(tr("Alt+Up"));
    m_nextAction->setShortcut(tr("Alt+Down"));
    m_repeatAction->setCheckable(true);
    m_repeatAction->setShortcut(tr("Ctrl+R"));
    m_repeatAction->setToolTip(tr("Toggle repeat playback mode"));
    m_shuffleAction->setCheckable(true);
    m_shuffleAction->setShortcut(tr("Ctrl+S"));
    m_shuffleAction->setToolTip(tr("Toggle shuffle playback mode"));
    m_stopAfterCurrentAction->setCheckable(true);
    m_clearAction->setShortcut(tr("Ctrl+Shift+X"));
    
    // Setup transfers menu
    m_transfersMenu->addAction(m_startTransfersAction);
    m_transfersMenu->addAction(m_pauseTransfersAction);
    
    // Setup edit menu
    m_editMenu->addAction(m_settingsAction);
    
    // Setup edit menu actions
    m_settingsAction->setShortcut(tr("Ctrl+P"));
    
    // Setup help menu
    m_helpMenu->addAction(m_aboutAction);

    // Setup toolbar
    m_toolBar->setObjectName("mainToolBar");
    m_toolBar->setWindowTitle(tr("Main toolbar"));
    m_toolBar->setMovable(false);
    m_toolBar->setAllowedAreas(Qt::TopToolBarArea);
    m_toolBar->addAction(m_openFilesAction);
    m_toolBar->addAction(m_addFilesAction);
    m_toolBar->addAction(m_searchAction);
    m_toolBar->addAction(m_previousAction);
    m_toolBar->addAction(m_nextAction);
    m_toolBar->addAction(m_playPauseAction);
    m_toolBar->addAction(m_stopAction);
    m_positionSpacerAction = m_toolBar->addWidget(m_positionSpacer);
    m_positionSliderAction = m_toolBar->addWidget(m_positionSlider);
    m_positionLabelAction = m_toolBar->addWidget(m_positionLabel);
    m_toolBar->addAction(m_repeatAction);
    m_toolBar->addAction(m_shuffleAction);
    addToolBar(Qt::TopToolBarArea, m_toolBar);
    
    // Setup position spacer, slider and label
    m_positionSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_positionSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_positionSliderAction->setVisible(false);
    m_positionLabel->setFixedWidth(m_positionLabel->fontMetrics().width("000:00 / 000:00"));
    m_positionLabel->setAlignment(Qt::AlignCenter);
    m_positionLabelAction->setVisible(false);
    
    // Setup tab widget
    m_tabWidget->setTabsClosable(true);
    m_tabWidget->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectLeftTab);
    m_tabWidget->tabBar()->setExpanding(false);
    
    // Setup now playing metadata
    m_nowPlayingMetaData->setStyleSheet("font-weight: bold");
    m_nowPlayingMetaData->setThumbnailSize(QSize(96, 96));
    m_nowPlayingMetaData->hide();
    
    // Setup layout
    m_layout->addWidget(m_tabWidget);
    m_layout->addWidget(m_nowPlayingMetaData);
    m_layout->setContentsMargins(0, 0, 0, 0);
    setCentralWidget(m_widget);
    
    // Restore window geometry/state
    restoreGeometry(Settings::mainWindowGeometry());
    restoreState(Settings::mainWindowState());
    
    // Connect signals and slots
    connect(AudioPlayer::instance(), SIGNAL(durationChanged(qint64)), this, SLOT(onPlayerDurationChanged(qint64)));
    connect(AudioPlayer::instance(), SIGNAL(metaDataChanged()), this, SLOT(updateNowPlayingMetaData()));
    connect(AudioPlayer::instance(), SIGNAL(positionChanged(qint64)), this, SLOT(onPlayerPositionChanged(qint64)));
    connect(AudioPlayer::instance(), SIGNAL(seekableChanged(bool)), this, SLOT(onPlayerSeekableChanged(bool)));
    connect(AudioPlayer::instance(), SIGNAL(statusChanged(AudioPlayer::Status)),
            this, SLOT(onPlayerStatusChanged(AudioPlayer::Status)));
    connect(m_openFilesAction, SIGNAL(triggered()), this, SLOT(openFiles()));
    connect(m_openUrlAction, SIGNAL(triggered()), this, SLOT(openUrl()));
    connect(m_addFilesAction, SIGNAL(triggered()), this, SLOT(addFiles()));
    connect(m_addUrlAction, SIGNAL(triggered()), this, SLOT(addUrl()));
    connect(m_searchAction, SIGNAL(triggered()), this, SLOT(search()));
    connect(m_pluginsAction, SIGNAL(triggered()), this, SLOT(loadPlugins()));
    connect(m_quitAction, SIGNAL(triggered()), this, SLOT(close()));
    connect(m_showPlaybackQueueAction, SIGNAL(triggered()), this, SLOT(showPlaybackQueue()));
    connect(m_showTransfersAction, SIGNAL(triggered()), this, SLOT(showTransfers()));
    connect(m_reloadAction, SIGNAL(triggered()), this, SLOT(reloadCurrentTab()));
    connect(m_closeAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab()));
    connect(m_playPauseAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(togglePlaying()));
    connect(m_stopAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(stop()));
    connect(m_previousAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(previous()));
    connect(m_nextAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(next()));
    connect(m_repeatAction, SIGNAL(triggered(bool)), AudioPlayer::instance(), SLOT(setRepeatEnabled(bool)));
    connect(m_shuffleAction, SIGNAL(triggered(bool)), AudioPlayer::instance(), SLOT(setShuffleEnabled(bool)));
    connect(m_stopAfterCurrentAction, SIGNAL(triggered(bool)),
            AudioPlayer::instance(), SLOT(setStopAfterCurrentTrack(bool)));
    connect(m_clearAction, SIGNAL(triggered()), AudioPlayer::instance(), SLOT(clearQueue()));
    connect(m_startTransfersAction, SIGNAL(triggered()), Transfers::instance(), SLOT(start()));
    connect(m_pauseTransfersAction, SIGNAL(triggered()), Transfers::instance(), SLOT(pause()));
    connect(m_settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog()));
    connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    connect(m_positionSlider, SIGNAL(sliderReleased()), this, SLOT(updatePlayerPosition()));
    connect(m_positionSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
    connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(onTabStatusChanged()));
    connect(m_tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
}
TrackEditor::TrackEditor(QWidget *parent) :
        QMainWindow(parent),
        // m_idev_factory(),
        m_serial_port(0),
        m_device_io(0),
        m_dev_data(0),
        m_command_mode_step(-1),
        m_command_response_step(-1),
        m_device_file(0),
        m_socket_notifier(0),
        m_nema_string(""),
        m_line(""),
        m_log_buf(),
        m_tmp_buf(),
        m_read_start(-1),
        m_retry_count(-1),
        m_expect_binary_data(-1),
        m_binary_data_already_read(-1),
        m_lastsection(false),
        m_blocksize(-1),
        m_track_collection(0),
        m_selection_model(0),
        m_track_filename("")
{
    ui.setupUi(this);

        // set m_track_collection to 0 to prevent setTrackCollection() from trying to delete it.
	m_track_collection = 0;

	PlotData::initializeMaps();

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));

	connect(ui.action_Connect, SIGNAL(triggered()), this, SLOT(connectDevice()));
	connect(ui.action_Disconnect, SIGNAL(triggered()), this, SLOT(disconnectDevice()));

	connect(ui.action_Load_Track, SIGNAL(triggered()), this, SLOT(loadTrack()));
	connect(ui.actionAppend_Track, SIGNAL(triggered()), this, SLOT(appendTrack()));
	connect(ui.action_Save_Track, SIGNAL(triggered()), this, SLOT(saveTrack()));
	connect(ui.action_Save_Track_As, SIGNAL(triggered()), this, SLOT(saveTrackAs()));

	connect(ui.action_Read_Log, SIGNAL(triggered()), this, SLOT(readLog()));
	ui.action_Read_Log->setDisabled(true);
	connect(ui.action_Start_Recording, SIGNAL(triggered()), this, SLOT(startRecording()));
	connect(ui.action_Stop_Recording, SIGNAL(triggered()), this, SLOT(stopRecording()));

	connect(ui.actionStart_Animation, SIGNAL(triggered()), &m_animation, SLOT(start()));
	connect(ui.actionStop_Animation, SIGNAL(triggered()), &m_animation, SLOT(stop()));

	connect(ui.actionFaster, SIGNAL(triggered()), &m_animation, SLOT(incSpeed()));
	connect(ui.actionSlower, SIGNAL(triggered()), &m_animation, SLOT(decSpeed()));

	connect(ui.actionX_0_125, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX0125()));
	connect(ui.actionX_0_25, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX025()));
	connect(ui.actionX_0_5, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX05()));
	connect(ui.actionX_1, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX1()));
	connect(ui.actionX_2, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX2()));
	connect(ui.actionX_4, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX4()));
	connect(ui.actionX_8, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX8()));
	connect(ui.actionX_16, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX16()));
	connect(ui.actionX_32, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX32()));
	connect(ui.actionX_64, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX64()));
	connect(ui.actionX_128, SIGNAL(triggered()), &m_animation, SLOT(setTimeScaleX128()));


	connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT(showSettingsDlg()));

	connect(ui.action_About, SIGNAL(triggered()), this, SLOT(showAboutDialog()));

	connect(this, SIGNAL(setText(QString)), ui.nemaText, SLOT(appendPlainText(QString)));


	m_track_view = new TrackView(ui.scrollArea);
	ui.scrollArea->setWidget(m_track_view);

	connect(&m_animation, SIGNAL(setMarkers(QList<CMarker>)), m_track_view, SLOT(setMarkers(QList<CMarker>)));

	connect(ui.actionZoom_in, SIGNAL(triggered()), m_track_view, SLOT(zoomIn()));
	connect(ui.actionZoom_out, SIGNAL(triggered()), m_track_view, SLOT(zoomOut()));

	ui.treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_selection_model = ui.treeView->selectionModel();
    connect(m_selection_model, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged(QItemSelection,QItemSelection)));


	m_diagrams_layout = new CDiagramsLayout(ui.diagramWidget);
	ui.diagramWidget->setLayout(m_diagrams_layout);

	connect(m_diagrams_layout, SIGNAL(setMarkers(QList<CMarker>)), m_track_view, SLOT(setMarkers(QList<CMarker>)));

	m_settings = new CSettings();
	m_settings->load();

	QList<enum plotTypeY> distList;
	distList = m_settings->getDistQuantities();

	QList<enum plotTypeY> timeList;
	timeList = m_settings->getTimeQuantities();

	QList<enum plotTypeY> trackPointsList;
	trackPointsList = m_settings->getTrackpointsQuantities();

	m_diagrams_layout->setQuantities(distList, timeList, trackPointsList );


	setTrackCollection(new TrackCollection);

    m_device_io = 0;
	m_dev_data = 0;
	m_expect_binary_data = 0;

	m_command_mode_step = 0;
	m_command_response_step = 0;

	m_track_filename.clear();

    connect(ui.treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(treeViewClicked(QModelIndex)));

    ui.treeView->setEditTriggers( QAbstractItemView::DoubleClicked
								| QAbstractItemView::SelectedClicked
								| QAbstractItemView::EditKeyPressed );


    m_progress_dlg = new QDialog(this);
    prg_dlg.setupUi(m_progress_dlg);
    m_progress_dlg->setModal(false);
    connect(prg_dlg.cancelButton, SIGNAL(clicked()), this, SLOT(readLogFinished()));

	statusBar()->addWidget(m_animation.statusBarWidget());
	statusBar()->addPermanentWidget(m_track_view->statusBarWidget());

	restoreLayout();
}
Beispiel #21
0
MainWindow::MainWindow() {
    mainWindow.setupUi(this);

    chartWidget = new ResultsChartWidget(mainWindow.centralwidget);
    chartWidget->setObjectName(QString::fromUtf8("widget"));
    chartWidget->setGeometry(QRect(10, 280, 780, 300));
    chartWidget->setChartType(histogram);
    mainWindow.timeHistogram->setChecked(true);

    QObject::connect(mainWindow.About_StringMatching, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    QObject::connect(mainWindow.chooseFileButton, SIGNAL(clicked()), this, SLOT(chooseTextFile()));
    QObject::connect(mainWindow.processButton, SIGNAL(clicked()), this, SLOT(processFile()));
    QObject::connect(mainWindow.timeHistogram, SIGNAL(clicked()), this, SLOT(setChartType()));
    QObject::connect(mainWindow.pattVsFileVsTime, SIGNAL(clicked()), this, SLOT(setChartType()));
    QObject::connect(mainWindow.clearResultsButton, SIGNAL(clicked()), this, SLOT(clearResults()));
    fileLoaded = false;
    generalLock = false;
}
LauncherWindow::LauncherWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::LauncherWindow)
{
    // Setup form from ui-file
    ui->setupUi(this);

    // Make news menuitems like radiobuttons (it's impossible from qt-designer)
    QActionGroup *newsGroup = new QActionGroup(this);
    newsGroup->addAction(ui->ttyhNews);
    newsGroup->addAction(ui->officialNews);

    ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(ui->webView, SIGNAL(linkClicked(const QUrl&)), SLOT(linkClicked(const QUrl&)));

    // News Menu connections
    connect(ui->ttyhNews, SIGNAL(changed()), SLOT(loadTtyh()));
    connect(ui->officialNews, SIGNAL(changed()), SLOT(loadOfficial()));

    // Options Menu connections
    connect(ui->runSettings, SIGNAL(triggered()), SLOT(showSettingsDialog()));

    // Additional Menu connections
    connect(ui->changePassword, SIGNAL(triggered()), SLOT(showChangePasswordDialog()));
    connect(ui->changeSkin, SIGNAL(triggered()), SLOT(showSkinLoadDialog()));
    connect(ui->updateManager, SIGNAL(triggered()), SLOT(showUpdateManagerDialog()));

    // Help Menu connections
    connect(ui->bugReport, SIGNAL(triggered()), SLOT(showFeedBackDialog()));
    connect(ui->aboutLauncher, SIGNAL(triggered()), SLOT(showAboutDialog()));

    // Connect to settings
    Settings* settings = Settings::instance();

    // Setup login field
    ui->nickEdit->setText(settings->loadLogin());
    // Save login when changed
    connect(ui->nickEdit, SIGNAL(textChanged(QString)), settings, SLOT(saveLogin(QString)));

    // Setup password field
    ui->savePassword->setChecked(settings->loadPassStore());
    if (ui->savePassword->isChecked())
        ui->passEdit->setText(settings->loadPassword());
    // Password are saved on login or exit if savePassword is checked
    connect(ui->savePassword, SIGNAL(clicked(bool)), settings, SLOT(savePassStore(bool)));

    // Setup client combobox
    ui->clientCombo->addItems(settings->getClientsNames());
    ui->clientCombo->setCurrentIndex(settings->loadActiveClientId());
    connect(ui->clientCombo, SIGNAL(activated(int)), settings, SLOT(saveActiveClientId(int)));

    // Setup news set
    ui->ttyhNews->setChecked(true);
    emit ui->ttyhNews->changed();

    // Setup window parameters
    QRect geometry = settings->loadWindowGeometry();
    // Centering window, if loaded default values
    if (geometry.x() < 0)
        this->move(QApplication::desktop()->screen()->rect().center() - this->rect().center());
    else
        this->setGeometry(geometry);

    // Restore maximized state
    if (settings->loadMaximizedState()) this->showMaximized();

    connect(ui->playButton, SIGNAL(clicked()), this, SLOT(startGame()));

}
Beispiel #23
0
MainWindow::MainWindow(QWidget* parent)
    : QMainWindow(parent), m_view(0)
{
    m_hostInfoManager = new HostInfoManager;

    m_monitor = new Monitor(m_hostInfoManager, this);

    m_viewMode = new QActionGroup(this);

    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    QAction* quitAction = fileMenu->addAction(tr("&Quit"));
    quitAction->setShortcut(QKeySequence::Quit);
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
    QMenu* modeMenu = viewMenu->addMenu(tr("&Mode"));

    m_listView = modeMenu->addAction(tr("&List View"));
    m_listView->setCheckable(true);
    m_viewMode->addAction(m_listView);
    connect(m_listView, SIGNAL(triggered()), this, SLOT(setupListView()));

    m_starView = modeMenu->addAction(tr("&Star View"));
    m_starView->setCheckable(true);
    m_viewMode->addAction(m_starView);
    connect(m_starView, SIGNAL(triggered()), this, SLOT(setupStarView()));

    m_detailedView = modeMenu->addAction(tr("&Detailed Host View"));
    m_detailedView->setCheckable(true);
    m_viewMode->addAction(m_detailedView);
    connect(m_detailedView, SIGNAL(triggered()), this, SLOT(setupDetailedHostView()));


    QAction* actionStart = viewMenu->addAction(tr("&Start"));
    connect(actionStart, SIGNAL(triggered()), this, SLOT(startView()));
    QAction* actionStop = viewMenu->addAction(tr("Stop"));
    connect(actionStop, SIGNAL(triggered()), this, SLOT(stopView()));
    viewMenu->addSeparator();
    QAction* actionCheckNodes = viewMenu->addAction(tr("Check Nodes"));
    connect(actionCheckNodes, SIGNAL(triggered()), this, SLOT(checkNodes()));
    viewMenu->addSeparator();
    m_configView = viewMenu->addAction(tr("Configure View..."));
    connect(m_configView, SIGNAL(triggered()), this, SLOT( configureView()));

    m_systrayAction = viewMenu->addAction(tr("System Tray"));
    m_systrayAction->setCheckable(true);

    QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
    helpMenu->addAction(tr("About..."), this, SLOT(showAboutDialog()));

    readSettings();

    // Avoid useless creation and connection if the system does not have a systray
    if (QSystemTrayIcon::isSystemTrayAvailable()) {
        m_systemTrayIcon = new QSystemTrayIcon(this);
        m_systemTrayIcon->setIcon(QIcon(":bigIcon.png"));

        m_systemTrayMenu = new QMenu(this);
        m_systemTrayMenu->addAction(quitAction);

        m_systemTrayIcon->setContextMenu(m_systemTrayMenu);

        connect(m_systemTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                this, SLOT(systemTrayIconActivated(QSystemTrayIcon::ActivationReason)));

        connect(m_systrayAction, SIGNAL(triggered(bool)), m_systemTrayIcon, SLOT(setVisible(bool)));

        // Only show the systray if enabled
        if (m_systrayAction->isChecked())
            m_systemTrayIcon->show();
    } else {
        m_systrayAction->setEnabled(false);
    }

    setWindowIcon(QIcon(":bigIcon.png"));

    m_monitor->checkScheduler();
}
Beispiel #24
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow), networkAccessManager(this), clientFilesNetworkAccessManager(this),
    novaNetworkAccessManager(this), requiredFilesNetworkManager(this), patchesNetworkManager(this),
    fullScanWorkingThreads(0) {
    ui->setupUi(this);

    QCoreApplication::setOrganizationName("SWGEmu");
    QCoreApplication::setOrganizationDomain("swg.openkod.com");
    QCoreApplication::setApplicationName("Launchpad");

    requiredFilesCount = 0;
    nextFileToDownload = 0;

    updateTimeCounter = 5;

    gameProcessesCount = 0;
    runningFullScan = false;

    fileScanner = new FileScanner(this);

    settings = new Settings(this);
    loginServers = new LoginServers(this);
    systemTrayIcon = new QSystemTrayIcon(this);
    systemTrayIcon->setIcon(QIcon(":/img/swgemu.svg"));
    systemTrayMenu = new QMenu();
    closeAction = new QAction("Close", NULL);
    systemTrayMenu->addAction(closeAction);
    systemTrayIcon->setContextMenu(systemTrayMenu);

    QToolButton* newsButton = new QToolButton(ui->mainToolBar);
    newsButton->setIcon(QIcon(":/img/globe.svg"));
    newsButton->setText("News");
    newsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    newsButton->setCheckable(true);
    ui->mainToolBar->addWidget(newsButton);
    connect(newsButton, SIGNAL(clicked()), this, SLOT(triggerNews()));
    toolButtons.append(newsButton);

    QToolButton* updateStatusButton = new QToolButton(ui->mainToolBar);
    updateStatusButton->setIcon(QIcon(":/img/update_status.svg"));
    updateStatusButton->setText("Update status");
    updateStatusButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    ui->mainToolBar->addWidget(updateStatusButton);
    connect(updateStatusButton, SIGNAL(clicked()), this, SLOT(updateServerStatus()));
    toolButtons.append(updateStatusButton);

    QToolButton* gameSettingsButton = new QToolButton(ui->mainToolBar);
    gameSettingsButton->setIcon(QIcon(":/img/game_settings.svg"));
    gameSettingsButton->setText("Game settings");
    gameSettingsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    ui->mainToolBar->addWidget(gameSettingsButton);
    connect(gameSettingsButton, SIGNAL(clicked()), this, SLOT(startSWGSetup()));
    toolButtons.append(gameSettingsButton);

    QToolButton* gameModsButton = new QToolButton(ui->mainToolBar);
    gameModsButton->setIcon(QIcon(":/img/magic.svg"));
    gameModsButton->setText("Game mods");
    gameModsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    ui->mainToolBar->addWidget(gameModsButton);
    connect(gameModsButton, SIGNAL(clicked()), this, SLOT(showGameModsOptions()));
    toolButtons.append(gameModsButton);

#ifdef ENABLE_MACRO_EDITOR
    QToolButton* macroEditorButton = new QToolButton(ui->mainToolBar);
    macroEditorButton->setIcon(QIcon(":/img/book.svg"));
    macroEditorButton->setText("Macro Editor");
    macroEditorButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    ui->mainToolBar->addWidget(macroEditorButton);
    connect(macroEditorButton, SIGNAL(clicked()), this, SLOT(showMacroEditor()));
    toolButtons.append(macroEditorButton);
#endif

    QToolButton* profCalculatorButton = new QToolButton(ui->mainToolBar);
    profCalculatorButton->setIcon(QIcon(":/img/design.svg"));
    profCalculatorButton->setText("Profession Calculator");
    profCalculatorButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    ui->mainToolBar->addWidget(profCalculatorButton);
    connect(profCalculatorButton, SIGNAL(clicked()), this, SLOT(startKodanCalculator()));
    toolButtons.append(profCalculatorButton);

    QToolButton* deleteProfilesButton = new QToolButton(ui->mainToolBar);
    deleteProfilesButton->setIcon(QIcon(":/img/bin.svg"));
    deleteProfilesButton->setText("Delete game profiles");
    deleteProfilesButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    ui->mainToolBar->addWidget(deleteProfilesButton);
    connect(deleteProfilesButton, SIGNAL(clicked()), this, SLOT(deleteProfiles()));
    toolButtons.append(deleteProfilesButton);

    QToolButton* updateButton = new QToolButton(ui->mainToolBar);
    updateButton->setIcon(QIcon(":/img/cloud_down.svg"));
    updateButton->setText("Check for updates");
    updateButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    ui->mainToolBar->addWidget(updateButton);
    connect(updateButton, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
    toolButtons.append(updateButton);

    cancelWorkingThreads = false;

    connect(ui->mainToolBar, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(toolBarOrientationChanged(Qt::Orientation)));
    connect(systemTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));
    connect(closeAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(ui->actionFolders, SIGNAL(triggered()), this, SLOT(showSettings()));
    connect(&networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(statusXmlIsReady(QNetworkReply*)) );
    connect(&novaNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(statusXmlIsReady(QNetworkReply*)) );
    connect(&clientFilesNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFileFinished(QNetworkReply*)));
    connect(&requiredFilesNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requiredFileDownloadFileFinished(QNetworkReply*)));
    connect(&patchesNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(patchesDownloadFileFinished(QNetworkReply*)));
    connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(webPageLoadFinished(bool)));
    connect(ui->pushButton_Start, SIGNAL(clicked()), this, SLOT(startSWG()));
    connect(fileScanner, SIGNAL(requiredFileExists(QString)), this, SLOT(updateBasicLoadProgress(QString)));
    connect(fileScanner, SIGNAL(fullScannedFile(QString, bool)), this, SLOT(updateFullScanProgress(QString, bool)));
    connect(this, SIGNAL(startDownload()), this, SLOT(startFileDownload()));
    connect(ui->actionLogin_Servers, SIGNAL(triggered()), loginServers, SLOT(show()));
    connect(ui->actionShow_news, SIGNAL(triggered()), this, SLOT(triggerNews()));
    connect(ui->checkBox_instances, SIGNAL(toggled(bool)), this, SLOT(triggerMultipleInstances(bool)));
    connect(ui->actionUpdate_Status, SIGNAL(triggered()), this, SLOT(updateServerStatus()));
    connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
    connect(ui->actionCheck_for_updates, SIGNAL(triggered()), this, SLOT(checkForUpdates()));
    connect(ui->actionGame_Settings, SIGNAL(triggered()), this, SLOT(startSWGSetup()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    connect(ui->actionDelete_Profiles, SIGNAL(triggered()), this, SLOT(deleteProfiles()));
    connect(fileScanner, SIGNAL(addFileToDownload(QString)), this, SLOT(addFileToDownloadSlot(QString)));
    connect(ui->actionInstall_from_SWG, SIGNAL(triggered()), this, SLOT(installSWGEmu()));

    ui->groupBox_browser->hide();

    QTabBar* tabBar = ui->tabWidget->tabBar();
    tabBar->setTabButton(0, QTabBar::RightSide, 0);
    tabBar->setTabButton(0, QTabBar::LeftSide, 0);

    QSettings settingsOptions;

    QString swgFolder = settingsOptions.value("swg_folder").toString();
    bool multipleInstances = settingsOptions.value("multiple_instances").toBool();

    ui->checkBox_instances->setChecked(multipleInstances);
    ui->textBrowser->viewport()->setAutoFillBackground(false);
    ui->textBrowser->setAutoFillBackground(false);

    updateServerStatus();

    connect(&loadWatcher, SIGNAL(finished()), this, SLOT(loadFinished()));
    //connect(&fullScanWatcher, SIGNAL(finished()), this, SLOT(fullScanFinished()));
    connect(ui->pushButton_FullScan, SIGNAL(clicked()), this, SLOT(startFullScan()));

    loginServers->reloadServers();
    updateLoginServerList();

    silentSelfUpdater = new SelfUpdater(true, this);

    if (!swgFolder.isEmpty())
        startLoadBasicCheck();
    else {
#ifdef Q_OS_WIN32
        QDir dir("C:/SWGEmu");

        if (dir.exists() && FileScanner::checkSwgFolder("C:/SWGEmu")) {
            settingsOptions.setValue("swg_folder", "C:/SWGEmu");
            startLoadBasicCheck();
        } else
#endif
        QMessageBox::warning(this, "Error", "Please set the swgemu folder in Settings->Options or install using Settings->Select install folder option");
    }

    restoreGeometry(settingsOptions.value("mainWindowGeometry").toByteArray());
    restoreState(settingsOptions.value("mainWindowState").toByteArray());

    QString savedLogin = settingsOptions.value("selected_login_server", "").toString();

    if (!savedLogin.isEmpty()) {
        int idx = ui->comboBox_login->findText(savedLogin);

        if (idx >= 0) {
            ui->comboBox_login->setCurrentIndex(idx);
        }
    }

    requiredFilesNetworkManager.get(QNetworkRequest(QUrl(patchUrl + "required2.txt")));
    //patchesNetworkManager.get(QNetworkRequest(QUrl(patchUrl + "patches.txt")));
    silentSelfUpdater->silentCheck();

    //ui->webView->setUrl(newsUrl);

    //gameMods = new GameMods(this);
}
/*!
    \brief Stops the 3D animation, moves the AboutDialog to the correct place and really shows it.
 */
void AboutDialogGraphicsView::showAboutDialog() {
    //hide();
    disconnect(_timeLine, SIGNAL(finished()), this, SLOT(showAboutDialog()));
    _aboutDialog->move( int(_parentWindow->geometry().x()+(_parentWindow->geometry().width()-_graphicsProxyWidget->geometry().width()) / 2), _parentWindow->y()+_windowTitleBarWidth-_windowPosOffset );
    _aboutDialog->exec();
}
Beispiel #26
0
MainWindow::MainWindow(ContactRoster *roster, bool showWhatsNew, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // Configure the main listView

    model = new ContactSelectionModel(ui->listView);
    model->setSortRole(Qt::UserRole + 2);
    ui->listView->setModel(model);
    ui->listView->installEventFilter(this);

    ChatDisplayDelegate *delegate = new ChatDisplayDelegate(ui->listView);

    ui->listView->setItemDelegate(delegate);

    connect(ui->createChatButton,SIGNAL(pressed()),this,SLOT(createChatWindow()));
    connect(ui->actionSettings,SIGNAL(triggered()),this,SLOT(showGlobalSettingsDialog()));
    connect(ui->actionStatus,SIGNAL(triggered()),this,SLOT(showStatusWindow()));
    connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(quit()));
    connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAboutDialog()));
    connect(ui->actionDonate,SIGNAL(triggered()),this,SLOT(showDonate()));
    connect(ui->actionSync,SIGNAL(triggered()),this,SLOT(requestSync()));
    connect(ui->actionProfile,SIGNAL(triggered()),
            this,SLOT(showProfileWindow()));
    connect(ui->actionAccountInfo,SIGNAL(triggered()),
            this,SLOT(showAccountInfoWindow()));
    connect(ui->actionNetworkUsage,SIGNAL(triggered()),
            this,SLOT(showNetworkUsageWindow()));
    connect(ui->actionCreateGroup,SIGNAL(triggered()),
            this,SLOT(showCreateGroupWindow()));
    connect(ui->actionBlockedContacts,SIGNAL(triggered()),
            this,SLOT(showBlockedContactsWindow()));

    connect(ui->listView,SIGNAL(clicked(QModelIndex)),
            this,SLOT(contactSelected(QModelIndex)));

    connect(this,SIGNAL(sendRightButtonClicked(QPoint)),
            this,SLOT(contextMenu(QPoint)));

    this->roster = roster;

    setAttribute(Qt::WA_Maemo5StackedWindow);
    setAttribute(Qt::WA_DeleteOnClose,false);
    setAttribute(Qt::WA_QuitOnClose,false);

    isScreenLocked = false;

    notifyObject = new NotifyObject(this);
    connect(this,SIGNAL(sendNotification(QString,FMessage)),
            notifyObject,SLOT(sendNotify(QString,FMessage)));

    newDayTimer = new QTimer(this);
    connect(newDayTimer,SIGNAL(timeout()),this,SLOT(updateTimestamps()));
    resetNewDayTimer();

    loadOpenChats();

    // WhatsNew Window

    if (showWhatsNew)
    {
        WhatsNewWindow *window = new WhatsNewWindow(this);

        window->setAttribute(Qt::WA_Maemo5StackedWindow);
        window->setAttribute(Qt::WA_DeleteOnClose);
        window->setWindowFlags(window->windowFlags() | Qt::Window);
        window->show();
    }

}
Beispiel #27
0
/// returns true if command is processed
bool V3DocViewWin::onCommand( int command, int params )
{
    CRLog::info("V3DocViewWin::onCommand(%d [%s], %d)", command, getCommandName(command, params), params );
    switch ( command ) {
    case MCMD_QUIT:
        getWindowManager()->closeAllWindows();
        return true;
    case MCMD_MAIN_MENU:
        showMainMenu();
        return true;
    case MCMD_SETTINGS_FONTSIZE:
        showFontSizeMenu();
        return true;
#if CR_INTERNAL_PAGE_ORIENTATION==1
    case MCMD_SETTINGS_ORIENTATION:
        showOrientationMenu();
        return true;
#endif
    case MCMD_SETTINGS:
        showSettingsMenu();
        return true;
    case MCMD_RECENT_BOOK_LIST:
        showRecentBooksMenu();
        return true;
    case MCMD_OPEN_RECENT_BOOK:
        _docview->swapToCache();
        _docview->getDocument()->updateMap();
        openRecentBook( params );
        return true;
    case MCMD_SWITCH_TO_RECENT_BOOK:
        _docview->swapToCache();
        _docview->getDocument()->updateMap();
        openRecentBook( 1 );
        return true;
    case MCMD_ABOUT:
        showAboutDialog();
        return true;
    case MCMD_CITE:
        activate_cite( _wm, this);
        return true;
    case MCMD_GO_PAGE_APPLY:
        _docview->doCommand( DCMD_GO_PAGE, params-1 );
        return true;
    case MCMD_GO_PERCENT_APPLY:
        _docview->doCommand( DCMD_GO_POS, params * _docview->GetFullHeight() / 100 );
        return true;
    case MCMD_SETTINGS_APPLY:
#if CR_INTERNAL_PAGE_ORIENTATION==1
    case mm_Orientation:
#endif
    case mm_FontSize:
        applySettings();
        saveSettings( lString16() );
        _wm->getSkin()->gc();
        return true;
    case DCMD_SAVE_HISTORY:
        saveHistory( lString16() );
        saveSettings( lString16() );
        return true;
    case DCMD_SAVE_TO_CACHE:
        _docview->swapToCache();
        _docview->getDocument()->updateMap();
        return true;
    case MCMD_BOOKMARK_LIST:
        showBookmarksMenu(false);
        return true;
    case MCMD_BOOKMARK_LIST_GO_MODE:
        showBookmarksMenu(true);
        return true;
    case DCMD_ZOOM_IN:
    case DCMD_ZOOM_OUT:
        showWaitIcon();
		CRViewDialog::onCommand( command, params );
        _props->setInt( PROP_FONT_SIZE, _docview->getFontSize() );
        saveSettings( lString16() );
        return true;
    case MCMD_HELP:
        showHelpDialog();
        return true;
    case DCMD_BOOKMARK_SAVE_N:
        _docview->doCommand( DCMD_BOOKMARK_SAVE_N, params );
        if ( _props->getBoolDef( PROP_AUTOSAVE_BOOKMARKS, true ) )
            saveHistory( lString16() );
        return true;
    default:
        // do nothing
        ;
    }
    return CRViewDialog::onCommand( command, params );
}
Beispiel #28
0
// =======================================================
int CInterfaceNewt::guiInitMainWindow(char *szDevice, char *szImageFile, char *szNetworkIP, DWORD *dwServerPort, bool *bSsl)
{
  newtComponent formMain, btnContinue, btnExit, btnAbout;
  newtComponent labelPartition, labelImage, editPartition, editImage, btnImage;
  newtComponent widgetTemp, labelAction, radioSave, radioRestore, radioMbr;
  newtComponent checkNetwork, labelNetwork, labelPort, editNetwork, editPort, checkSsl;
  newtExitStruct event;
  char szTemp[1024];
  int nAction;
  int nRes;

  showDebug(8, "guiInitMainWindow\n");
  
  SNPRINTF(szTemp, "Partition Image %s", PACKAGE_VERSION);
  newtCenteredWindow(67, 20, szTemp);
  
  labelPartition = newtLabel(1, 0, i18n("* Partition to save/restore"));
  editPartition = newtListbox(3, 1, 7, NEWT_FLAG_SCROLL);
  labelImage = newtLabel(1, 9, i18n("* Image file to create/use"));
  editImage = newtEntry(3, 10, szImageFile, 59, NULL, NEWT_FLAG_SCROLL);
  btnImage = newtCompactButton(62, 10, "*");

  labelAction = newtLabel(1, 12, i18n("Action to be done:"));
  radioSave = newtRadiobutton(1, 13, i18n("Save partition into a new image file"), true, NULL);
  radioRestore = newtRadiobutton(1, 14, i18n("Restore partition from an image file"), false, radioSave);
  radioMbr = newtRadiobutton(1, 15, i18n("Restore an MBR from the image file"), false, radioRestore);
  
  checkNetwork = newtCheckbox(1, 17, i18n("Connect to server"), (!!(*szNetworkIP) ? 'X' : ' '), " X", NULL);
#ifdef HAVE_SSL
  checkSsl = newtCheckbox(5, 19, i18n("Encrypt data on the network with SSL"), (*bSsl ? 'X' : ' '), " X", NULL);
#else
  #ifdef MUST_LOGIN
    checkSsl = newtLabel(5, 19,i18n("SSL disabled at compile time"));
  #else
    checkSsl = newtLabel(5, 19,i18n("SSL&login disabled at compile time"));
  #endif
#endif
  labelNetwork = newtLabel(5, 18, i18n("IP/name of the server:"));
  editNetwork = newtEntry(28, 18, szNetworkIP, 25, NULL, 0);
  labelPort = newtLabel(54, 18, i18n("Port:"));
  SNPRINTF(szTemp, "%u", *dwServerPort);
  editPort = newtEntry(60, 18, szTemp, 6, NULL, 0);
  
  btnContinue = newtCompactButton(50, 12, i18n("Next (F5)"));
  btnAbout = newtCompactButton(50, 14, i18n("About"));
  btnExit = newtCompactButton(50, 16, i18n("Exit (F6)"));

  nRes = fillPartitionList(editPartition);
  if (nRes == -1)
    RETURN_int(-1);
  
  formMain = newtForm(NULL, NULL, 0);
  newtFormAddComponents(formMain, labelPartition, labelImage, editPartition, editImage,
                        btnImage, labelAction, radioSave, radioRestore, radioMbr, checkNetwork,
			labelNetwork, editNetwork, labelPort, editPort, checkSsl, 
			btnContinue, btnAbout, btnExit, NULL);
  newtFormAddHotKey(formMain, KEY_EXIT); // Exit
  newtFormAddHotKey(formMain, KEY_OKAY); // Okay

 begin:
  /*widgetTemp = */newtFormRun(formMain, &event);
  widgetTemp = newtFormGetCurrent(formMain);

  if (((event.reason == event.NEWT_EXIT_HOTKEY) && (event.u.key == KEY_EXIT)) || ((event.reason == event.NEWT_EXIT_COMPONENT) && (widgetTemp == btnExit))) 
  //if(widgetTemp == btnExit)
    return OPERATION_EXIT;

  if ((event.reason == event.NEWT_EXIT_COMPONENT) && (widgetTemp == btnAbout))
    {	
      showAboutDialog();
      goto begin;
    }

  if ((event.reason == event.NEWT_EXIT_COMPONENT) && (widgetTemp == btnImage))
    {	
      char *fs_;
      fs_=filesel(newtEntryGetValue(editImage));
      if(fs_) {
        newtEntrySet(editImage, fs_, 1);
//        free(fs_);
        }
      
      goto begin;
    }

  
  if (strcmp(newtEntryGetValue(editImage), "") == 0) // if "image" field empty
    {	
      msgBoxError(i18n("The \"Image\" field is empty. Cannot continue"));
      goto begin;
    }
  
  if (newtCheckboxGetValue(checkNetwork) == 'X')
    {
      if (!(*newtEntryGetValue(editNetwork)))	
	{
	  msgBoxError(i18n("The \"Server IP/Name\" field is empty. Cannot continue"));
	  goto begin;
	}
      
      if (!atoi((char*)newtEntryGetValue(editPort)))
	{
	  msgBoxError(i18n("The \"Server Port\" field is not a valid integer. Cannot continue"));
	  goto begin;
	}
      
    }
  
  // get device
  strcpy(szDevice, (char*)newtListboxGetCurrent(editPartition));
  
  // image file
  strcpy(szImageFile, newtEntryGetValue(editImage));
  
  // network
  if (newtCheckboxGetValue(checkNetwork) == 'X') // If network is activated
    {
      strcpy(szNetworkIP, (char*)newtEntryGetValue(editNetwork));
      *dwServerPort = atoi((char*)newtEntryGetValue(editPort));
#ifdef HAVE_SSL
      *bSsl = (newtCheckboxGetValue(checkSsl) == 'X');
#endif
    }
  else // no network
    {
      *szNetworkIP = 0;
      *dwServerPort = OPTIONS_DEFAULT_SERVERPORT;	
    }
  
  nAction = 0;
  
  if (newtRadioGetCurrent(radioRestore) == radioSave)
    {	
      nAction = OPERATION_SAVE;
    }
  else if (newtRadioGetCurrent(radioRestore) == radioRestore)
    {
      nAction = OPERATION_RESTORE;
    }
  else if (newtRadioGetCurrent(radioRestore) == radioMbr)
    {
      nAction = OPERATION_RESTMBR;
    }
  
  newtFormDestroy(formMain);
  newtPopWindow();
  
  return nAction;
}
Beispiel #29
0
void MainMenu::init()
{
#define ADD_ACTION(name, menu, icon, trName, slot, shortcut) \
    action = menu->addAction(icon, trName); \
    action->setShortcut(QKeySequence(QSL(shortcut))); \
    connect(action, SIGNAL(triggered()), this, slot); \
    m_actions[QSL(name)] = action

#define ADD_CHECKABLE_ACTION(name, menu, icon, trName, slot, shortcut) \
    action = menu->addAction(icon, trName); \
    action->setShortcut(QKeySequence(QSL(shortcut))); \
    action->setCheckable(true); \
    connect(action, SIGNAL(triggered(bool)), this, slot); \
    m_actions[QSL(name)] = action

    // Standard actions - needed on Mac to be placed correctly in "application" menu
    QAction* action = new QAction(QIcon::fromTheme(QSL("help-about")), tr("&About QupZilla"), this);
    action->setMenuRole(QAction::AboutRole);
    connect(action, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    m_actions[QSL("Standard/About")] = action;

    action = new QAction(IconProvider::settingsIcon(), tr("Pr&eferences"), this);
    action->setMenuRole(QAction::PreferencesRole);
    action->setShortcut(QKeySequence(QKeySequence::Preferences));
    connect(action, SIGNAL(triggered()), this, SLOT(showPreferences()));
    m_actions[QSL("Standard/Preferences")] = action;

    action = new QAction(QIcon::fromTheme(QSL("application-exit")), tr("Quit"), this);
    action->setMenuRole(QAction::QuitRole);
    // shortcut set from browserwindow
    connect(action, SIGNAL(triggered()), this, SLOT(quitApplication()));
    m_actions[QSL("Standard/Quit")] = action;

    // File menu
    m_menuFile = new QMenu(tr("&File"));
    connect(m_menuFile, SIGNAL(aboutToShow()), this, SLOT(aboutToShowFileMenu()));
    connect(m_menuFile, SIGNAL(aboutToHide()), this, SLOT(aboutToHideFileMenu()));

    ADD_ACTION("File/NewTab", m_menuFile, IconProvider::newTabIcon(), tr("New Tab"), SLOT(newTab()), "Ctrl+T");
    ADD_ACTION("File/NewWindow", m_menuFile, IconProvider::newWindowIcon(), tr("&New Window"), SLOT(newWindow()), "Ctrl+N");
    ADD_ACTION("File/NewPrivateWindow", m_menuFile, IconProvider::privateBrowsingIcon(), tr("New &Private Window"), SLOT(newPrivateWindow()), "Ctrl+Shift+P");
    ADD_ACTION("File/OpenLocation", m_menuFile, QIcon::fromTheme(QSL("document-open-remote")), tr("Open Location"), SLOT(openLocation()), "Ctrl+L");
    ADD_ACTION("File/OpenFile", m_menuFile, QIcon::fromTheme(QSL("document-open")), tr("Open &File..."), SLOT(openFile()), "Ctrl+O");
    ADD_ACTION("File/CloseWindow", m_menuFile, QIcon::fromTheme(QSL("window-close")), tr("Close Window"), SLOT(closeWindow()), "Ctrl+Shift+W");
    m_menuFile->addSeparator();
    ADD_ACTION("File/SavePageAs", m_menuFile, QIcon::fromTheme(QSL("document-save")), tr("&Save Page As..."), SLOT(savePageAs()), "Ctrl+S");
    ADD_ACTION("File/SavePageScreen", m_menuFile, QIcon::fromTheme(QSL("image-loading")), tr("Save Page Screen"), SLOT(savePageScreen()), "Ctrl+Shift+S");
    ADD_ACTION("File/SendLink", m_menuFile, QIcon::fromTheme(QSL("mail-message-new")), tr("Send Link..."), SLOT(sendLink()), "");
    ADD_ACTION("File/Print", m_menuFile, QIcon::fromTheme(QSL("document-print")), tr("&Print..."), SLOT(printPage()), "Ctrl+P");
    m_menuFile->addSeparator();
    ADD_CHECKABLE_ACTION("File/WorkOffline", m_menuFile, QIcon(), tr("Work &Offline"), SLOT(toggleOfflineMode()), "");
    m_menuFile->addSeparator();
    m_menuFile->addAction(m_actions[QSL("Standard/Quit")]);

    // Edit menu
    m_menuEdit = new QMenu(tr("&Edit"));
    connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu()));
    connect(m_menuEdit, SIGNAL(aboutToHide()), this, SLOT(aboutToHideEditMenu()));

    ADD_ACTION("Edit/Undo", m_menuEdit, QIcon::fromTheme(QSL("edit-undo")), tr("&Undo"), SLOT(editUndo()), "Ctrl+Z");
    ADD_ACTION("Edit/Redo", m_menuEdit, QIcon::fromTheme(QSL("edit-redo")), tr("&Redo"), SLOT(editRedo()), "Ctrl+Shift+Z");
    m_menuEdit->addSeparator();
    ADD_ACTION("Edit/Cut", m_menuEdit, QIcon::fromTheme(QSL("edit-cut")), tr("&Cut"), SLOT(editCut()), "Ctrl+X");
    ADD_ACTION("Edit/Copy", m_menuEdit, QIcon::fromTheme(QSL("edit-copy")), tr("C&opy"), SLOT(editCopy()), "Ctrl+C");
    ADD_ACTION("Edit/Paste", m_menuEdit, QIcon::fromTheme(QSL("edit-paste")), tr("&Paste"), SLOT(editPaste()), "Ctrl+V");
    m_menuEdit->addSeparator();
    ADD_ACTION("Edit/SelectAll", m_menuEdit, QIcon::fromTheme(QSL("edit-select-all")), tr("Select &All"), SLOT(editSelectAll()), "Ctrl+A");
    ADD_ACTION("Edit/Find", m_menuEdit, QIcon::fromTheme(QSL("edit-find")), tr("&Find"), SLOT(editFind()), "Ctrl+F");
    m_menuEdit->addSeparator();

    // View menu
    m_menuView = new QMenu(tr("&View"));
    connect(m_menuView, SIGNAL(aboutToShow()), this, SLOT(aboutToShowViewMenu()));
    connect(m_menuView, SIGNAL(aboutToHide()), this, SLOT(aboutToHideViewMenu()));

    QMenu* toolbarsMenu = new QMenu(tr("Toolbars"));
    connect(toolbarsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolbarsMenu()));
    QMenu* sidebarMenu = new QMenu(tr("Sidebar"));
    connect(sidebarMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowSidebarsMenu()));
    QMenu* encodingMenu = new QMenu(tr("Character &Encoding"));
    connect(encodingMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEncodingMenu()));

    // Create menus to make shortcuts available even before first showing the menu
    m_window->createToolbarsMenu(toolbarsMenu);
    m_window->createSidebarsMenu(sidebarMenu);

    m_menuView->addMenu(toolbarsMenu);
    m_menuView->addMenu(sidebarMenu);
    ADD_CHECKABLE_ACTION("View/ShowStatusBar", m_menuView, QIcon(), tr("Sta&tus Bar"), SLOT(showStatusBar()), "");
    m_menuView->addSeparator();
    ADD_ACTION("View/Stop", m_menuView, QIcon::fromTheme(QSL("process-stop")), tr("&Stop"), SLOT(stop()), "Esc");
    ADD_ACTION("View/Reload", m_menuView, QIcon::fromTheme(QSL("view-refresh")), tr("&Reload"), SLOT(reload()), "F5");
    m_menuView->addSeparator();
    ADD_ACTION("View/ZoomIn", m_menuView, QIcon::fromTheme(QSL("zoom-in")), tr("Zoom &In"), SLOT(zoomIn()), "Ctrl++");
    ADD_ACTION("View/ZoomOut", m_menuView, QIcon::fromTheme(QSL("zoom-out")), tr("Zoom &Out"), SLOT(zoomOut()), "Ctrl+-");
    ADD_ACTION("View/ZoomReset", m_menuView, QIcon::fromTheme(QSL("zoom-original")), tr("Reset"), SLOT(zoomReset()), "Ctrl+0");
    m_menuView->addSeparator();
    ADD_CHECKABLE_ACTION("View/CaretBrowsing", m_menuView, QIcon(), tr("&Caret Browsing"), SLOT(toggleCaretBrowsing()), "F7");
    m_menuView->addMenu(encodingMenu);
    m_menuView->addSeparator();
    ADD_ACTION("View/PageSource", m_menuView, QIcon::fromTheme(QSL("text-html")), tr("&Page Source"), SLOT(showPageSource()), "Ctrl+U");
    ADD_CHECKABLE_ACTION("View/FullScreen", m_menuView, QIcon(), tr("&FullScreen"), SLOT(showFullScreen()), "F11");

    // Tools menu
    m_menuTools = new QMenu(tr("&Tools"));
    connect(m_menuTools, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolsMenu()));
    connect(m_menuTools, SIGNAL(aboutToHide()), this, SLOT(aboutToHideToolsMenu()));

    ADD_ACTION("Tools/WebSearch", m_menuTools, QIcon(), tr("&Web Search"), SLOT(webSearch()), "Ctrl+K");
    ADD_ACTION("Tools/SiteInfo", m_menuTools, QIcon::fromTheme(QSL("dialog-information")), tr("Site &Info"), SLOT(showSiteInfo()), "Ctrl+I");
    m_menuTools->addSeparator();
    ADD_ACTION("Tools/DownloadManager", m_menuTools, QIcon(), tr("&Download Manager"), SLOT(showDownloadManager()), "Ctrl+Y");
    ADD_ACTION("Tools/CookiesManager", m_menuTools, QIcon(), tr("&Cookies Manager"), SLOT(showCookieManager()), "");
    ADD_ACTION("Tools/AdBlock", m_menuTools, QIcon(), tr("&AdBlock"), SLOT(showAdBlockDialog()), "");
    ADD_ACTION("Tools/RssReader", m_menuTools, QIcon(), tr("RSS &Reader"), SLOT(showRssManager()), "");
    ADD_ACTION("Tools/WebInspector", m_menuTools, QIcon(), tr("Web In&spector"), SLOT(showWebInspector()), "Ctrl+Shift+I");
    ADD_ACTION("Tools/ClearRecentHistory", m_menuTools, QIcon::fromTheme(QSL("edit-clear")), tr("Clear Recent &History"), SLOT(showClearRecentHistoryDialog()), "Ctrl+Shift+Del");
    m_menuTools->addSeparator();

    // Help menu
    m_menuHelp = new QMenu(tr("&Help"));

#ifndef Q_OS_MAC
    ADD_ACTION("Help/AboutQt", m_menuHelp, QIcon(QSL(":/icons/menu/qt.png")), tr("About &Qt"), SLOT(aboutQt()), "");
    m_menuHelp->addAction(m_actions[QSL("Standard/About")]);
    m_menuHelp->addSeparator();
#endif

    ADD_ACTION("Help/InfoAboutApp", m_menuHelp, QIcon::fromTheme(QSL("help-contents")), tr("Information about application"), SLOT(showInfoAboutApp()), "");
    ADD_ACTION("Help/ConfigInfo", m_menuHelp, QIcon(), tr("Configuration Information"), SLOT(showConfigInfo()), "");
    ADD_ACTION("Help/ReportIssue", m_menuHelp, QIcon(), tr("Report &Issue"), SLOT(reportIssue()), "");

    m_actions[QSL("Help/InfoAboutApp")]->setShortcut(QKeySequence(QKeySequence::HelpContents));

    // History menu
    m_menuHistory = new HistoryMenu();
    m_menuHistory->setMainWindow(m_window);

    // Bookmarks menu
    m_menuBookmarks = new BookmarksMenu();
    m_menuBookmarks->setMainWindow(m_window);

    // Other actions
    action = new QAction(QIcon::fromTheme(QSL("user-trash")), tr("Restore &Closed Tab"), this);
    action->setShortcut(QKeySequence(QSL("Ctrl+Shift+T")));
    connect(action, SIGNAL(triggered()), this, SLOT(restoreClosedTab()));
    m_actions[QSL("Other/RestoreClosedTab")] = action;

#ifdef Q_OS_MAC
    m_actions[QSL("View/FullScreen")]->setShortcut(QKeySequence(QSL("F11")));

    // Add standard actions to File Menu (as it won't be ever cleared) and Mac menubar should move them to "Application" menu
    m_menuFile->addAction(m_actions[QSL("Standard/About")]);
    m_menuFile->addAction(m_actions[QSL("Standard/Preferences")]);
#endif

#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
    m_menuEdit->addAction(m_actions[QSL("Standard/Preferences")]);
#elif !defined(Q_OS_MAC)
    m_menuTools->addAction(m_actions[QSL("Standard/Preferences")]);
#endif

#ifndef QTWEBKIT_FROM_2_3
    m_actions[QSL("View/CaretBrowsing")]->setVisible(false);
#endif

    // Menus are hidden by default
    aboutToHideFileMenu();
    aboutToHideViewMenu();
    aboutToHideEditMenu();
    aboutToHideToolsMenu();

    addActionsToWindow();
}
Beispiel #30
0
void MainWindow::createActions()
{
	m_newGameAct = new QAction(tr("&New..."), this);
	m_newGameAct->setShortcut(QKeySequence::New);

	m_closeGameAct = new QAction(tr("&Close"), this);
	#ifdef Q_OS_WIN32
	m_closeGameAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
	#else
	m_closeGameAct->setShortcut(QKeySequence::Close);
	#endif

	m_saveGameAct = new QAction(tr("&Save"), this);
	m_saveGameAct->setShortcut(QKeySequence::Save);

	m_saveGameAsAct = new QAction(tr("Save &As..."), this);
	m_saveGameAsAct->setShortcut(QKeySequence::SaveAs);

	m_copyFenAct = new QAction(tr("Copy FEN"), this);
	QAction* copyFenSequence = new QAction(m_gameViewer);
	copyFenSequence->setShortcut(QKeySequence::Copy);
	copyFenSequence->setShortcutContext(Qt::WidgetWithChildrenShortcut);
	m_gameViewer->addAction(copyFenSequence);

	m_quitGameAct = new QAction(tr("&Quit"), this);
	m_quitGameAct->setMenuRole(QAction::QuitRole);
	#ifdef Q_OS_WIN32
	m_quitGameAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
	#else
	m_quitGameAct->setShortcut(QKeySequence::Quit);
	#endif

	m_newTournamentAct = new QAction(tr("New..."), this);
	m_stopTournamentAct = new QAction(tr("Stop"), this);

	m_manageEnginesAct = new QAction(tr("Manage..."), this);

	m_showGameDatabaseWindowAct = new QAction(tr("&Game Database"), this);

	m_showGameWallAct = new QAction(tr("Game Wall"), this);

	m_showPreviousTabAct = new QAction(tr("Show Previous Tab"), this);
	#ifdef Q_OS_MAC
	m_showPreviousTabAct->setShortcut(QKeySequence(Qt::MetaModifier + Qt::ShiftModifier + Qt::Key_Tab));
	#else
	m_showPreviousTabAct->setShortcut(QKeySequence(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Tab));
	#endif

	m_showNextTabAct = new QAction(tr("Show Next Tab"), this);
	#ifdef Q_OS_MAC
	m_showNextTabAct->setShortcut(QKeySequence(Qt::MetaModifier + Qt::Key_Tab));
	#else
	m_showNextTabAct->setShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_Tab));
	#endif

	m_aboutAct = new QAction(tr("About Cute Chess..."), this);
	m_aboutAct->setMenuRole(QAction::AboutRole);

	connect(m_newGameAct, SIGNAL(triggered()), this, SLOT(newGame()));
	connect(m_copyFenAct, SIGNAL(triggered()), this, SLOT(copyFen()));
	connect(copyFenSequence, SIGNAL(triggered()), this, SLOT(copyFen()));
	connect(m_closeGameAct, SIGNAL(triggered()), this, SLOT(closeCurrentGame()));
	connect(m_saveGameAct, SIGNAL(triggered()), this, SLOT(save()));
	connect(m_saveGameAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
	connect(m_quitGameAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

	connect(m_newTournamentAct, SIGNAL(triggered()), this, SLOT(newTournament()));

	connect(m_manageEnginesAct, SIGNAL(triggered()),
		this, SLOT(manageEngines()));

	connect(m_showGameDatabaseWindowAct, SIGNAL(triggered()),
		CuteChessApplication::instance(), SLOT(showGameDatabaseDialog()));

	connect(m_showGameWallAct, SIGNAL(triggered()),
		CuteChessApplication::instance(), SLOT(showGameWall()));

	connect(m_showPreviousTabAct, SIGNAL(triggered()), this, SLOT(showPreviousTab()));
	connect(m_showNextTabAct, SIGNAL(triggered()), this, SLOT(showNextTab()));

	connect(m_aboutAct, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
}