Example #1
0
void MainWidget::CreateUI()
{
	qDebug("MainWidget::CreateUI()");
	
	setMainWidgetTitle("zTranslate / 1.0");
	
	//soft keys
	softKey = new ZSoftKey(NULL , this , this);
	softKey->setText(ZSoftKey::LEFT, "Menu", (ZSoftKey::TEXT_PRIORITY)0);
	softKey->setTextForOptMenuHide("Menu");
	QRect rect = ZGlobal::getContentR();

	
	menu = new ZOptionsMenu(rect, this, 0, 0, (ZSkinService::WidgetClsID)55);
	menu->setItemSpacing(10);
	
	pm = QPixmap(QString("img/icon/translate.png"));
	menu->insertItem(tr(" Перевести"),&pm,this,SLOT(slotConnectInternet()));
	
	pm = QPixmap(QString("img/icon/options.png"));
	menu->insertItem(tr(" Настройки"),&pm,this,SLOT(slotSetting()));
	
	pm = QPixmap(QString("img/icon/about.png"));
	menu->insertItem(tr(" О программе..."),&pm,this,SLOT(about()));
	
	pm = QPixmap(QString("img/icon/exit.png"));
	menu->insertItem(tr(" Выход"),&pm,this,SLOT(slotQuit()));
	
	softKey->setText(ZSoftKey::RIGHT, tr("Выход"), (ZSoftKey::TEXT_PRIORITY)0);
	softKey->setClickedSlot(ZSoftKey::RIGHT, this, SLOT(slotQuit()));
	softKey->setOptMenu(ZSoftKey::LEFT, menu);

	zapp = new ZAppInfoArea(this,"app info",  0, ZSkinService::clsZAppInfoArea);	
    zapp->insertText(ZAppInfoArea::ACTIVITY, 0, "", NULL);

	form = new ZFormContainer(this, 0, ZSkinService::clsZFormContainer);
	

	
	LineEdit1 = new ZLineEdit(this);
	form->addChild(LineEdit1);

	button1 = new ZPressButton(this);
	connect(button1,SIGNAL(pressed()),SLOT(slotShowSrcLng()));
	buttonUpdate();
	form->addChild(button1);

	MultiLine = new ZMultiLineEdit(this);
	form->addChild(MultiLine);
	
	LineEdit1->setText("");
	MultiLine->setText("");
	
	setContentWidget(form);
	setTitleBarWidget(zapp);
	setSoftKey(softKey);	
	
	show();
}
Example #2
0
CTray::CTray( QObject * parent )
: QSystemTrayIcon( parent )
{
    m_proxy = 0;
    m_listenHost  = "";
    m_connectHost = "10.8.0.2";
    m_listenPort  = 26001;
    m_connectPort = 26001;

    setIcon( QIcon( ":images/arrow.png" ) );
    setToolTip( "Internetwork proxy" );

    m_menu = new QMenu();
    m_menu->setTitle( "Menu" );
    m_menu->setTearOffEnabled( true );

    m_actionListen = new QAction( "Listen clients", m_menu );
    m_actionListen->setCheckable( true );
    connect( m_actionListen, SIGNAL(triggered()), this, SLOT(slotListen()) );
    m_menu->addAction( m_actionListen );

    m_actionQuit = new QAction( "Quit", m_menu );
    connect( m_actionQuit, SIGNAL(triggered()), this, SLOT(slotQuit()) );
    m_menu->addAction( m_actionQuit );

    setContextMenu( m_menu );
    
    loadSettings();

    show();
}
Example #3
0
int main( int argc, char *argv[] )
{
	QApplication app(argc, argv);

	// BEGIN KStatusNotifierItem
  	ktomgirl::KTGSystray *m_tray = new ktomgirl::KTGSystray();

  	ktomgirl::Stub *m_stub = new ktomgirl::Stub();

	// BEGIN KMenu
	KMenu *m_menu = new KMenu("KTomGirl");
	// END KMenu

	QAction *quitAct = new QAction("&Quit", m_tray);
	m_menu->addAction(quitAct);
	QObject::connect(quitAct, SIGNAL(triggered()), m_stub, SLOT(slotQuit()));

	QAction *searchAct = new QAction("&Search all notes", m_tray);
	m_menu->addAction(searchAct);
	QObject::connect(searchAct, SIGNAL(triggered()), m_stub, SLOT(slotSearch()));

	QAction *createAct = new QAction("&Create new note", m_tray);
	m_menu->addAction(createAct);
	QObject::connect(createAct, SIGNAL(triggered()), m_stub, SLOT(slotCreateNewNote()));

	m_tray->setContextMenu(m_menu);
  	m_tray->activate();
	// END KStatusNotifierItem

	return app.exec();
}
Example #4
0
void MainWindow::initUI(){

    ui.menuView->addSeparator();
    ui.menuView->addMenu(getStyleMenu(Settings::instance()->getStyle(), Settings::instance()->getPalette()));
    QString qmLocale = Settings::instance()->getLanguage();
    QString qmPath = QApplication::applicationDirPath() + QDir::separator () + QString(LANGUAGE_FILE_DIR);
    ui.menuView->addMenu(getLanguageMenu(qmPath, qmLocale));

    pluginsMenu = getPluginsMenu();
    menuBar()->insertMenu(ui.menuHelp->menuAction(), pluginsMenu);
    ui.toolBarPlugins->addAction(getPluginsManagementAction());


    connect(ui.actionBugReport, SIGNAL(triggered()), this, SLOT(slotBugReport()));

    connect(ui.actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(slotAbout()));

    connect(ui.actionHelp, SIGNAL(triggered()), this, SLOT(slotHelp()));


    connect(ui.actionSystemConfigure, SIGNAL(triggered()), this, SLOT(slotSystemConfig()));

    connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(slotQuit()));


    //connect(ui.menuSubWindows, SIGNAL(aboutToShow()), this, SLOT(slotUpdateWindowActions()));
    connect(ui.mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slotUpdateWindowActions()));





}
Example #5
0
HostTray::HostTray( QObject * parent )
: QSystemTrayIcon( parent )
{
    setIcon( QIcon( ":images/icon.png" ) );
    setToolTip( "Potentiostat" );

    m_menu = new QMenu();
    m_menu->setTitle( "Menu" );
    m_menu->setTearOffEnabled( true );

    m_actionShow = new QAction( "Show window", m_menu );
    m_actionShow->setCheckable( false );
    connect( m_actionShow, SIGNAL(triggered()), this, SLOT(slotShowMainWnd()) );
    m_menu->addAction( m_actionShow );

    m_actionQuit = new QAction( "Quit", m_menu );
    connect( m_actionQuit, SIGNAL(triggered()), this, SLOT(slotQuit()) );
    m_menu->addAction( m_actionQuit );

    setContextMenu( m_menu );

    m_mainWnd = new MainWnd( this );

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

    show();
}
Example #6
0
void MainWindow::setupActions()
{
  //file menu
  KStdAction::openNew(this, SLOT(slotNewFile()), actionCollection());
  KStdAction::open(this, SLOT(slotOpenFile()), actionCollection());

  m_actionRecent = KStdAction::openRecent(this, SLOT(slotFileRecent(const KURL&)), actionCollection());
  m_actionRecent->loadEntries(kapp->config());//,"Recent Files");

  KStdAction::save(this, SLOT(slotSaveCurrentFile()), actionCollection());
  KStdAction::saveAs(this, SLOT(slotSaveCurrentFileAs()), actionCollection());

  KStdAction::close(this, SLOT(slotCloseFile()), actionCollection());

  (void)new KAction(i18n("Close All"), 0, this, SLOT(slotCloseAllFiles()), actionCollection(), "file_close_all");

  KStdAction::quit(this, SLOT(slotQuit()), actionCollection());

  KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection());
  KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
  KStdAction::preferences(this, SLOT(slotShowSettings()), actionCollection(), "settings_gpteditor");


  (void)new KAction(i18n("Compile"), "make_kdevelop", "F10", m_debugger_manager,
                    SLOT(slotCompileApplication()), actionCollection(), "compile_application");

  (void)new KAction(i18n("Run"), "gear", "F9", m_debugger_manager,
                    SLOT(slotRunApplication()), actionCollection(), "run_application");

  (void)new KAction(i18n("Start Debug"), "dbgstart", "F5", m_debugger_manager,
                    SLOT(slotDebugStart()), actionCollection(), "debug_start");

  (void)new KAction(i18n("Stop Debug"), "stop", "Escape", m_debugger_manager,
                    SLOT(slotDebugStop()), actionCollection(), "debug_stop");

  (void)new KAction(i18n("Step Over"), "dbgnext", "F6", m_debugger_manager,
                    SLOT(slotDebugStepOver()), actionCollection(), "debug_step_over");

  (void)new KAction(i18n("Step Into"), "dbgstep", "F7", m_debugger_manager,
                    SLOT(slotDebugStepInto()), actionCollection(), "debug_step_into");

  (void)new KAction(i18n("Step Out"), "dbgstepout", "F8", m_debugger_manager,
                    SLOT(slotDebugStepOut()), actionCollection(), "debug_step_out");

//   (void)new KAction(i18n("Profile (DBG only)"), "math_sum", "Alt+P", m_debugger_manager,
//                     SLOT(slotProfile()), actionCollection(), "script_profile");

  (void)new KAction(i18n("Toggle Breakpoint"), "activebreakpoint", "Alt+B", m_debugger_manager,
                    SLOT(slotDebugToggleBp()), actionCollection(), "debug_toggle_bp");

//   (void)new KAction("", "math_brace", 0, m_tabEditor,
//                     SLOT(slotAddWatch()), actionCollection(), "editor_add_watch");


  // Editor default action

  setStandardToolBarMenuEnabled(true);
}
Example #7
0
 UIServerSystemTray(UIServer *uis) : KSystemTray(uis)
 {
     KPopupMenu *pop = contextMenu();
     pop->insertItem(i18n("Settings..."), uis, SLOT(slotConfigure()));
     pop->insertItem(i18n("Remove"), uis, SLOT(slotRemoveSystemTrayIcon()));
     setPixmap(loadIcon("filesave"));
     // actionCollection()->action("file_quit")->setEnabled(true);
     KStdAction::quit(uis, SLOT(slotQuit()), actionCollection());
 }
/**
 * reimplemented, only hide when runDocked is checked
 */
bool KLinPopup::queryClose()
{
	if (optRunDocked && !kapp->sessionSaving() && m_systemTray) {
		hide();
		return false;
	} else {
		slotQuit();
		return false;
	}
}
MainWindow::MainWindow(QGLWidget *context, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->actionOpen, SIGNAL(activated()), SLOT(slotOpen()));
    connect(ui->actionQuit, SIGNAL(activated()), SLOT(slotQuit()));

    m_displayWidget = new DisplayWidget(context, this);
    setCentralWidget(m_displayWidget);
}
Example #10
0
/**
 * Настройка обработчиков главного окна
 *
 * @author  Цалко Т.В.
 * @since   2.0
 */
void ddmMainWindow::setupEvents()
{
    // добавляем обработку нажатия кнопки выход
    connect( this->ui->quitAction, SIGNAL( triggered() ), this, SLOT( slotQuit() ) );

    // обновляем html страницу
    this->ui->reloadAction->setShortcut( QKeySequence( tr( "F5" ) ) );
    connect( this->ui->reloadAction, SIGNAL( triggered() ), this, SLOT( slotReload() ) );
    connect( this->ui->increaseZoomAction, SIGNAL( triggered() ), this, SLOT( slotIncreaseZoom() ) );
    connect( this->ui->decreaseZoomAction, SIGNAL( triggered() ), this, SLOT( slotDecreaseZoom() ) );
}
Example #11
0
QucsEdit::QucsEdit(const QString& FileName_, bool readOnly)
{
  // set application icon
  setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Editor " PACKAGE_VERSION " - " + tr("File: "));

  QVBoxLayout *v = new QVBoxLayout(this);

  QHBox *h = new QHBox(this);
  v->addWidget(h);

  QToolButton *ButtLoad = new QToolButton(h);
  ButtLoad->setIconSet(
	    QIconSet(QImage(QucsSettings.BitmapDir + "fileopen.png")));
  connect(ButtLoad, SIGNAL(clicked()), SLOT(slotLoad()));

  QToolButton *ButtSave = new QToolButton(h);
  ButtSave->setIconSet(
            QIconSet(QImage(QucsSettings.BitmapDir + "filesave.png")));
  connect(ButtSave, SIGNAL(clicked()), SLOT(slotSave()));
  ButtSave->setDisabled(readOnly);

  h->setStretchFactor(new QWidget(h),5); // stretchable placeholder
  PosText = new QLabel(tr("Line: %1  -  Column: %2").arg(1).arg(1), h);
  h->setStretchFactor(new QWidget(h),5); // stretchable placeholder

  QPushButton *ButtAbout = new QPushButton(tr("About"),h);
  connect(ButtAbout, SIGNAL(clicked()), SLOT(slotAbout()));

  QPushButton *ButtOK = new QPushButton(tr("Quit"),h);
  connect(ButtOK, SIGNAL(clicked()), SLOT(slotQuit()));
  ButtOK->setFocus();

  // try using same-sized mono-spaced font in the textarea
  QFont fedit = QFont("Courier New");
  fedit.setPointSize(QucsSettings.font.pointSize()-1);
  fedit.setStyleHint(QFont::Courier);
  fedit.setFixedPitch(true);

  text = new QTextEdit(this);
  text->setTextFormat(Qt::PlainText);
  text->setReadOnly(readOnly);
  text->setWordWrap(QTextEdit::NoWrap);
  text->setMinimumSize(300,200);
  text->setFont(fedit);
  text->setCurrentFont(fedit);
  v->addWidget(text);
  connect(text, SIGNAL(cursorPositionChanged(int, int)),
          SLOT(slotPrintCursorPosition(int, int)));

  // .................................................
  loadFile(FileName_);
}
Example #12
0
LircCommander::LircCommander(LircClient *lirc, RosegardenMainWindow *rgGUIApp)
        : QObject()
{
    m_lirc = lirc;
    m_rgGUIApp = rgGUIApp;
    connect(m_lirc, SIGNAL(buttonPressed(const char *)),
            this, SLOT(slotExecute(const char *)) );

    connect(this, SIGNAL(play()),
            m_rgGUIApp, SLOT(slotPlay()) );
    connect(this, SIGNAL(stop()),
            m_rgGUIApp, SLOT(slotStop()) );
    connect(this, SIGNAL(record()),
            m_rgGUIApp, SLOT(slotRecord()) );
    connect(this, SIGNAL(rewind()),
            m_rgGUIApp, SLOT(slotRewind()) );
    connect(this, SIGNAL(rewindToBeginning()),
            m_rgGUIApp, SLOT(slotRewindToBeginning()) );
    connect(this, SIGNAL(fastForward()),
            m_rgGUIApp, SLOT(slotFastforward()) );
    connect(this, SIGNAL(fastForwardToEnd()),
            m_rgGUIApp, SLOT(slotFastForwardToEnd()) );
    connect(this, SIGNAL(toggleRecord()),
            m_rgGUIApp, SLOT(slotToggleRecord()) );
    connect(this, SIGNAL(trackDown()),
            m_rgGUIApp, SLOT(slotTrackDown()) );
    connect(this, SIGNAL(trackUp()),
            m_rgGUIApp, SLOT(slotTrackUp()) );
    connect(this, SIGNAL(trackMute()),
            m_rgGUIApp, SLOT(slotToggleMute()) );
    connect(this, SIGNAL(trackRecord()),
            m_rgGUIApp, SLOT(slotToggleRecordCurrentTrack()) );
    connect(this, SIGNAL(undo()),
            CommandHistory::getInstance(), SLOT(undo()) );
    connect(this, SIGNAL(redo()),
            CommandHistory::getInstance(), SLOT(redo()) );
    connect(this, SIGNAL(aboutrg()),
            m_rgGUIApp, SLOT(slotHelpAbout()) );
    connect(this, SIGNAL(editInMatrix()),
            m_rgGUIApp, SLOT(slotEditInMatrix()) );
    connect(this, SIGNAL(editInPercussionMatrix()),
            m_rgGUIApp, SLOT(slotEditInPercussionMatrix()) );
    connect(this, SIGNAL(editInEventList()),
            m_rgGUIApp, SLOT(slotEditInEventList()) );
    connect(this, SIGNAL(editAsNotation()),
            m_rgGUIApp, SLOT(slotEditAsNotation()) );
    connect(this, SIGNAL(quit()),
            m_rgGUIApp, SLOT(slotQuit()) );
    connect(this, SIGNAL(closeTransport()),
            m_rgGUIApp, SLOT(slotCloseTransport()) );
    connect(this, SIGNAL(toggleTransportVisibility()),
            m_rgGUIApp, SLOT(slotToggleTransportVisibility()) );
}
/**
 * Check if the popupFileDirectory exists and if the permissions are ok.
 * Should return true in almost every situation.
 */
bool KLinPopup::checkPopupFileDirectory()
{
	QDir dir(POPUP_DIR);
	if (! dir.exists()) {
		int tmpYesNo =  KMessageBox::warningYesNo(this, i18n("Working directory /var/lib/klinpopup/ does not exist!\n"
															 "Shall I create it? (May need root password)"));
		if (tmpYesNo == KMessageBox::Yes) {
			QStringList kdesuArgs;
			kdesuArgs += "-c";
			kdesuArgs += "mkdir -p -m 0777 /var/lib/klinpopup";
			if (KApplication::kdeinitExecWait("kdesu", kdesuArgs) == 0) return true;
		}
	} else {
		KFileItem tmpFileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, "/var/lib/klinpopup");
		mode_t tmpPerms = tmpFileItem.permissions();

		#ifdef MY_EXTRA_DEBUG
		kdDebug() << tmpPerms << endl;
		#endif

		if (tmpPerms != 0777) {

			kdDebug() << "Perms not ok!" << endl;

			int tmpYesNo =  KMessageBox::warningYesNo(this, i18n("Permissions of the working directory /var/lib/klinpopup/ are wrong!\n"
																 "Fix? (May need root password)"));
			if (tmpYesNo == KMessageBox::Yes) {
				QStringList kdesuArgs;
				kdesuArgs += "-c";
				kdesuArgs += "chmod 0777 /var/lib/klinpopup";
				if (KApplication::kdeinitExecWait("kdesu", kdesuArgs) == 0)
					return true;
			}
		} else {
			return true;
		}
	}

	int tmpContinueQuit = KMessageBox::warningYesNo(this,
													i18n("There is a serious problem with the working directory!\n"
														 "Only sending messages will work, "
														 "else you can manually fix and restart KLinPopup."),
													i18n("Warning"),
													i18n("&Continue"),
													i18n("&Quit"),
													"ShowWarningContinueQuit");
	if (tmpContinueQuit != KMessageBox::Yes) slotQuit();

	return false;
}
Example #14
0
void MainWindow::closeEvent(QCloseEvent *event)
{
    // FIXME: all that code doesn't work on os x
    writeSettings();
    qDebug() << "MainWindow::closeEvent called";
//    if (m_trayIcon->isVisible()) {
//        hide();
//    }
//    else {
//        slotQuit();
//    }
    slotQuit();

    event->ignore();
}
/**
 * setup menu, shortcuts, create GUI
 */
void KLinPopup::setupActions()
{
	KStdAction::quit(this, SLOT(slotQuit()), actionCollection());

	setStandardToolBarMenuEnabled(true);
	createStandardStatusBarAction();

	m_menubarAction = KStdAction::showMenubar(this, SLOT(optionsShowMenubar()), actionCollection());

	KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
	KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
	KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());

	newPopupAction = new KAction(i18n("&New"),
								 "mail_new", CTRL+Key_N,
								 this, SLOT(newPopup()),
								 actionCollection(), "new_popup");
	replyPopupAction = new KAction(i18n("&Reply"),
								   "mail_reply", CTRL+Key_R,
								   this, SLOT(replyPopup()),
								   actionCollection(), "reply_popup");
	firstPopupAction = new KAction(i18n("&First"),
								   "start", CTRL+Key_B,
								   this, SLOT(firstPopup()),
								   actionCollection(), "first_popup");
	prevPopupAction = new KAction(i18n("&Previous"),
								  "back", CTRL+Key_P,
								  this, SLOT(prevPopup()),
								  actionCollection(), "previous_popup");
	nextPopupAction = new KAction(i18n("&Next"),
								  "forward", CTRL+Key_F,
								  this, SLOT(nextPopup()),
								  actionCollection(), "next_popup");
	lastPopupAction = new KAction(i18n("&Last"),
								  "finish", CTRL+Key_L,
								  this, SLOT(lastPopup()),
								  actionCollection(), "last_popup");
	unreadPopupAction = new KAction(i18n("&Unread"),
									"new_popup", CTRL+Key_U,
									this, SLOT(unreadPopup()),
									actionCollection(), "unread_popup");
	deletePopupAction = new KAction(i18n("&Delete"),
									"mail_delete", CTRL+Key_D,
									this, SLOT(deletePopup()),
									actionCollection(), "delete_popup");
	createGUI();
}
Example #16
0
WinSystemInfo::WinSystemInfo(QWidget *parent) :
    QFrame(parent)
{
    setLayout(&m_layout);
    m_layout.setMargin(0);
    m_layout.setSpacing(0);
    m_layout.addWidget(&m_middlePanel);
    m_layout.addWidget(&m_bottomPanel);
    m_bottomPanel.setFixedHeight(100);

    slotConfigChanged();

    connect(&m_bottomPanel,SIGNAL(sigExit()),this,SLOT(slotQuit()));
    connect(&m_bottomPanel,SIGNAL(sigReconfig()),this,SLOT(slotReconfigure()));
    connect(&m_bottomPanel,SIGNAL(sigShowSystemInfo()),&m_middlePanel,SLOT(slotShowSystemInfo()));
    connect(&m_bottomPanel,SIGNAL(sigShowModuleInfo()),&m_middlePanel,SLOT(slotShowModuleInfo()));
    connect(&m_middlePanel,SIGNAL(sigHideInfoButton(bool)),&m_bottomPanel,SLOT(slotHideInfoButton(bool)));
}
Example #17
0
KopeteSystemTray::KopeteSystemTray(QWidget* parent)
	: KStatusNotifierItem(parent)
{
	kDebug(14010) ;
    setCategory(Communications);
	setToolTip("kopete", "Kopete", KGlobal::mainComponent().aboutData()->shortDescription());
	setStatus(Passive);

	mIsBlinkIcon = false;
	mBlinkTimer = new QTimer(this);
	mBlinkTimer->setObjectName("mBlinkTimer");

	mKopeteIcon = "kopete";

	connect(contextMenu(), SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowMenu()));

	connect(mBlinkTimer, SIGNAL(timeout()), this, SLOT(slotBlink()));
	connect(Kopete::ChatSessionManager::self() , SIGNAL(newEvent(Kopete::MessageEvent*)),
		this, SLOT(slotNewEvent(Kopete::MessageEvent*)));
	connect(Kopete::BehaviorSettings::self(), SIGNAL(configChanged()), this, SLOT(slotConfigChanged()));

	connect(Kopete::AccountManager::self(),
		SIGNAL(accountOnlineStatusChanged(Kopete::Account *,
		const Kopete::OnlineStatus &, const Kopete::OnlineStatus &)),
	this, SLOT(slotReevaluateAccountStates()));

	// the slot called by default by the quit action, KSystemTray::maybeQuit(),
	// just closes the parent window, which is hard to distinguish in that window's closeEvent()
	// from a click on the window's close widget
	// in the quit case, we want to quit the application
 	// in the close widget click case, we only want to hide the parent window
	// so instead, we make it call our general purpose quit slot on the window, which causes a window close and everything else we need
	// KDE4 - app will have to listen for quitSelected instead
	QAction *quit = actionCollection()->action( "file_quit" );
	quit->disconnect();
	KopeteWindow *myParent = static_cast<KopeteWindow *>( parent );
	connect( quit, SIGNAL(activated()), myParent, SLOT(slotQuit()) );

	setIconByName(mKopeteIcon);
	setAttentionMovieByName( QLatin1String( "newmessage" ) );
	slotReevaluateAccountStates();
	slotConfigChanged();
}
Example #18
0
void KWatchGnuPGMainWindow::createActions()
{
  (void)new KAction( i18n("C&lear History"), "history_clear", CTRL+Key_L,
		     this, SLOT( slotClear() ),
		     actionCollection(), "clear_log" );
  (void)KStdAction::saveAs( this, SLOT(slotSaveAs()), actionCollection() );
  (void)KStdAction::close( this, SLOT(close()), actionCollection() );
  (void)KStdAction::quit( this, SLOT(slotQuit()), actionCollection() );
  (void)KStdAction::preferences( this, SLOT(slotConfigure()), actionCollection() );
  ( void )KStdAction::keyBindings(this, SLOT(configureShortcuts()), actionCollection());
  ( void )KStdAction::configureToolbars(this, SLOT(slotConfigureToolbars()), actionCollection());

#if 0
  (void)new KAction( i18n("Configure KWatchGnuPG..."), QString::fromLatin1("configure"),
					 0, this, SLOT( slotConfigure() ),
					 actionCollection(), "configure" );
#endif

}
Example #19
0
void dazeus::Network::slotIrcEvent(const std::string &event, const std::string &origin, const std::vector<std::string> &params) {
	std::string receiver;
	if(params.size() > 0)
		receiver = params[0];

	if(event != "ERROR") {
		// a signal from the server means all is OK
		deadline_ = 0;
	}

#define MIN(a) if(params.size() < a) { fprintf(stderr, "Too few parameters for event %s\n", event.c_str()); return; }
	if(event == "CONNECT") {
		nextPongDeadline_ = time(NULL) + 30;
		serverIsActuallyOkay(activeServer_->config());
	} else if(event == "JOIN") {
		MIN(1);
		joinedChannel(origin, receiver);
	} else if(event == "PART") {
		MIN(1);
		partedChannel(origin, std::string(), receiver);
	} else if(event == "KICK") {
		MIN(2);
		kickedChannel(origin, params[1], std::string(), receiver);
	} else if(event == "QUIT") {
		std::string message;
		if(params.size() > 0) {
			message = params[0];
		}
		slotQuit(origin, message, receiver);
	} else if(event == "NICK") {
		MIN(1);
		slotNickChanged(origin, params[0], receiver);
	} else if(event == "TOPIC") {
		MIN(2);
		slotTopicChanged(origin, params[0], params[1]);
	}
#undef MIN
	std::vector<NetworkListener*>::iterator nlit;
	for(nlit = networkListeners_.begin(); nlit != networkListeners_.end();
	    nlit++) {
		(*nlit)->ircEvent(event, origin, params, this);
	}
}
Example #20
0
File: kard.cpp Project: KDE/kard
void Kard::setupActions()
{
    KStandardAction::quit(this, SLOT(slotQuit()), actionCollection());
            
    KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
    
    m_pFullScreen = KStandardAction::fullScreen( 0, 0, this, actionCollection());
    actionCollection()->addAction("full_screen", m_pFullScreen );
    connect( m_pFullScreen, SIGNAL( toggled( bool )), this, SLOT( slotUpdateFullScreen( bool )));

    m_soundAction = new KToggleAction(i18n("Soun&ds"), actionCollection());
    actionCollection()->addAction("sound", m_soundAction );
    connect(m_soundAction , SIGNAL(triggered()), this, SLOT(slotToggleSound()));

    //adding choice of number of cards action
    m_numAction = new KSelectAction(i18n("View"), actionCollection());
    actionCollection()->addAction("num", m_numAction );
    connect(m_numAction , SIGNAL(triggered(int)), this, SLOT(setNumber(int)));
    QStringList nums;
    nums+=i18np("%1 Card", "%1 Cards", 4);
    nums+=i18np("%1 Card", "%1 Cards", 8);
    nums+=i18np("%1 Card", "%1 Cards", 12);
    nums+=i18np("%1 Card", "%1 Cards", 16);
    nums+=i18np("%1 Card", "%1 Cards", 20);
    nums+=i18np("%1 Card", "%1 Cards", 24);
    m_numAction->setItems(nums);
    m_numAction->setToolTip( i18n( "Choose the number of cards" ) );
    m_numAction->setWhatsThis(  i18n( "Choose the level of difficulty by setting the number of cards from 4 (very easy) to 24 (more difficult)" ) );    

    //adding theme action
    m_themeAction = new KSelectAction(i18n("Themes"), actionCollection());
    actionCollection()->addAction("themes", m_themeAction );
    connect(m_themeAction , SIGNAL(triggered(int)), this, SLOT(slotSetTheme(int )));
    m_themeAction->setItems(KardThemeFactory::instance()->themeUiList());
    m_themeAction->setToolTip( i18n( "Choose the theme for the cards" ) );
    m_themeAction->setWhatsThis(  i18n( "You can choose here the theme for the backs of the cards" ) );
    KStandardAction::fullScreen(this, SLOT(toggleFullScreen()), this, actionCollection());
    setupGUI();
}
Example #21
0
int detailset::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: showtop((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: showcpu((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: showmem((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: slotshowtop((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: slotshowcpu((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 5: slotshowmem((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 6: slotOK(); break;
        case 7: slotAbout(); break;
        case 8: slotQuit(); break;
        default: ;
        }
        _id -= 9;
    }
    return _id;
}
Example #22
0
KWatchGnuPGMainWindow::KWatchGnuPGMainWindow( QWidget* parent, const char* name )
  : KMainWindow( parent, name, WType_TopLevel ), mConfig(0)
{
  createActions();
  createGUI();

  mCentralWidget = new QTextEdit( this, "central log view" );
  mCentralWidget->setTextFormat( QTextEdit::LogText );
  setCentralWidget( mCentralWidget );

  mWatcher = new KProcIO( QTextCodec::codecForMib( 106 /*utf-8*/ ) );
  connect( mWatcher, SIGNAL( processExited(KProcess*) ),
		   this, SLOT( slotWatcherExited() ) );
  connect( mWatcher, SIGNAL( readReady(KProcIO*) ),
		   this, SLOT( slotReadStdout() ) );

  slotReadConfig();
  mSysTray = new KWatchGnuPGTray( this );
  mSysTray->show();
  connect( mSysTray, SIGNAL( quitSelected() ),
		   this, SLOT( slotQuit() ) );
  setAutoSaveSettings();
}
Example #23
0
QucsFilter::QucsFilter()
{
    // set application icon
    setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
    setCaption("Qucs Filter " PACKAGE_VERSION);


    // --------  create menubar  -------------------
    QPopupMenu *fileMenu = new QPopupMenu();
    fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), CTRL+Key_Q);

    QPopupMenu *helpMenu = new QPopupMenu();
    helpMenu->insertItem(tr("Help..."), this, SLOT(slotHelpIntro()), Key_F1);
    helpMenu->insertSeparator();
    helpMenu->insertItem(
        tr("&About QucsFilter..."), this, SLOT(slotHelpAbout()), 0);
    helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0);

    QMenuBar *bar = new QMenuBar(this);
    bar->insertItem(tr("&File"), fileMenu);
    bar->insertSeparator ();
    bar->insertItem(tr("&Help"), helpMenu);


    // -------  create main windows widgets --------
    gbox = new QGridLayout(this, 10,3,5,5);

    QWidget *Space = new QWidget(this);   // reserve space for menubar
    Space->setFixedSize(5, bar->height());
    gbox->addWidget(Space, 0,0);

    QLabel *Label1 = new QLabel(tr("Filter type:"), this);
    gbox->addWidget(Label1, 1,0);
    ComboType = new QComboBox(this);
    ComboType->insertItem("Bessel");
    ComboType->insertItem("Butterworth");
    ComboType->insertItem("Chebyshev");
    ComboType->insertItem("Cauer");
    gbox->addWidget(ComboType, 1,1);
    connect(ComboType, SIGNAL(activated(int)), SLOT(slotTypeChanged(int)));

    QLabel *Label2 = new QLabel(tr("Filter class:"), this);
    gbox->addWidget(Label2, 2,0);
    ComboClass = new QComboBox(this);
    ComboClass->insertItem(tr("Low pass"));
    ComboClass->insertItem(tr("High pass"));
    ComboClass->insertItem(tr("Band pass"));
    ComboClass->insertItem(tr("Band stop"));
    gbox->addWidget(ComboClass, 2,1);
    connect(ComboClass, SIGNAL(activated(int)), SLOT(slotClassChanged(int)));

    IntVal = new QIntValidator(1, 200, this);
    DoubleVal = new QDoubleValidator(this);

    LabelOrder = new QLabel(tr("Order:"), this);
    gbox->addWidget(LabelOrder, 3,0);
    EditOrder = new QLineEdit("3", this);
    EditOrder->setValidator(IntVal);
    gbox->addWidget(EditOrder, 3,1);

    LabelStart = new QLabel(tr("Corner frequency:"), this);
    gbox->addWidget(LabelStart, 4,0);
    EditCorner = new QLineEdit("1", this);
    EditCorner->setValidator(DoubleVal);
    gbox->addWidget(EditCorner, 4,1);
    ComboCorner = new QComboBox(this);
    ComboCorner->insertItem("Hz");
    ComboCorner->insertItem("kHz");
    ComboCorner->insertItem("MHz");
    ComboCorner->insertItem("GHz");
    ComboCorner->setCurrentItem(3);
    gbox->addWidget(ComboCorner, 4,2);

    LabelStop = new QLabel(tr("Stop frequency:"), this);
    gbox->addWidget(LabelStop, 5,0);
    EditStop = new QLineEdit("2", this);
    EditStop->setValidator(DoubleVal);
    gbox->addWidget(EditStop, 5,1);
    ComboStop = new QComboBox(this);
    ComboStop->insertItem("Hz");
    ComboStop->insertItem("kHz");
    ComboStop->insertItem("MHz");
    ComboStop->insertItem("GHz");
    ComboStop->setCurrentItem(3);
    gbox->addWidget(ComboStop, 5,2);

    LabelBandStop = new QLabel(tr("Stop band frequency:"), this);
    gbox->addWidget(LabelBandStop, 6,0);
    EditBandStop = new QLineEdit("3", this);
    EditBandStop->setValidator(DoubleVal);
    gbox->addWidget(EditBandStop, 6,1);
    ComboBandStop = new QComboBox(this);
    ComboBandStop->insertItem("Hz");
    ComboBandStop->insertItem("kHz");
    ComboBandStop->insertItem("MHz");
    ComboBandStop->insertItem("GHz");
    ComboBandStop->setCurrentItem(3);
    gbox->addWidget(ComboBandStop, 6,2);

    LabelRipple = new QLabel(tr("Pass band ripple:"), this);
    gbox->addWidget(LabelRipple, 7,0);
    EditRipple = new QLineEdit("1", this);
    EditRipple->setValidator(DoubleVal);
    gbox->addWidget(EditRipple, 7,1);
    LabelRipple_dB = new QLabel("dB", this);
    gbox->addWidget(LabelRipple_dB, 7,2);

    LabelAtten = new QLabel(tr("Stop band attenuation:"), this);
    gbox->addWidget(LabelAtten, 8,0);
    EditAtten = new QLineEdit("20", this);
    EditAtten->setValidator(DoubleVal);
    gbox->addWidget(EditAtten, 8,1);
    LabelAtten_dB = new QLabel("dB", this);
    gbox->addWidget(LabelAtten_dB, 8,2);

    QLabel *Label9 = new QLabel(tr("Impedance:"), this);
    gbox->addWidget(Label9, 9,0);
    EditImpedance = new QLineEdit("50", this);
    EditImpedance->setValidator(DoubleVal);
    gbox->addWidget(EditImpedance, 9,1);
    QLabel *Label10 = new QLabel("Ohm", this);
    gbox->addWidget(Label10, 9,2);


    QPushButton *ButtonGo =
        new QPushButton(tr("Calculate and put into Clipboard"), this);
    connect(ButtonGo, SIGNAL(clicked()), SLOT(slotCalculate()));
    gbox->addMultiCellWidget(ButtonGo, 10,10,0,2);

    LabelResult = new QLabel(this);
    ResultState = 100;
    slotShowResult();
    LabelResult->setAlignment(Qt::AlignHCenter);
    gbox->addMultiCellWidget(LabelResult, 11,11,0,2);


    // -------  finally set initial state  --------
    slotTypeChanged(0);
    slotClassChanged(0);
}
Example #24
0
/* Constructor setups the GUI. */
QucsLib::QucsLib()
{
  // set application icon
  setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Library Tool " PACKAGE_VERSION);

  QMenuBar * menuBar = new QMenuBar (this);

  // create file menu
  QPopupMenu * fileMenu = new QPopupMenu ();
  QAction * manageLib =
    new QAction ("Manage User Libraries...", tr("Manage User &Libraries..."), CTRL+Key_M, this);
  manageLib->addTo (fileMenu);
  connect(manageLib, SIGNAL(activated()), SLOT(slotManageLib()));

  fileMenu->insertSeparator();

  QAction * fileQuit =
    new QAction ("Quit", tr("&Quit"), CTRL+Key_Q, this);
  fileQuit->addTo (fileMenu);
  connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit()));

  // create help menu
  QPopupMenu * helpMenu = new QPopupMenu ();
  QAction * helpHelp =
    new QAction (tr("Help"), tr("&Help"), Key_F1, this);
  helpHelp->addTo (helpMenu);
  connect(helpHelp, SIGNAL(activated()), SLOT(slotHelp()));
  QAction * helpAbout =
    new QAction (tr("About"), tr("About"), 0, helpMenu);
  helpAbout->addTo (helpMenu);
  connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout()));

  // setup menu bar
  menuBar->insertItem (tr("&File"), fileMenu);
  menuBar->insertSeparator ();
  menuBar->insertItem (tr("&Help"), helpMenu);

  // main box
  QVBoxLayout * all = new QVBoxLayout (this);
  all->setSpacing (0);
  all->setMargin (0);

  // reserve space for menubar
  QWidget * Space = new QWidget (this);
  Space->setFixedSize(5, menuBar->height() + 2);
  all->addWidget (Space);

  // main layout
  QHBox * h = new QHBox (this);
  h->setSpacing (5);
  h->setMargin (3);
  all->addWidget (h);

  // library and component choice
  QVGroupBox * LibGroup = new QVGroupBox (tr("Component Selection"), h);
  Library = new QComboBox (LibGroup);
  connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int)));
  CompList = new QListBox(LibGroup);
  connect(CompList, SIGNAL(highlighted(QListBoxItem*)),
	SLOT(slotShowComponent(QListBoxItem*)));

  QHBox * h1 = new QHBox (LibGroup);
  QPushButton * SearchButton = new QPushButton (tr("Search..."), h1);
  connect(SearchButton, SIGNAL(clicked()), SLOT(slotSearchComponent()));
  h1->setStretchFactor(new QWidget(h1), 5); // stretchable placeholder


  // component display
  QVGroupBox *CompGroup = new QVGroupBox (tr("Component"), h);
  CompDescr = new QTextEdit(CompGroup);
  CompDescr->setTextFormat(Qt::PlainText);
  CompDescr->setReadOnly(true);
  CompDescr->setWordWrap(QTextEdit::NoWrap);

  Symbol = new SymbolWidget (CompGroup);

  QHBox * h2 = new QHBox (CompGroup);
  QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard"), h2);
  connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard()));
  QPushButton * ShowButton = new QPushButton (tr("Show Model"), h2);
  connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel()));

  // ......................................................
  putLibrariesIntoCombobox();
}
Example #25
0
QucsFilter::QucsFilter()
{
  QWidget *centralWidget = new QWidget(this);  
  setCentralWidget(centralWidget);
  
  // set application icon
  setWindowIcon(QPixmap(":/bitmaps/big.qucs.xpm"));
  setWindowTitle("Qucs Filter " PACKAGE_VERSION);

  // --------  create menubar  -------------------
  QMenu *fileMenu = new QMenu(tr("&File"));

  QAction * fileQuit = new QAction(tr("E&xit"), this);
  fileQuit->setShortcut(Qt::CTRL+Qt::Key_Q);
  connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit()));

  fileMenu->addAction(fileQuit);

  QMenu *helpMenu = new QMenu(tr("&Help"), this);
  QAction * helpHelp = new QAction(tr("Help..."), this);
  helpHelp->setShortcut(Qt::Key_F1);
  connect(helpHelp, SIGNAL(activated()), SLOT(slotHelpIntro()));

  QAction * helpAbout = new QAction(tr("&About QucsFilter..."), this);
  helpMenu->addAction(helpAbout);
  connect(helpAbout, SIGNAL(activated()), SLOT(slotHelpAbout()));

  QAction * helpAboutQt = new QAction(tr("About Qt..."), this);
  helpMenu->addAction(helpAboutQt);
  connect(helpAboutQt, SIGNAL(activated()), SLOT(slotHelpAboutQt()));

  helpMenu->addAction(helpHelp);
  helpMenu->addSeparator();
  helpMenu->addAction(helpAbout);
  helpMenu->addAction(helpAboutQt);

  menuBar()->addMenu(fileMenu);
  menuBar()->addSeparator();
  menuBar()->addMenu(helpMenu);

  // -------  create main windows widgets --------
  all  = new QGridLayout();
  all->setSpacing(3);

  // ...........................................................
  box1 = new QGroupBox(tr("Filter"), this);
  QHBoxLayout *hbox = new QHBoxLayout();

  gbox1 = new QGridLayout();
  gbox1->setSpacing(3);

  box1->setLayout(gbox1);

  QLabel *Label0 = new QLabel(tr("Realization:"), this);
  gbox1->addWidget(Label0, 0,0);
  ComboRealize = new QComboBox(this);
  ComboRealize->addItem("LC ladder (pi type)");
  ComboRealize->addItem("LC ladder (tee type)");
  ComboRealize->addItem("End coupled transmission lines");
  ComboRealize->addItem("Parallel coupled transmission lines");
  ComboRealize->addItem("Stepped-impedance");
  ComboRealize->addItem("Quarter wave resonators");
  ComboRealize->addItem("Quarter wave side coupled ring resonator");
  ComboRealize->addItem("Capacitively coupled shunt resonators");
  ComboRealize->addItem("Equation-defined");

  gbox1->addWidget(ComboRealize, 0,1);
  connect(ComboRealize, SIGNAL(activated(int)), SLOT(slotRealizationChanged(int)));

   //Synthesize Microstrip
  MicrostripcheckBox=new QCheckBox("Microstrip implementation");
  MicrostripcheckBox->setChecked(false);
  MicrostripcheckBox->setEnabled(false);
  gbox1->addWidget(MicrostripcheckBox, 1,0);
  connect(MicrostripcheckBox, SIGNAL(clicked()), SLOT(on_MicrostripcheckBox_clicked()));

  QLabel *Label1 = new QLabel(tr("Filter type:"), this);
  gbox1->addWidget(Label1, 2,0);
  ComboType = new QComboBox(this);
  ComboType->addItem("Bessel");
  ComboType->addItem("Butterworth");
  ComboType->addItem("Chebyshev");
  ComboType->addItem("Cauer");
  gbox1->addWidget(ComboType, 2,1);
  connect(ComboType, SIGNAL(activated(int)), SLOT(slotTypeChanged(int)));

  QLabel *Label2 = new QLabel(tr("Filter class:"), this);
  gbox1->addWidget(Label2, 3,0);
  ComboClass = new QComboBox(this);
  ComboClass->addItem(tr("Low pass"));
  ComboClass->addItem(tr("High pass"));
  ComboClass->addItem(tr("Band pass"));
  ComboClass->addItem(tr("Band stop"));
  gbox1->addWidget(ComboClass, 3,1);
  connect(ComboClass, SIGNAL(activated(int)), SLOT(slotClassChanged(int)));

  IntVal = new QIntValidator(1, 200, this);
  DoubleVal = new QDoubleValidator(this);

  LabelOrder = new QLabel(tr("Order:"), this);
  gbox1->addWidget(LabelOrder, 4,0);
  EditOrder = new QLineEdit("3", this);
  EditOrder->setValidator(IntVal);
  gbox1->addWidget(EditOrder, 4,1);

  LabelStart = new QLabel(tr("Corner frequency:"), this);
  gbox1->addWidget(LabelStart, 5,0);
  EditCorner = new QLineEdit("1", this);
  EditCorner->setValidator(DoubleVal);
  gbox1->addWidget(EditCorner, 5,1);
  ComboCorner = new QComboBox(this);
  ComboCorner->addItem("Hz");
  ComboCorner->addItem("kHz");
  ComboCorner->addItem("MHz");
  ComboCorner->addItem("GHz");
  ComboCorner->setCurrentIndex(3);
  gbox1->addWidget(ComboCorner, 5,2);

  LabelStop = new QLabel(tr("Stop frequency:"), this);
  gbox1->addWidget(LabelStop, 6,0);
  EditStop = new QLineEdit("2", this);
  EditStop->setValidator(DoubleVal);
  gbox1->addWidget(EditStop, 6,1);
  ComboStop = new QComboBox(this);
  ComboStop->addItem("Hz");
  ComboStop->addItem("kHz");
  ComboStop->addItem("MHz");
  ComboStop->addItem("GHz");
  ComboStop->setCurrentIndex(3);
  gbox1->addWidget(ComboStop, 6,2);

  LabelBandStop = new QLabel(tr("Stop band frequency:"), this);
  gbox1->addWidget(LabelBandStop, 7,0);
  EditBandStop = new QLineEdit("3", this);
  EditBandStop->setValidator(DoubleVal);
  gbox1->addWidget(EditBandStop, 7,1);
  ComboBandStop = new QComboBox(this);
  ComboBandStop->addItem("Hz");
  ComboBandStop->addItem("kHz");
  ComboBandStop->addItem("MHz");
  ComboBandStop->addItem("GHz");
  ComboBandStop->setCurrentIndex(3);
  gbox1->addWidget(ComboBandStop, 7,2);

  LabelRipple = new QLabel(tr("Pass band ripple:"), this);
  gbox1->addWidget(LabelRipple, 8,0);
  EditRipple = new QLineEdit("1", this);
  EditRipple->setValidator(DoubleVal);
  gbox1->addWidget(EditRipple, 8,1);
  LabelRipple_dB = new QLabel("dB", this);
  gbox1->addWidget(LabelRipple_dB, 8,2);

  LabelAtten = new QLabel(tr("Stop band attenuation:"), this);
  gbox1->addWidget(LabelAtten, 9,0);
  EditAtten = new QLineEdit("20", this);
  EditAtten->setValidator(DoubleVal);
  gbox1->addWidget(EditAtten, 9,1);
  LabelAtten_dB = new QLabel("dB", this);
  gbox1->addWidget(LabelAtten_dB, 9,2);

  LabelImpedance = new QLabel(tr("Impedance:"), this);
  gbox1->addWidget(LabelImpedance, 10,0);
  EditImpedance = new QLineEdit("50", this);
  EditImpedance->setValidator(DoubleVal);
  gbox1->addWidget(EditImpedance, 10,1);
  LabelOhm = new QLabel("Ohm", this);
  gbox1->addWidget(LabelOhm, 10,2);

  // ...........................................................

  box2 = new QGroupBox(tr("Microstrip Substrate"), this);
  box2->setEnabled(false);

  gbox2 = new QGridLayout();
  gbox2->setSpacing(3);

  box2->setLayout(gbox2);

  QLabel *Label3 = new QLabel(tr("Relative permittivity:"), this);
  gbox2->addWidget(Label3, 0,0);
  ComboEr = new QComboBox(this);
  ComboEr->setEditable(true);
  ComboEr->lineEdit()->setValidator(DoubleVal);
  connect(ComboEr, SIGNAL(activated(const QString&)), SLOT(slotTakeEr(const QString&)));
  gbox2->addWidget(ComboEr, 0,1);

  const char **p = List_er;
  while(*(++p))
    ComboEr->addItem(*p);  // put material properties into combobox
  ComboEr->lineEdit()->setText("9.8");

  QLabel *Label4 = new QLabel(tr("Substrate height:"), this);
  gbox2->addWidget(Label4, 1,0);
  EditHeight = new QLineEdit("1.0", this);
  EditHeight->setValidator(DoubleVal);
  gbox2->addWidget(EditHeight, 1,1);
  QLabel *Label5 = new QLabel("mm", this);
  gbox2->addWidget(Label5, 1,2);

  QLabel *Label6 = new QLabel(tr("metal thickness:"), this);
  gbox2->addWidget(Label6, 2,0);
  EditThickness = new QLineEdit("12.5", this);
  EditThickness->setValidator(DoubleVal);
  gbox2->addWidget(EditThickness, 2,1);
  QLabel *Label7 = new QLabel("um", this);
  gbox2->addWidget(Label7, 2,2);

  QLabel *Label8 = new QLabel(tr("minimum width:"), this);
  gbox2->addWidget(Label8, 3,0);
  EditMinWidth = new QLineEdit("0.4", this);
  EditMinWidth->setValidator(DoubleVal);
  gbox2->addWidget(EditMinWidth, 3,1);
  QLabel *Label9 = new QLabel("mm", this);
  gbox2->addWidget(Label9, 3,2);

  QLabel *Label10 = new QLabel(tr("maximum width:"), this);
  gbox2->addWidget(Label10, 4,0);
  EditMaxWidth = new QLineEdit("5.0", this);
  EditMaxWidth->setValidator(DoubleVal);
  gbox2->addWidget(EditMaxWidth, 4,1);
  QLabel *Label11 = new QLabel("mm", this);
  gbox2->addWidget(Label11, 4,2);

  QSpacerItem *mySpacer=new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding);
  gbox2->addItem(mySpacer, 5, 0, 1, -1);

   QSize sz;
   boxImage = new QGroupBox(tr("Preview"), this);
   gboxImage = new QGridLayout();
   boxImage->setLayout(gboxImage);
   QString s1 = ":/bitmaps/LC_Ladder_Pi_LPF.svg";
   imgLayout = new QSvgWidget(s1);
   sz = imgLayout->size();
   imgLayout->setFixedSize(.5*sz);
   gboxImage->addWidget(imgLayout);
    
 

  // ...........................................................
  QVBoxLayout *vboxButtons = new QVBoxLayout();
  QPushButton *ButtonGo = new QPushButton(tr("Calculate and put into Clipboard"), this);
  connect(ButtonGo, SIGNAL(clicked()), SLOT(slotCalculate()));
  vboxButtons->addWidget(ButtonGo);

  LabelResult = new QLabel(this);
  ResultState = 100;
  slotShowResult();
  LabelResult->setAlignment(Qt::AlignHCenter);
  vboxButtons->addWidget(LabelResult);

  QVBoxLayout *vbox_all = new QVBoxLayout();
  QVBoxLayout *vboxRealisation = new QVBoxLayout();
  QVBoxLayout *vboxMicrostrip = new QVBoxLayout();

  vboxRealisation->addWidget(box1);
  hbox->addLayout(vboxRealisation);
  vboxMicrostrip->addWidget(box2);
  vboxMicrostrip->addWidget(boxImage);
  hbox->addLayout(vboxMicrostrip);
  vbox_all->addLayout(hbox);
  vbox_all->addLayout(vboxButtons);
  centralWidget->setLayout(vbox_all);

  // -------  finally set initial state  --------
  slotTypeChanged(0);
  slotClassChanged(0);
}
KNotesApp::KNotesApp()
  : QWidget(), m_alarm( 0 ), m_listener( 0 ), m_publisher( 0 ), m_find( 0 ), m_findPos( 0 )
{
  new KNotesAdaptor( this );
  QDBusConnection::sessionBus().registerObject( "/KNotes" , this );
  kapp->setQuitOnLastWindowClosed( false );

  // create the dock widget...
  m_tray = new KStatusNotifierItem(0);

  m_tray->setToolTipTitle( i18n( "KNotes: Sticky notes for KDE" ) );
  m_tray->setIconByName( "knotes" );
  m_tray->setToolTipIconByName( "knotes" );
  m_tray->setStatus( KStatusNotifierItem::Active );
  m_tray->setCategory( KStatusNotifierItem::ApplicationStatus );
  m_tray->setStandardActionsEnabled(false);
  connect( m_tray, SIGNAL(activateRequested(bool,QPoint)), this, SLOT(slotActivateRequested(bool,QPoint)) );
  connect( m_tray, SIGNAL(secondaryActivateRequested(QPoint)), this, SLOT(slotSecondaryActivateRequested(QPoint)) );

  // set the initial style
#ifdef __GNUC__
#warning FIXME
#endif
  //    KNote::setStyle( KNotesGlobalConfig::style() );

  // create the GUI...
  KAction *action  = new KAction( KIcon( "document-new" ),
                                  i18n( "New Note" ), this );
  actionCollection()->addAction( "new_note", action );
  action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_N ));
  connect( action, SIGNAL(triggered()), SLOT(newNote()) );

  action  = new KAction( KIcon( "edit-paste" ),
                         i18n( "New Note From Clipboard" ), this );
  actionCollection()->addAction( "new_note_clipboard", action );
  action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_C ));
  connect( action, SIGNAL(triggered()), SLOT(newNoteFromClipboard()) );

  action  = new KAction( KIcon( "knotes" ), i18n( "Show All Notes" ), this );
  actionCollection()->addAction( "show_all_notes", action );
  action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_S ));
  connect( action, SIGNAL(triggered()), SLOT(showAllNotes()) );

  action  = new KAction( KIcon( "window-close" ),
                         i18n( "Hide All Notes" ), this );
  actionCollection()->addAction( "hide_all_notes", action );
  action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_H ));
  connect( action, SIGNAL(triggered()), SLOT(hideAllNotes()) );

  new KHelpMenu( this, KGlobal::mainComponent().aboutData(), false,
                 actionCollection() );

  m_findAction = KStandardAction::find( this, SLOT(slotOpenFindDialog()),
                         actionCollection() );
  KStandardAction::preferences( this, SLOT(slotPreferences()),
                         actionCollection() );
  KStandardAction::keyBindings( this, SLOT(slotConfigureAccels()),
                         actionCollection() );
  //FIXME: no shortcut removing!?
  KStandardAction::quit( this, SLOT(slotQuit()),
                         actionCollection() )->setShortcut( 0 );

  setXMLFile( componentData().componentName() + "appui.rc" );

  m_guiBuilder = new KXMLGUIBuilder( this );
  m_guiFactory = new KXMLGUIFactory( m_guiBuilder, this );
  m_guiFactory->addClient( this );

  m_contextMenu = static_cast<KMenu *>( m_guiFactory->container(
                                        "knotes_context",
                                        this ) );
  m_noteMenu = static_cast<KMenu *>( m_guiFactory->container(
                                      "notes_menu", this ) );
  m_tray->setContextMenu( m_contextMenu );
  // get the most recent XML UI file
  QString xmlFileName = componentData().componentName() + "ui.rc";
  QString filter = componentData().componentName() + '/' + xmlFileName;
  const QStringList fileList =
      componentData().dirs()->findAllResources( "data", filter ) +
      componentData().dirs()->findAllResources( "data", xmlFileName );

  QString doc;
  KXMLGUIClient::findMostRecentXMLFile( fileList, doc );
  m_noteGUI.setContent( doc );

  KConfigGroup config( KGlobal::config(), "Global Keybindings" );

  // clean up old config files
  KNotesLegacy::cleanUp();

  // create the resource manager
  m_manager = new KNotesResourceManager();
  connect( m_manager, SIGNAL(sigRegisteredNote(KCal::Journal*)),
           this,      SLOT(createNote(KCal::Journal*)) );
  connect( m_manager, SIGNAL(sigDeregisteredNote(KCal::Journal*)),
           this,      SLOT(killNote(KCal::Journal*)) );

  // read the notes
  m_manager->load();

  // read the old config files, convert and add them
  KCal::CalendarLocal calendar( QString::fromLatin1( "UTC" ) );
  if ( KNotesLegacy::convert( &calendar ) ) {
    KCal::Journal::List notes = calendar.journals();
    KCal::Journal::List::ConstIterator it;
    for ( it = notes.constBegin(); it != notes.constEnd(); ++it ) {
      m_manager->addNewNote( *it );
    }

    m_manager->save();
  }

  // set up the alarm reminder - do it after loading the notes because this
  // is used as a check if updateNoteActions has to be called for a new note
  m_alarm = new KNotesAlarm( m_manager, this );

   updateNetworkListener();

  if ( m_notes.size() == 0 && !kapp->isSessionRestored() ) {
      newNote();
  }

  updateNoteActions();
}
Example #27
0
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent)
{
  // set application icon
  ///setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Filter " PACKAGE_VERSION);

  all = new Q3VBoxLayout(this);

  // --------  create menubar  -------------------
  Q3PopupMenu *fileMenu = new Q3PopupMenu();
  fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q);

  Q3PopupMenu *helpMenu = new Q3PopupMenu();
  helpMenu->insertItem(
                tr("&About Qucs Filter..."), this, SLOT(slotHelpAbout()), 0);
  helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0);

  QMenuBar *bar = new QMenuBar(this);
  bar->insertItem(tr("&File"), fileMenu);
  bar->insertSeparator ();
  bar->insertItem(tr("&Help"), helpMenu);
  all->addWidget(bar);

  // reserve space for menubar
  all->addSpacing (bar->height() + 2);

  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  Q3GridLayout *gp1 = new Q3GridLayout(Tab1,12,6,5,5);

  FilterName = new QComboBox(FALSE, Tab1);
  gp1->addWidget(FilterName,0,0);
  TformName = new QComboBox(FALSE, Tab1);
  gp1->addWidget(TformName,0,1);

  OrderBox = new QCheckBox(tr("Specify order"), Tab1);
  gp1->addWidget(OrderBox,1,0);
  Q3HBox *h1 = new Q3HBox(Tab1);
  h1->setSpacing (5);
  OrderCombo = new QComboBox(FALSE, h1);
  OrderCombo->setEnabled(TRUE);
  SubOrderCombo = new QComboBox(FALSE, h1);
  SubOrderCombo->setEnabled(FALSE);
  SubOrderCombo->insertItem( tr( "b" ) );
  SubOrderCombo->insertItem( tr( "c" ) );
  gp1->addWidget(h1,1,1);

  CutoffLabel = new QLabel(tr("Cutoff/Center"),Tab1);
  gp1->addWidget(CutoffLabel,2,0);
  EnterCutoff = new QLineEdit(Tab1);
  gp1->addWidget(EnterCutoff,2,1);
  CutoffCombo = new QComboBox(Tab1);
  CutoffCombo->insertItem( tr( "Hz" ) );
  CutoffCombo->insertItem( tr( "kHz" ) );
  CutoffCombo->insertItem( tr( "MHz" ) );
  CutoffCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(CutoffCombo,2,2);

  RippleLabel = new QLabel(tr("Ripple"),Tab1);
  gp1->addWidget(RippleLabel,3,0);
  EnterRipple = new QLineEdit(Tab1);
  gp1->addWidget(EnterRipple,3,1);
  RippleUnitLabel = new QLabel(tr("dB"),Tab1);
  gp1->addWidget(RippleUnitLabel,3,2);

  AngleLabel = new QLabel(tr("Angle"),Tab1);
  gp1->addWidget(AngleLabel,3,3);
  EnterAngle = new QLineEdit(Tab1);
  gp1->addWidget(EnterAngle,3,4);
  AngleUnitLabel = new QLabel(tr("°"),Tab1);
  gp1->addWidget(AngleUnitLabel,3,5);

  ZinLabel = new QLabel(tr("Zin"),Tab1);
  gp1->addWidget(ZinLabel,7,0);
  EnterZin = new QLineEdit(Tab1);
  gp1->addWidget(EnterZin,7,1);
  OhmLabel = new QLabel(tr("Ohm"),Tab1);
  gp1->addWidget(OhmLabel,7,2);

  ZoutLabel = new QLabel(tr("Zout"),Tab1);
  ZoutLabel->setEnabled(false);
  gp1->addWidget(ZoutLabel,7,3);
  EnterZout = new QLineEdit(Tab1);
  gp1->addWidget(EnterZout,7,4);
  OhmLabel_2 = new QLabel(tr("Ohm"),Tab1);
  gp1->addWidget(OhmLabel_2,7,5);

  StopbandLabel = new QLabel(tr("Stopband corner"),Tab1);
  gp1->addWidget(StopbandLabel,5,0);
  EnterStopband = new QLineEdit(Tab1);
  gp1->addWidget(EnterStopband,5,1);
  StopbandCombo = new QComboBox(FALSE, Tab1);
  StopbandCombo->insertItem( tr( "Hz" ) );
  StopbandCombo->insertItem( tr( "kHz" ) );
  StopbandCombo->insertItem( tr( "MHz" ) );
  StopbandCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(StopbandCombo,5,2);

  BandwidthLabel = new QLabel(tr("Bandwidth"),Tab1);
  BandwidthLabel->setEnabled(FALSE);
  gp1->addWidget(BandwidthLabel,4,0);
  EnterBandwidth = new QLineEdit(Tab1);
  gp1->addWidget(EnterBandwidth,4,1);
  BandwidthCombo = new QComboBox(FALSE, Tab1);
  BandwidthCombo->setEnabled(FALSE);
  BandwidthCombo->insertItem( tr( "Hz" ) );
  BandwidthCombo->insertItem( tr( "kHz" ) );
  BandwidthCombo->insertItem( tr( "MHz" ) );
  BandwidthCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(BandwidthCombo,4,2);

  AttenuationLabel = new QLabel(tr("Attenuation"),Tab1);
  gp1->addWidget(AttenuationLabel,6,0);
  EnterAttenuation = new QLineEdit(Tab1);
  gp1->addWidget(EnterAttenuation,6,1);
  dBLabel = new QLabel(tr("dB"),Tab1);
  gp1->addWidget(dBLabel,6,2);

  DualBox = new QCheckBox(tr("dual"),Tab1);
  gp1->addMultiCellWidget(DualBox,8,8,0,2);
  CauerPoleBox = new QCheckBox(tr("Stopband is first pole"),Tab1);
  CauerPoleBox->setEnabled(FALSE);
  gp1->addMultiCellWidget(CauerPoleBox,9,9,0,2);
  OptimizeCauerBox = new QCheckBox(tr("Optimize cauer"),Tab1);
  OptimizeCauerBox->setEnabled(FALSE);
  gp1->addMultiCellWidget(OptimizeCauerBox,10,10,0,2);
  EqualInductorBox = new QCheckBox(tr("Equal inductors"),Tab1);
  EqualInductorBox->setEnabled(FALSE);
  gp1->addMultiCellWidget(EqualInductorBox,8,8,3,5);
  UseCrossBox = new QCheckBox(tr("+ rather than T"),Tab1);
  UseCrossBox->setEnabled(FALSE);
  gp1->addMultiCellWidget(UseCrossBox,9,9,3,5);

  Cboxes = new Q3VButtonGroup(tr("Optimize C"),Tab1);
  Cmin = new QRadioButton(tr("Cmin"),Cboxes);
  Cmax = new QRadioButton(tr("Cmax"),Cboxes);
  NoC = new QRadioButton(tr("noC"),Cboxes);
  gp1->addMultiCellWidget(Cboxes,11,11,0,2);

  Lboxes = new Q3VButtonGroup(tr("Optimize L"),Tab1);
  Lmin = new QRadioButton(tr("Lmin"),Lboxes);
  Lmax = new QRadioButton(tr("Lmax"),Lboxes);
  NoL = new QRadioButton(tr("noL"),Lboxes);
  gp1->addMultiCellWidget(Lboxes,11,11,3,5);

  t->addTab(Tab1, tr("LC Filters"));

  // ...........................................................
  QWidget *Tab2 = new QWidget(t);
  t->addTab(Tab2, tr("Microstrip Filters"));

  // ...........................................................
  QWidget *Tab3 = new QWidget(t);
  t->addTab(Tab3, tr("Active Filters"));

  // reserve space for vertical resizing
  all->addStretch();

  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  Q3HBox *Butts = new Q3HBox(this);
  Butts->setSpacing(3);
  Butts->setMargin(3);
  all->addWidget(Butts);

  cancelButton = new QPushButton(tr("Exit"),Butts);
  okButton = new QPushButton(tr("Calculate"),Butts);
  okButton->setEnabled(FALSE);

  // signals and slots connections
  connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
  connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
}
Example #28
0
QssEditor::QssEditor(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::QssEditor),
    m_changed(false)
{
    ui->setupUi(this);

    // some default values
    QHash<QString, QVariant> defaultValues;

    defaultValues.insert(SETTING_PREVIEW_DELAY, 750);

    Settings::instance()->addDefaultValues(defaultValues);

    resetWindowTitle();

    // icons
    ui->toolOpen->setIcon(QIcon::fromTheme("document-open", QIcon(":/images/open.png")));
    ui->toolSave->setIcon(QIcon::fromTheme("document-save", QIcon(":/images/save.png")));
    ui->toolSaveAs->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/images/saveas.png")));
    ui->toolClose->setIcon(QIcon::fromTheme("window-close", QIcon(":/images/close.png")));
    ui->toolUndo->setIcon(QIcon::fromTheme("edit-undo", QIcon(":/images/undo.png")));
    ui->toolRedo->setIcon(QIcon::fromTheme("edit-redo", QIcon(":/images/redo.png")));
    ui->toolOptions->setIcon(QIcon::fromTheme("preferences-system", QIcon(":/images/options.png")));

    // application shortcuts
    new QShortcut(QKeySequence::Quit, this, SLOT(slotQuit()));
    new QShortcut(QKeySequence::Find, this, SLOT(slotFind()));
    new QShortcut(QKeySequence::FindNext, this, SLOT(slotFindNext()));
    new QShortcut(QKeySequence::HelpContents, this, SLOT(slotAbout()));

    // shortcuts
    ui->toolOpen->setShortcut(QKeySequence::Open);
    ui->toolSave->setShortcut(QKeySequence::Save);
    ui->toolSaveAs->setShortcut(QKeySequence::SaveAs);
    ui->toolClose->setShortcut(QKeySequence::Close);

    // built-in Qt icon
    ui->toolAboutQt->setIcon(QIcon(
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
    ":/qt-project.org/qmessagebox/images/qtlogo-64.png"
#else
    ":/trolltech/qmessagebox/images/qtlogo-64.png"
#endif
                                 ));

    // menu for toolbutton
    QMenu *toolButtonMenu = new QMenu(this);
    toolButtonMenu->addAction("Item1");
    toolButtonMenu->addSeparator();
    toolButtonMenu->addAction("Item2");
    ui->toolButton->setMenu(toolButtonMenu);

    m_timerDelayedApply = new QTimer(this);
    m_timerDelayedApply->setSingleShot(true);
    connect(m_timerDelayedApply, SIGNAL(timeout()), this, SLOT(slotApplyCss()));
    resetPreviewDelay();

    QTimer *timerProgress = new QTimer(this);
    timerProgress->setInterval(500);
    connect(timerProgress, SIGNAL(timeout()), this, SLOT(slotProgress()));
    timerProgress->start();

    ui->splitter->setCollapsible(0, false);
    ui->splitter->setStretchFactor(0, 1);

    // splitter size
    QList<int> list = QList<int>() << width()/2 << width()/2;
    ui->splitter->setSizes(list);

    // some MDI windows
    QMdiSubWindow *mdi = ui->mdiArea->addSubWindow(new QLabel("MDI", ui->mdiArea));
    mdi->resize(160, 80);

#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
    ui->tree->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
#else
    ui->tree->header()->setResizeMode(QHeaderView::ResizeToContents);
    ui->table->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
#endif

    ui->tree->topLevelItem(0)->setExpanded(true);

    ui->text->setCaretLineVisible(true);
    ui->text->setCaretLineBackgroundColor(QColor("gainsboro"));

    ui->text->setAutoIndent(true);
    ui->text->setIndentationGuides(false);
    ui->text->setIndentationsUseTabs(true);
    ui->text->setIndentationWidth(4);

    ui->text->setMarginsBackgroundColor(QColor("gainsboro"));
    ui->text->setMarginLineNumbers(1, true);
    ui->text->setMarginWidth(1, 50);

    ui->text->setAutoCompletionSource(QsciScintilla::AcsAll);
    ui->text->setAutoCompletionReplaceWord(true);
    ui->text->setAutoCompletionCaseSensitivity(false);
    ui->text->setAutoCompletionUseSingle(QsciScintilla::AcusAlways);
    ui->text->setAutoCompletionThreshold(0);

    ui->text->setBraceMatching(QsciScintilla::SloppyBraceMatch);
    ui->text->setMatchedBraceBackgroundColor(Qt::yellow);
    ui->text->setUnmatchedBraceForegroundColor(Qt::blue);

    // QSS lexer
    QsciLexerQSS *lexQss = new QsciLexerQSS(this);
    ui->text->setLexer(lexQss);

    ui->text->setFocus();
    ui->text->installEventFilter(this);

    restoreLastFiles();

    QTimer::singleShot(0, this, SLOT(slotDelayedOpen()));
}
Example #29
0
void MainWindow::setupActions()
{
  //file menu
  KStdAction::open(this, SLOT(slotOpenFile()), actionCollection());

  m_actionRecent = KStdAction::openRecent(this, SLOT(slotFileRecent(const KURL&)), actionCollection());
  m_actionRecent->loadEntries(kapp->config());//,"Recent Files");

  KStdAction::close(this, SLOT(slotCloseFile()), actionCollection());

  (void)new KAction(i18n("Close All"), 0, this, SLOT(slotCloseAllFiles()), actionCollection(), "file_close_all");

  KStdAction::quit(this, SLOT(slotQuit()), actionCollection());

  KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection());
  KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
  KStdAction::preferences(this, SLOT(slotShowSettings()), actionCollection(), "settings_protoeditor");

  m_siteAction     = new KSelectAction("Site", 0, actionCollection(), "site_selection");

  connect(m_siteAction, SIGNAL(activated(const QString&)),
          ProtoeditorSettings::self(), SLOT(slotCurrentSiteChanged(const QString&)));

  m_defaultScriptAction = new KSelectAction("Default script", 0, actionCollection(), "default_script");
  QStringList l;
  l << "Site Script" << "Active Script";
  m_defaultScriptAction->setItems(l);
  m_defaultScriptAction->setCurrentItem(0);

  //   connect(m_defaultScriptAction, SIGNAL(activated(int)),
  //           this, SLOT(slotDefaultScriptChanged(int)));


  //   (void)new KAction(i18n("&Run"), "gear", "F9", m_debugger_manager,
  //                     SLOT(slotDebugStart()), actionCollection(), "script_run_current_script");

  (void)new KAction(i18n("Start Debug"), "dbgstart", "F5", m_debugger_manager,
                    SLOT(slotDebugStart()), actionCollection(), "debug_start");

  (void)new KAction(i18n("Stop Debug"), "stop", "Escape", m_debugger_manager,
                    SLOT(slotDebugStop()), actionCollection(), "debug_stop");

  (void)new KAction(i18n("Step Over"), "dbgnext", "F6", m_debugger_manager,
                    SLOT(slotDebugStepOver()), actionCollection(), "debug_step_over");

  (void)new KAction(i18n("Step Into"), "dbgstep", "F7", m_debugger_manager,
                    SLOT(slotDebugStepInto()), actionCollection(), "debug_step_into");

  (void)new KAction(i18n("Step Out"), "dbgstepout", "F8", m_debugger_manager,
                    SLOT(slotDebugStepOut()), actionCollection(), "debug_step_out");

  (void)new KAction(i18n("Profile"), "math_sum", "Alt+P", m_debugger_manager,
                    SLOT(slotProfile()), actionCollection(), "script_profile");

  (void)new KAction(i18n("Toggle Breakpoint"), "activebreakpoint", "Alt+B", m_debugger_manager,
                    SLOT(slotDebugToggleBp()), actionCollection(), "debug_toggle_bp");

  (void)new KAction("", "math_brace", 0, m_tabEditor,
                    SLOT(slotAddWatch()), actionCollection(), "editor_add_watch");


  setStandardToolBarMenuEnabled(true);
}
Example #30
0
rmsMonitor::rmsMonitor (NV_INT32 *argc, NV_CHAR **argv, QWidget * parent):
  QMainWindow (parent, 0)
{
  extern char     *optarg;
  
  lock_track = NVFalse;


  QResource::registerResource ("/icons.rcc");


  //  Have to set the focus policy or keypress events don't work properly at first in Focus Follows Mouse mode

  setFocusPolicy (Qt::WheelFocus);
  setFocus (Qt::ActiveWindowFocusReason);


  //  Set the main icon

  setWindowIcon (QIcon (":/icons/charts_monitor.png"));


  kill_switch = ANCILLARY_FORCE_EXIT;

  NV_INT32 option_index = 0;
  while (NVTrue) 
    {
      static struct option long_options[] = {{"shared_memory_key", required_argument, 0, 0},
                                             {"kill_switch", required_argument, 0, 0},
                                             {0, no_argument, 0, 0}};

      NV_CHAR c = (NV_CHAR) getopt_long (*argc, argv, "o", long_options, &option_index);
      if (c == -1) break;

      switch (c) 
        {
        case 0:

          switch (option_index)
            {
            case 0:
              sscanf (optarg, "%d", &key);
              break;

            case 1:
              sscanf (optarg, "%d", &kill_switch);
              break;

            default:
              NV_CHAR tmp;
              sscanf (optarg, "%1c", &tmp);
              ac[option_index] = (NV_U_INT32) tmp;
              break;
            }
          break;
        }
    }


  if (!envin ())
    {
      //  Set the geometry from defaults since we didn't get any from the saved settings.

      this->resize (324, 400);
      this->move (0, 0);
    }


  setWindowTitle (QString (VERSION));


  /******************************************* IMPORTANT NOTE ABOUT SHARED MEMORY **************************************** \

      This is a little note about the use of shared memory within the Area-Based Editor (ABE) programs.  If you read
      the Qt documentation (or anyone else's documentation) about the use of shared memory they will say "Dear [insert
      name of omnipotent being of your choice here], whatever you do, always lock shared memory when you use it!".
      The reason they say this is that access to shared memory is not atomic.  That is, reading shared memory and then
      writing to it is not a single operation.  An example of why this might be important - two programs are running,
      the first checks a value in shared memory, sees that it is a zero.  The second program checks the same location
      and sees that it is a zero.  These two programs have different actions they must perform depending on the value
      of that particular location in shared memory.  Now the first program writes a one to that location which was
      supposed to tell the second program to do something but the second program thinks it's a zero.  The second program
      doesn't do what it's supposed to do and it writes a two to that location.  The two will tell the first program 
      to do something.  Obviously this could be a problem.  In real life, this almost never occurs.  Also, if you write
      your program properly you can make sure this doesn't happen.  In ABE we almost never lock shared memory because
      something much worse than two programs getting out of sync can occur.  If we start a program and it locks shared
      memory and then dies, all the other programs will be locked up.  When you look through the ABE code you'll see
      that we very rarely lock shared memory, and then only for very short periods of time.  This is by design.

  \******************************************* IMPORTANT NOTE ABOUT SHARED MEMORY ****************************************/


  //  Get the shared memory area.  If it doesn't exist, quit.  It should have already been created 
  //  by pfmView or geoSwath.

  QString skey;
  skey.sprintf ("%d_abe", key);

  abeShare = new QSharedMemory (skey);

  if (!abeShare->attach (QSharedMemory::ReadWrite))
    {
      fprintf (stderr, "\n\nError retrieving shared memory segment in %s.\n\n", argv[0]);
      exit (-1);
    }

  abe_share = (ABE_SHARE *) abeShare->data ();


  //  Open all the PFM structures that are being viewed in pfmEdit/pfmView

  num_pfms = abe_share->pfm_count;

  for (NV_INT32 pfm = 0 ; pfm < num_pfms ; pfm++)
    {
      open_args[pfm] = abe_share->open_args[pfm];

      if ((pfm_handle[pfm] = open_existing_pfm_file (&open_args[pfm])) < 0)
	{
	  QMessageBox::warning (this, tr ("Open PFM Structure"),
				tr ("The file ") + QDir::toNativeSeparators (QString (abe_share->open_args[pfm].list_path)) + 
				tr (" is not a PFM handle or list file or there was an error reading the file.") +
				tr ("  The error message returned was:\n\n") +
				QString (pfm_error_str (pfm_error)));
	}
    }


  QFrame *frame = new QFrame (this, 0);
  
  setCentralWidget (frame);

  QVBoxLayout *vBox = new QVBoxLayout ();
  vBox->setSpacing(0);
  frame->setLayout (vBox);

  listBox = new QTextEdit (this);
  listBox->setAutoFillBackground (TRUE);
  listBoxPalette.setColor (QPalette::Normal, QPalette::Base, bg_color);
  listBoxPalette.setColor (QPalette::Normal, QPalette::Window, bg_color);
  listBoxPalette.setColor (QPalette::Inactive, QPalette::Base, bg_color);
  listBoxPalette.setColor (QPalette::Inactive, QPalette::Window, bg_color);
  listBox->setPalette (listBoxPalette);
  listBox->setReadOnly (TRUE);


  vBox->addWidget (listBox);


  //  Setup the file menu.

  QAction *fileQuitAction = new QAction (tr ("&Quit"), this);


  fileQuitAction->setStatusTip (tr ("Exit from application"));
  connect (fileQuitAction, SIGNAL (triggered ()), this, SLOT (slotQuit ()));

  QAction *filePrefsAction= new QAction (tr ("&Prefs"), this);
  filePrefsAction->setStatusTip (tr ("Set Preferences"));
  connect (filePrefsAction, SIGNAL (triggered ()), this, SLOT (slotPrefs ()));


  QMenu *fileMenu = menuBar ()->addMenu (tr ("&File"));
  fileMenu->addAction (filePrefsAction);
  fileMenu->addSeparator ();
  fileMenu->addAction (fileQuitAction);


  //  Setup the help menu.  I like leaving the About Qt in since this is
  //  a really nice package - and it's open source.

  QAction *aboutAct = new QAction (tr ("&About"), this);
  aboutAct->setShortcut (tr ("Ctrl+A"));
  aboutAct->setStatusTip (tr ("Information about rmsMonitor"));
  connect (aboutAct, SIGNAL (triggered ()), this, SLOT (about ()));

  QAction *aboutQtAct = new QAction (tr ("About&Qt"), this);
  aboutQtAct->setShortcut (tr ("Ctrl+Q"));
  aboutQtAct->setStatusTip (tr ("Information about Qt"));
  connect (aboutQtAct, SIGNAL (triggered ()), this, SLOT (aboutQt ()));

  QAction *whatThisAct = QWhatsThis::createAction (this);

  QMenu *helpMenu = menuBar ()->addMenu (tr ("&Help"));
  helpMenu->addAction (aboutAct);
  helpMenu->addSeparator ();
  helpMenu->addAction (aboutQtAct);
  helpMenu->addAction (whatThisAct);


  //  Setup the tracking timer

  QTimer *track = new QTimer (this);
  connect (track, SIGNAL (timeout ()), this, SLOT (trackCursor ()));
  track->start (10);
}