Пример #1
0
DisplayWidget::DisplayWidget(QWidget* parent) : QWidget(parent)
{     
    m_pWidget = new QWidget(this);
    m_pWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    m_lblVideoPixmap = new QLabel();
    m_lblVideoPixmap->setFixedSize(320,240);

    m_btSaveAs = new QPushButton(this);
    m_btSaveAs->setText("Save Calibration File");
    m_btSaveAs->setFixedSize(200,50);

    m_btStart = new QPushButton(this);
    m_btStart->setText("Start Calibration");
    m_btStart->setFixedSize(200,50);
   
    QVBoxLayout *buttonsLayout = new QVBoxLayout();
    buttonsLayout->addWidget(m_btStart);
    buttonsLayout->addWidget(m_btSaveAs);

    m_mainLayout = new QHBoxLayout();
    m_mainLayout->addWidget(m_lblVideoPixmap,0,Qt::AlignCenter);
    m_mainLayout->addLayout(buttonsLayout, 0);
    setLayout(m_mainLayout);

    connect(m_btSaveAs,SIGNAL(clicked()),this,SLOT(OnSaveAs()));
        
    m_btSaveAs->setEnabled(false);
}
Пример #2
0
/**
 * RegEdit
 */
RegEdit::RegEdit(Backend *backend, QWidget *parent)
    :QWidget(parent), m_backend(backend)
{
    QVBoxLayout *m_vert_layout = new QVBoxLayout();
    m_file_group = new QGroupBox("File selection", this);
    QHBoxLayout *m_file_group_layout = new QHBoxLayout();
    m_file_edit = new QLineEdit(this);
    m_file_edit->setReadOnly(true);
    m_file_open = new QToolButton(this);
    m_file_open->setText("Open");
    m_file_open->setIcon(QIcon::fromTheme("document-open"));
    m_file_open->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    QMenu *file_open_menu = new QMenu(this);
    QAction *new_act = file_open_menu->addAction(QIcon::fromTheme("document-new"), "New...");
    m_file_open->setMenu(file_open_menu);

    m_file_save = new QToolButton(this);
    m_file_save->setText("Save");
    m_file_save->setIcon(QIcon::fromTheme("document-save"));
    m_file_save->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    QMenu *file_save_menu = new QMenu(this);
    QAction *saveas_act = file_save_menu->addAction(QIcon::fromTheme("document-save-as"), "Save as...");
    m_file_save->setMenu(file_save_menu);
    m_file_group_layout->addWidget(m_file_open);
    m_file_group_layout->addWidget(m_file_save);
    m_file_group_layout->addWidget(m_file_edit);

    m_splitter = new QSplitter(this);
    m_soc_tree = new QTreeWidget(this);
    m_soc_tree->setColumnCount(1);
    m_soc_tree->setHeaderLabel(QString("Name"));
    m_soc_tree->setContextMenuPolicy(Qt::ActionsContextMenu);
    QAction *soc_tree_delete_action = new QAction("&Delete", this);
    soc_tree_delete_action->setIcon(QIcon::fromTheme("list-remove"));
    connect(soc_tree_delete_action, SIGNAL(triggered()), this, SLOT(OnSocItemDelete()));
    m_soc_tree->addAction(soc_tree_delete_action);
    m_splitter->addWidget(m_soc_tree);
    m_splitter->setStretchFactor(0, 0);

    m_file_group->setLayout(m_file_group_layout);
    m_vert_layout->addWidget(m_file_group);
    m_vert_layout->addWidget(m_splitter, 1);

    setLayout(m_vert_layout);

    SetModified(false, false);
    m_right_panel = 0;
    SetPanel(new EmptyEditPanel(this));
    UpdateTabName();

    connect(m_file_open, SIGNAL(clicked()), this, SLOT(OnOpen()));
    connect(m_file_save, SIGNAL(clicked()), this, SLOT(OnSave()));
    connect(new_act, SIGNAL(triggered()), this, SLOT(OnNew()));
    connect(saveas_act, SIGNAL(triggered()), this, SLOT(OnSaveAs()));
    connect(m_soc_tree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
        this, SLOT(OnSocItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
    connect(m_soc_tree, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
        this, SLOT(OnSocItemActivated(QTreeWidgetItem*, int)));
}
Пример #3
0
/************************************************************
* 功能		: 将界面上的信息保存到 xx.xml文件中
* 输入		: 无
* 返回值	: void
*************************************************************/
bool CreatModel::OnSave()
{
	if (m_flagName.isEmpty())
	{
		return OnSaveAs();
	}
    return saveFile(m_flagName);
}
Пример #4
0
bool MyFrame::Save()
{
    wxCommandEvent event;

    if (m_filename.empty())
        OnSaveAs( event );
    else
        m_text->SaveFile( m_filename );

   return true;
}
Пример #5
0
void EditorBase::InitActions()
{
    mNewAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
    mNewAct->setShortcut(tr("Ctrl+N"));
    mNewAct->setStatusTip(tr("Create a new file"));
    connect(mNewAct, SIGNAL(triggered()), this, SLOT(OnNew()));

    mOpenAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
    mOpenAct->setShortcut(tr("Ctrl+O"));
    mOpenAct->setStatusTip(tr("Open an existing file"));
    connect(mOpenAct, SIGNAL(triggered()), this, SLOT(OnOpen()));

    mSaveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
    mSaveAct->setShortcut(tr("Ctrl+S"));
    mSaveAct->setStatusTip(tr("Save the document to disk"));
    connect(mSaveAct, SIGNAL(triggered()), this, SLOT(OnSave()));

    mSaveAsAct = new QAction(tr("Save &As..."), this);
    mSaveAsAct->setStatusTip(tr("Save the document under a new name"));
    connect(mSaveAsAct, SIGNAL(triggered()), this, SLOT(OnSaveAs()));

    mExitAct = new QAction(tr("E&xit"), this);
    mExitAct->setShortcut(tr("Ctrl+Q"));
    mExitAct->setStatusTip(tr("Exit the application"));
    connect(mExitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

    mCutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this);
    mCutAct->setShortcut(tr("Ctrl+X"));
    mCutAct->setStatusTip(tr("Cut the current selection's contents to the clipboard"));
    connect(mCutAct, SIGNAL(triggered()), this, SLOT(OnCut()));

    mCopyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this);
    mCopyAct->setShortcut(tr("Ctrl+C"));
    mCopyAct->setStatusTip(tr("Copy the current selection's contents to the clipboard"));
    connect(mCopyAct, SIGNAL(triggered()), this, SLOT(OnCopy()));

    mPasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this);
    mPasteAct->setShortcut(tr("Ctrl+V"));
    mPasteAct->setStatusTip(tr("Paste the clipboard's contents into the current selection"));
    connect(mPasteAct, SIGNAL(triggered()), this, SLOT(OnPaste()));

    mSeparatorAct = new QAction(this);
    mSeparatorAct->setSeparator(true);

    mAboutAct = new QAction(tr("&About"), this);
    mAboutAct->setStatusTip(tr("Show the application's About box"));
    connect(mAboutAct, SIGNAL(triggered()), this, SLOT(OnAbout()));

    mAboutQtAct = new QAction(tr("About &Qt"), this);
    mAboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
    connect(mAboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
Пример #6
0
//------------------------------------------------------------------------------
// void FunctionSetupPanel::OnButton(wxCommandEvent& event)
//------------------------------------------------------------------------------
void FunctionSetupPanel::OnButton(wxCommandEvent& event)
{
   // This is Save button which was renamed from OK button
   if (event.GetEventObject() == theOkButton)
   {
      #ifdef DEBUG_FUNCTIONPANEL_BUTTON
      MessageInterface::ShowMessage
         (wxT("FunctionSetupPanel::OnButton() entered, it is Save Button\n"));
      #endif
      
      if (mIsNewFunction)
         OnSaveAs(event);
      else
         SaveData();
   }
   // This is SaveAs button which was renamed from Apply button
   else if (event.GetEventObject() == theApplyButton)
   {
      #ifdef DEBUG_FUNCTIONPANEL_BUTTON
      MessageInterface::ShowMessage
         (wxT("FunctionSetupPanel::OnButton() entered, it is SaveAs Button\n"));
      #endif
      
      OnSaveAs(event);
   }
   // This is Close button which was renamed from Cancel button
   else if (event.GetEventObject() == theCancelButton)
   {
      #ifdef DEBUG_FUNCTIONPANEL_BUTTON
      MessageInterface::ShowMessage
         (wxT("FunctionSetupPanel::OnButton() entered, it is Close Button, canClose=%d\n"),
          canClose);
      #endif
      
      GmatAppData::Instance()->GetMainFrame()->CloseActiveChild();
   }
}
Пример #7
0
int RE::ReClipWorkshop::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = ReBaseWidget<QWidget>::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: OnContextMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 1: OnLoadImage(); break;
        case 2: OnImport(); break;
        case 3: OnSave(); break;
        case 4: OnSaveAs(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
Пример #8
0
void Frame::OnClose(wxCloseEvent& event)
{
	ConfirmDialog dlg(this);
	int val = dlg.ShowModal();
	if (val == wxID_YES) 
	{
		std::string filepath = EditedFileStack::Instance()->GetBottom();
		if (!filepath.empty()) {
			m_task->Store(filepath.c_str());
		} else {
			OnSaveAs(wxCommandEvent());
		}
		Destroy();
	} 
	else if (val == wxID_NO) 
	{
		Destroy();
	}
}
Пример #9
0
void NyqBench::OnSave(wxCommandEvent & e)
{
   if (mScript->GetLastPosition() == 0) {
      return;
   }
 
   if (mPath.GetFullPath().IsEmpty()) {
      OnSaveAs(e);
      return;
   }

   if (!mScript->SaveFile(mPath.GetFullPath()))
   {
      AudacityMessageBox(_("Script was not saved."),
                   _("Warning"),
                   wxICON_EXCLAMATION,
                   this);
      return;
   }
}
Пример #10
0
//------------------------------------------------------------------------------
void GmatSavePanel::OnSave(wxCommandEvent &event)
{
   // scriptStatus: 1 = clean, 2 = dirty, 3 = error
   int scriptStatus = theGuiManager->GetActiveScriptStatus();
   int guiStatus = theGuiManager->GetGuiStatus();
   
   #ifdef DEBUG_SAVE
   MessageInterface::ShowMessage
      ("GmatSavePanel::OnSave() entered, mSyncGui=%d, mFilename='%s'\n   tempFileName='%s', "
       "scriptStatus=%d, guiStatus=%d\n", mSyncGui, mFilename.c_str(),
       GmatAppData::Instance()->GetTempScriptName().c_str(), scriptStatus, guiStatus);
   #endif
   
   // If it is active script and both script and GUI is clean, there is nothing to save
   if (mIsScriptActive && scriptStatus == 1 && guiStatus == 1)
   {
      #ifdef DEBUG_SAVE
      MessageInterface::ShowMessage
         ("GmatSavePanel::OnSave() leaving, both script and GUI is clean\n",
          scriptStatus);
      #endif
      return;
   }
   
   mSaveCanceled = false;
   // if it is temp script file, call OnSaveAs() to bring up file dialog to save
   if (mFilename == GmatAppData::Instance()->GetTempScriptName())
   {
      OnSaveAs(event);
      if (mSaveCanceled)
      {
         #ifdef DEBUG_SAVE
         MessageInterface::ShowMessage
            ("GmatSavePanel::OnSave() leaving, user canceled SaveAs, mFilename='%s'\n", mFilename.c_str());
         #endif
         return;
      }
   }
   else if (!mSyncGui)
   {
      // Save inactive script and return
      SaveScript();
      mSyncGui = false;
      #ifdef DEBUG_SAVE
      MessageInterface::ShowMessage
         ("GmatSavePanel::OnSave() leaving, inactive script saved, mFilename='%s'\n", mFilename.c_str());
      #endif
      return;
   }
   
   // Confirm user if user wants to refresh GUI with script
   bool saveScript = false;
   if (guiStatus == 1)
   {
      saveScript = true;
   }
   // If GUI is dirty, prompt user to select an action
   else if (guiStatus == 2)
   {
      #ifdef DEBUG_SAVE
      MessageInterface::ShowMessage("   ==> Showing GUI overwrite confirm message\n");
      #endif
      wxString guiOverwriteMsg = "You will lose changes made in the GUI if the script "
         "is saved.  Do you want to save the script, discard the GUI changes, and reload "
         "the GUI with the saved script";
      if (event.GetEventObject() == mSaveSyncButton)
         guiOverwriteMsg = guiOverwriteMsg + "?";
      else if (event.GetEventObject() == mSaveSyncRunButton)
         guiOverwriteMsg = guiOverwriteMsg + " and run?";
      
      wxMessageDialog *msgDlg = new wxMessageDialog
         (this, guiOverwriteMsg, "Save script...",
          wxYES_NO | wxCANCEL |wxICON_QUESTION, wxDefaultPosition);
      
      int result = msgDlg->ShowModal();
      if (result == wxID_YES)
         saveScript = true;
      else
         mSyncGui = false;
      
      delete msgDlg;
   }
   
   #ifdef DEBUG_SAVE
   MessageInterface::ShowMessage
      ("   saveScript=%d, mSyncGui=%d\n", saveScript, mSyncGui);
   #endif
   
   if (saveScript)
      SaveAndBuildScript(event);
   
   #ifdef DEBUG_SAVE
   MessageInterface::ShowMessage
      ("GmatSavePanel::OnSave() leaving, mFilename='%s', mSyncGui=%d\n",
       mFilename.c_str(), mSyncGui);
   #endif
}