void ChineseCalendar::createTray()
{
    this->actionShow = new QAction(tr("隐藏/显示"), this);
    connect(actionShow, SIGNAL(triggered()), this, SLOT(showOrHide()));
    QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+H"), this);
    connect(shortcut, SIGNAL(activated()), this, SLOT(showOrHide()));

    this->actionAutoStart = new QAction(tr("AutoStart"), this);
    this->actionAutoStart->setCheckable(true);
    connect(actionAutoStart, SIGNAL(triggered(bool)), this, SLOT(setAutoStart(bool)));

    this->actionStaysOnTop = new QAction(tr("总在最前"), this);
    this->actionStaysOnTop->setCheckable(true);
    connect(actionStaysOnTop, SIGNAL(triggered()), this, SLOT(slotChangeMode()));

    this->actionStaysOnBottom = new QAction(tr("总在最后"), this);
    this->actionStaysOnBottom->setCheckable(true);
    connect(actionStaysOnBottom, SIGNAL(triggered()), this, SLOT(slotChangeMode()));

    this->actionStaysNormal = new QAction(tr("普通模式"), this);
    this->actionStaysNormal->setCheckable(true);
    this->actionStaysNormal->setChecked(true);
    connect(actionStaysNormal, SIGNAL(triggered()), this, SLOT(slotChangeMode()));

    // default skin
    this->actionDefault = new QAction(tr("Default"), this);
    actionDefault->setCheckable(true);
    actionDefault->setChecked(true);
    m_skinName = QString("default");
    connect(actionDefault, SIGNAL(triggered()), this, SLOT(slotChangeSkin()));

    // blue skin
    this->actionSkin = new QAction(tr("Blue"), this);
    actionSkin->setCheckable(true);
    connect(actionSkin, SIGNAL(triggered()), this, SLOT(slotChangeSkin()));

    this->skinMenu = new QMenu(tr("换肤"), this);
    this->skinMenu->addAction(actionDefault);
    this->skinMenu->addAction(actionSkin);

    QActionGroup *actSkinGrp = new QActionGroup(this);
    actSkinGrp->addAction(actionDefault);
    actSkinGrp->addAction(actionSkin);

    readSetting();
    actionDefault->setChecked(m_skinName == "default");
    actionSkin->setChecked(m_skinName == "blue");

    // read user customizated skin files
    readSkinFiles();

    foreach (QString strSkin, m_strFileList)
    {
        QAction *actionNew = new QAction(strSkin, this);
        actionNew->setCheckable(true);
        actionNew->setChecked(m_skinName == strSkin);
        actSkinGrp->addAction(actionNew);
        this->skinMenu->addAction(actionNew);
        connect(actionNew, SIGNAL(triggered()), this, SLOT(slotChangeSkin()));
    }
void
QDTBarPrintPiece::setOptions(int opts)
{
  bool b;
  b = !(opts & QDBase::OverrideFlags::TOOLBAR_NO_PRINT);
  showOrHide(print_butt, b);
  b = !(opts & QDBase::OverrideFlags::TOOLBAR_NO_SAVE);
  showOrHide(save_butt, b);
  b = !(opts & QDBase::OverrideFlags::TOOLBAR_NO_SEARCH);
  showOrHide(find_butt, b);
}
Beispiel #3
0
    void GUI::setupActions()
    {
        KActionCollection* ac = actionCollection();
        KAction* new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac);
        new_action->setToolTip(i18n("Create a new torrent"));
        KAction* open_action = KStandardAction::open(this, SLOT(openTorrent()), ac);
        open_action->setToolTip(i18n("Open a torrent"));
        paste_action = KStandardAction::paste(this, SLOT(paste()), ac);

        open_silently_action = new KAction(KIcon(open_action->icon()), i18n("Open Silently"), this);
        open_silently_action->setToolTip(i18n("Open a torrent without asking any questions"));
        connect(open_silently_action, SIGNAL(triggered()), this, SLOT(openTorrentSilently()));
        ac->addAction("file_open_silently", open_silently_action);

        KStandardAction::quit(this, SLOT(quit()), ac);

        show_status_bar_action = KStandardAction::showStatusbar(this, SLOT(showStatusBar()), ac);
        show_status_bar_action->setIcon(KIcon("kt-show-statusbar"));

        show_menu_bar_action = KStandardAction::showMenubar(this, SLOT(showMenuBar()), ac);
        KStandardAction::preferences(this, SLOT(showPrefDialog()), ac);
        KStandardAction::keyBindings(this, SLOT(configureKeys()), ac);
        KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac);
        KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac);

        paste_url_action = new KAction(KIcon("document-open-remote"), i18n("Open URL"), this);
        paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported"));
        paste_url_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_P));
        connect(paste_url_action, SIGNAL(triggered()), this, SLOT(pasteURL()));
        ac->addAction("paste_url", paste_url_action);

        ipfilter_action = new KAction(KIcon("view-filter"), i18n("IP Filter"), this);
        ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses"));
        ipfilter_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_I));
        connect(ipfilter_action, SIGNAL(triggered()), this, SLOT(showIPFilter()));
        ac->addAction("ipfilter_action", ipfilter_action);

        import_action = new KAction(KIcon("document-import"), i18n("Import Torrent"), this);
        import_action->setToolTip(i18n("Import a torrent"));
        import_action->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_I));
        connect(import_action, SIGNAL(triggered()), this, SLOT(import()));
        ac->addAction("import", import_action);

        show_kt_action = new KAction(KIcon("kt-show-hide"), i18n("Show/Hide KTorrent"), this);
        connect(show_kt_action, SIGNAL(triggered()), this, SLOT(showOrHide()));
        ac->addAction("show_kt", show_kt_action);
        show_kt_action->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_T));

        setStandardToolBarMenuEnabled(true);
    }
Beispiel #4
0
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 * added to the plugin registry in the QGIS application.
 */
void Topol::initGui()
{
  mQActionPointer = new QAction( QIcon( ":/topology/topol.png" ), tr( "TopologyChecker" ), this );
  //mQActionPointer = new QAction( QIcon(), tr( "Topology Checker" ), this );
  mQActionPointer->setCheckable( true );


  // Create the action for tool
  //mQActionPointer = new QAction(QIcon(":/topol_c/topol.png"),tr("Topology Checker"), this);
  // Set the what's this text
  mQActionPointer->setWhatsThis( tr( "Topology Checker for vector layer" ) );
  // Connect the action to the run
  connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( showOrHide() ) );
  // Add the icon to the toolbar
  mQGisIface->addVectorToolBarIcon( mQActionPointer );
  mQGisIface->addPluginToVectorMenu( tr( "&Topology Checker" ), mQActionPointer );
  //run();
}
/*!
*/
void TNxSpooler::prepareTrayIconOrShowProgram()
{
   QDEBUG_METHOD_NAME;

   if (QSystemTrayIcon::isSystemTrayAvailable())
   {
      m_sys_tray_icon.setIcon(windowIcon());
      bool isConnected = connect(&m_sys_tray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                                           this, SLOT(showOrHide(QSystemTrayIcon::ActivationReason)));

      if (!isConnected)
      {
         // If the connection could not be restored, throw an exception
         QString message = tr("2805099 - The icon of the notification area could not be activated.");
         throw runtime_error(message.toStdString());
      }

      // Prepare the contextual menu of the system tray icon
      QMenu *menu = new QMenu(this);
      menu->addAction(m_action_show);
      menu->addSeparator();
      menu->addAction(m_action_options);
      menu->addAction(m_action_help);
      menu->addAction(m_action_about);
      menu->addSeparator();
      menu->addAction(m_action_quit);
      m_sys_tray_icon.setContextMenu(menu);

      m_sys_tray_icon.show();
      qApp->setQuitOnLastWindowClosed(false);
      hide();
   }
   else
   {
      // If there is no system tray available in the desktop being used, show NxSpooler
      // and do not show the button used to hide NxSpooler (otherwise the program could not be seen
      // even being executed).
      showNormal();
      m_hide->hide();
   }
}
Beispiel #6
0
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is 
 * added to the plugin registry in the QGIS application.
 */
void Topol::initGui()
{
  mQActionPointer = new QAction(QIcon(),tr("Topology Checker"), this);
  mQActionPointer->setCheckable(true);

  QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/topol.png";
  QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/topol.png";
  QString myQrcPath = ":/topol.png";

  if ( QFile::exists( myCurThemePath ) )
  {
    mQActionPointer->setIcon( QIcon( myCurThemePath ) );
  }
  else if ( QFile::exists( myDefThemePath ) )
  {
    mQActionPointer->setIcon( QIcon( myDefThemePath ) );
  }
  else if ( QFile::exists( myQrcPath ) )
  {
    mQActionPointer->setIcon( QIcon( myQrcPath ) );
  }
  else
  {
    mQActionPointer->setIcon( QIcon() );
  }

  // Create the action for tool
  //mQActionPointer = new QAction(QIcon(":/topol_c/topol.png"),tr("Topology Checker"), this);
  // Set the what's this text
  mQActionPointer->setWhatsThis(tr("Topology Checker for vector layer"));
  // Connect the action to the run
  connect(mQActionPointer, SIGNAL(triggered()), this, SLOT(showOrHide()));
  // Add the icon to the toolbar
  mQGisIface->addToolBarIcon(mQActionPointer);
  mQGisIface->addPluginToMenu(tr("&Topol"), mQActionPointer);
  //run();
}
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 * added to the plugin registry in the QGIS application.
 */
void CoordinateCapture::initGui()
{
  mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object

  connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );
  connect( mQGisIface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );

  setSourceCrs(); //set up the source CRS
  mTransform.setDestCRS( mCrs ); // set the CRS in the transform
  mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 5 : 3; // precision depends on CRS units

  //create the dock widget
  mpDockWidget = new QDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
  mpDockWidget->setObjectName( "CoordinateCapture" );
  mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
  mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

  // Create the action for tool
  mQActionPointer = new QAction( QIcon(), tr( "Coordinate Capture" ), this );
  mQActionPointer->setCheckable( true );
  mQActionPointer->setChecked( mpDockWidget->isVisible() );
  // Set the what's this text
  mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
  // Connect the action to the run
  connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( showOrHide() ) );
  mQGisIface->addPluginToVectorMenu( tr( "&Coordinate Capture" ), mQActionPointer );
  mQGisIface->addVectorToolBarIcon( mQActionPointer );

  // create our map tool
  mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() );
  connect( mpMapTool, SIGNAL( mouseMoved( QgsPoint ) ), this, SLOT( mouseMoved( QgsPoint ) ) );
  connect( mpMapTool, SIGNAL( mouseClicked( QgsPoint ) ), this, SLOT( mouseClicked( QgsPoint ) ) );


  // create a little widget with x and y display to put into our dock widget
  QWidget * mypWidget = new QWidget();
  QGridLayout *mypLayout = new QGridLayout( mypWidget );
  mypLayout->setColumnMinimumWidth( 0, 36 );
  mypWidget->setLayout( mypLayout );

  mypUserCrsToolButton = new QToolButton( mypWidget );
  mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) );
  connect( mypUserCrsToolButton, SIGNAL( clicked() ), this, SLOT( setCRS() ) );

  mypCRSLabel = new QLabel( mypWidget );
  mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() );

  mpUserCrsEdit = new QLineEdit( mypWidget );
  mpUserCrsEdit->setReadOnly( true );
  mpUserCrsEdit->setToolTip( tr( "Coordinate in your selected CRS (lat,lon or east,north)" ) );

  mpCanvasEdit = new QLineEdit( mypWidget );
  mpCanvasEdit->setReadOnly( true );
  mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system (lat,lon or east,north)" ) );

  QPushButton * mypCopyButton = new QPushButton( mypWidget );
  mypCopyButton->setText( tr( "Copy to clipboard" ) );
  connect( mypCopyButton, SIGNAL( clicked() ), this, SLOT( copy() ) );

  mpTrackMouseButton = new QToolButton( mypWidget );
  mpTrackMouseButton->setCheckable( true );
  mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) );
  mpTrackMouseButton->setChecked( false );

  // Create the action for tool
  mpCaptureButton = new QPushButton( mypWidget );
  mpCaptureButton->setText( tr( "Start capture" ) );
  mpCaptureButton->setToolTip( tr( "Click to enable coordinate capture" ) );
  mpCaptureButton->setIcon( QIcon( ":/coordinate_capture/coordinate_capture.png" ) );
  mpCaptureButton->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
  connect( mpCaptureButton, SIGNAL( clicked() ), this, SLOT( run() ) );

  // Set the icons
  setCurrentTheme( "" );

  mypLayout->addWidget( mypUserCrsToolButton, 0, 0 );
  mypLayout->addWidget( mpUserCrsEdit, 0, 1 );
  mypLayout->addWidget( mypCRSLabel, 1, 0 );
  mypLayout->addWidget( mpCanvasEdit, 1, 1 );
  mypLayout->addWidget( mpTrackMouseButton, 2, 0 );
  mypLayout->addWidget( mypCopyButton, 2, 1 );
  mypLayout->addWidget( mpCaptureButton, 3, 1 );

  // now add our custom widget to the dock - ownership of the widget is passed to the dock
  mpDockWidget->setWidget( mypWidget );
  connect( mpDockWidget, SIGNAL( visibilityChanged( bool ) ), mQActionPointer, SLOT( setChecked( bool ) ) );
}