コード例 #1
0
ファイル: widget.cpp プロジェクト: keitee/kb
bool Widget::windowShouldClose()
{
    if (!isWindowModified())
        return true;

    QMessageBox::StandardButton answer =
        QMessageBox::question(
            this,
            tr("Close Window"),
            tr("Really close the window?"),
            QMessageBox::Yes | QMessageBox::No
        );

    return (answer == QMessageBox::Yes);
}
コード例 #2
0
bool MainWindow::okToContinue()
{
	if(isWindowModified())
	{
		int r = QMessageBox::warning(this, tr("RL-Dialog"), tr("Dieser Dialog wurde noch nicht gespeichert!.\n Willst du ihn jetzt speichern?"),
							QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape);
		
		if (r == QMessageBox::Yes)
			{return save(); }
		else if (r == QMessageBox::Cancel)
			{ return false; }
	}
	
	return true;
}
コード例 #3
0
bool ImageWindow::okToContinue()
{
    if (isWindowModified()) {
        int r = QMessageBox::warning(this, tr("Image Pro"),
                        tr("The image has been modified.\n"
                           "Do you want to save your changes?"),
                        QMessageBox::Yes | QMessageBox::No
                        | QMessageBox::Cancel);
        if (r == QMessageBox::Yes) {
            return save();
        } else if (r == QMessageBox::Cancel) {
            return false;
        }
    }
    return true;
}
コード例 #4
0
bool MainWindow::okToContinue()
{
    if (isWindowModified()) {
        int r = QMessageBox::warning(this, tr("Spreadsheet"),
                        tr("The document has been modified.\n"
                           "Do you want to save your changes?"),
                        QMessageBox::Yes | QMessageBox::No
                        | QMessageBox::Cancel);
        if (r == QMessageBox::Yes) {
            return save();
        } else if (r == QMessageBox::Cancel) {
            return false;
        }
    }
    return true;
}
コード例 #5
0
ファイル: mainwindow.cpp プロジェクト: Bob-IT/gnucash
bool MainWindow::maybeSave()
{
    if (isWindowModified())
    {
        QMessageBox::StandardButton ret;
        ret = QMessageBox::warning(this, tr("Application"),
                                   tr("The document has been modified.\n"
                                      "Do you want to save your changes?"),
                                   QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
        if (ret == QMessageBox::Save)
            return on_actionSave_triggered();
        else if (ret == QMessageBox::Cancel)
            return false;
    }
    return true;
}
コード例 #6
0
/** Okay to Continue Function
  *
  * Prompts the user if the user wants to continue leaving
  * the spreadsheet with unsaved changes.
  */
bool MainWindow::okToContinue()
{
    if(isWindowModified())
    {
        /* Parameters: Parent, Title, Message, Response buttons */
        int r = QMessageBox::warning(this, tr("Spreadsheet"),
                                     tr("This document has been modified.\n"
                                        "Do you want to save your changes?"),
                                     QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
        if(r == QMessageBox::Yes)
            return save();
        else if(r == QMessageBox::Cancel)
            return false;
    }
    return true;
}
コード例 #7
0
ファイル: piceditwindow.cpp プロジェクト: nop-end/qt_picedit
// check if the current single document is saved that ok to close
bool PicEditWindow::okToClose(){
    if (isWindowModified()) {
        int r = QMessageBox::warning(this, tr("PicEdit"),
                                     QFileInfo(*curFile).fileName() + tr("has been modified.\n Do you want to save your changes?"),
                                     QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
        if (r == QMessageBox::Yes) {
            return save();
        }else if (r == QMessageBox::No){
            return true;
        }else if (r == QMessageBox::Cancel) {
            return false;
        }
    }

    return true;
}
コード例 #8
0
/*!
    Indicate whether the monofin has been modified. In the latter case, ask the user to save the changes made.
*/
bool Monofin::okToContinue()
{
    if (isWindowModified()) {
        int r = QMessageBox::warning(this, tr("Monofin"),
                                     tr("The document has been modified.\n"
                                        "Do you want to save your changes?"),
                                     QMessageBox::Yes | QMessageBox::Default,
                                     QMessageBox::No,
                                     QMessageBox::Cancel | QMessageBox::Escape);
        if (r == QMessageBox::Yes)
            return save();
        else if (r == QMessageBox::Cancel)
            return false;
    }
    return true;
}
コード例 #9
0
ファイル: amuwindow.cpp プロジェクト: Zekom/AmuSketch
bool AmuWindow::saveToClose()
{
    if (isWindowModified()) {
        int r = QMessageBox::warning(this, tr("Save changes"),
                                     tr("You have some changes.\n"
                                        "Do you want to save it?"),
                                     QMessageBox::Save | QMessageBox::Discard
                                     | QMessageBox::Cancel);
        if (r == QMessageBox::Save)
            return on_actionSave_triggered();

        else if (r == QMessageBox::Cancel)
            return false;
    }
    return true;
}
コード例 #10
0
ファイル: mainwindow.cpp プロジェクト: thesmartwon/OpenChess
bool MainWindow::askToSave()
{
	if (isWindowModified())
	{
		QMessageBox::StandardButton result;
		result = QMessageBox::warning(this, QApplication::applicationName(),
			tr("The game was modified.\nDo you want to save your changes?"),
				QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);

		if (result == QMessageBox::Save)
			return save();
		else if (result == QMessageBox::Cancel)
			return false;
	}
	return true;
}
コード例 #11
0
ファイル: mainwindow.cpp プロジェクト: SunskyF/mips_ide
void MainWindow::closeEvent(QCloseEvent *event)
{
    if (isWindowModified()) {
        bool exit = QMessageBox::question(this,
                                      tr("Quit"),
                                      tr("Are you sure to quit this application?"),
                                      QMessageBox::Yes | QMessageBox::No,
                                      QMessageBox::No) == QMessageBox::Yes;
        if (exit) {
            event->accept();
        } else {
            event->ignore();
        }
    } else {
        event->accept();
    }
}
コード例 #12
0
bool SdiWindow::isSafeToClose()
{
    if (isWindowModified())
    {
        switch (QMessageBox::warning(this, tr("SDI"),
                    tr("The document has unsaved changes.\nDo you want to save it before it is closed?"),
                    QMessageBox::Discard | QMessageBox::Cancel))
        {
            case QMessageBox::Cancel:
                return false;
            default:
                return true;
        }
    }

    return true;
}
コード例 #13
0
bool MainWindow::okToContinue()
{
    if (isWindowModified()) {
        int r = QMessageBox::warning(this, tr("slowmoUI"),
                        tr("The document has been modified.\n"
                           "Do you want to save your changes?"),
                        QMessageBox::Yes | QMessageBox::No
                        | QMessageBox::Cancel);
        if (r == QMessageBox::Yes) {
            slotSaveProjectDialog();
            return true;
        } else if (r == QMessageBox::Cancel) {
            return false;
        }
    }
    return true;
}
コード例 #14
0
ファイル: titlebar.cpp プロジェクト: QiumingLu/Qt
void TitleBar::setWindowTitle(const QString &title)
{
    if (title.contains("[*]"))
    {
        QString content = title.left(title.length() - 3);
        if (isWindowModified())
        {
            content.append("*");
            label->setText(content);
        } else {
            label->setText(content);
        }
    } else {
        label->setText(title);
    }
    QWidget::setWindowTitle(title);
}
コード例 #15
0
bool HtmlEditor::maybeSave()
{
    if (!isWindowModified())
        return true;

    QMessageBox::StandardButton ret;
    ret = QMessageBox::warning(this, tr("HTML Editor"),
                               tr("The document has been modified.\n"
                                  "Do you want to save your changes?"),
                               QMessageBox::Save | QMessageBox::Discard
                               | QMessageBox::Cancel);
    if (ret == QMessageBox::Save)
        return fileSave();
    else if (ret == QMessageBox::Cancel)
        return false;
    return true;
}
コード例 #16
0
void MainWindow::New()
{


    if(isWindowModified())
    {
        int s=QMessageBox::warning(this,tr("::NotePad::"),tr("::Document has been modified::""\nDo you wanna save your changes?"),
                                   QMessageBox::Cancel|QMessageBox::No|QMessageBox::Cancel);

        if(s==QMessageBox::Yes)
             MainWindow::Save();
        else if(QMessageBox::No)
          textedit->clear();

    }


}
コード例 #17
0
/** query user to save file if modified
 */
bool spqrMainWindow::checkSave() {
    if (isWindowModified()) {
        QMessageBox box(this);
        box.setIcon(box.Warning);
        box.setInformativeText(tr("'file '%1' has been modified!").arg(source()->path()));
        box.setText(tr("Do you want to save your changes?"));
        box.setStandardButtons(box.Save|box.Discard|box.Cancel);
        box.setDefaultButton(box.Save);
        switch (box.exec()) {
        case box.Save:
            saveFile();
            break;
        case box.Cancel:
            return false;
        }
    }
    return true;
}
コード例 #18
0
ファイル: mainwindow.cpp プロジェクト: thunder422/ibcp
// function that checks if it is ok to continue when the current program
// has been modified; return false if the user cancels the request to save
// the modified program
bool MainWindow::isOkToContinue(void)
{
	if (isWindowModified())
	{
		int answer = QMessageBox::warning(this, tr("IBCP"), tr("The program "
			"has been modified.\nDo you want to save the changes?"),
			QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
		if (answer == QMessageBox::Yes)
		{
			return on_actionSave_triggered();
		}
		else if (answer == QMessageBox::Cancel)
		{
			return false;
		}
	}
	return true;
}
コード例 #19
0
ファイル: chanEditorWidget.cpp プロジェクト: ChanJLee/ChanIDE
bool chanEditorWidget::okToContinue(){

	if (isWindowModified()){
		int result = QMessageBox::warning(this, tr("chan Editer"),
			tr("the document has been modified.\n"
			"Do you want to save your changes?"),
			QMessageBox::Yes | QMessageBox::No |
			QMessageBox::Cancel);

		if (result == QMessageBox::Yes)
			return save();

		else if (result == QMessageBox::Cancel)
			return false;
	}

	return true;
}
コード例 #20
0
ファイル: mainwindow.cpp プロジェクト: pbena/dealii
bool MainWindow::maybe_save()
{
    if (isWindowModified())							// if content was modified
    {
        QMessageBox::StandardButton ret;					// ask, if content should be saved
        ret = QMessageBox::warning(this, tr("parameterGUI"),
                                   tr("The content has been modified.\n"
                                      "Do you want to save your changes?"),
                                   QMessageBox::Save | QMessageBox::Discard |QMessageBox::Cancel);

        if (ret == QMessageBox::Save)
            return save();
        else if (ret == QMessageBox::Cancel)
            return false;
    };

    return true;
}
コード例 #21
0
void ItemEditor::closeEvent( QCloseEvent *event )
{
    if( isWindowModified() ) {
        switch( QMessageBox::question( this, tr( "Modified" ), tr( "Changes were made to this item, do you wish to save?" ), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save ) ) {
        case QMessageBox::Save:
            emit savedItem( m_tibiaItem, m_itemData );
            break;
        case QMessageBox::Discard:
            event->accept();
            return;
        case QMessageBox::Cancel:
            event->ignore();
            return;
        default: break;
        }
    }

    event->accept();
}
コード例 #22
0
ファイル: uxt_editor.cpp プロジェクト: sythaeryn/pndrpg
void UXTEditor::closeEvent( QCloseEvent *e )
{
	if( isWindowModified() )
	{
		int reply = QMessageBox::question( this,
										tr( "Table changed" ),
										tr( "The table has changed. Would you like to save your changes?" ),
										QMessageBox::Yes,
										QMessageBox::No
										);

		if( reply == QMessageBox::Yes )
			save();

	}

	e->accept();
	close();
}
コード例 #23
0
ファイル: mainwindow.cpp プロジェクト: kernelhcy/hcyprojects
bool MainWindow::okToContinue()
{
	if (isWindowModified()) 
	{
		int r = QMessageBox::warning( this , tr("Spreadsheet")
                        , tr("The file has been modified。""Do you want to save it?"),
						QMessageBox::Yes | QMessageBox::Default,
						QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape);
		if (r == QMessageBox::Yes) 
		{
			return save();
		} 
		else if (r == QMessageBox::Cancel) 
		{
			return false ;
		}
	}
	return true ;
}
コード例 #24
0
ファイル: voxeditor.cpp プロジェクト: Dakror/voxie
void VoxelEditor::closeEvent(QCloseEvent *event)
{
    if (!isWindowModified()) {
        event->accept();
        return;
    }
    QMessageBox * msg = new QMessageBox(this);
    msg->setText("Do you want to save your changes?");
    msg->setStandardButtons(
        QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
    msg->setDefaultButton(QMessageBox::Save);
    int ret = msg->exec();
    if (ret == QMessageBox::Save) {
        save();
        event->accept();
    } else if (ret == QMessageBox::Discard) {
        event->accept();
    } else
        event->ignore();
}
コード例 #25
0
ファイル: confeditor.cpp プロジェクト: Geekking/lima
bool AnnoqtConfEditor::maybeSave()
{
  if ( isWindowModified() )
  {
    int ret = QMessageBox::warning( this, tr( "Application" ),
                                    tr( "The configuration has been modified.\n"
                                        "Do you want to save your changes?" ),
                                    QMessageBox::Yes | QMessageBox::Default,
                                    QMessageBox::No,
                                    QMessageBox::Cancel | QMessageBox::Escape );

    if ( ret == QMessageBox::Yes )
      return slotSave();
    else
      if ( ret == QMessageBox::Cancel )
        return false;
  }

  return true;
}
コード例 #26
0
bool EditorFrame::maybeSave()
{
  if(isWindowModified()){
    QString applicationName = QCoreApplication::applicationName();
    QMessageBox::StandardButton ret;
    ret = QMessageBox::warning(this, applicationName,
      tr("Do you want to save your changes?"),
      QMessageBox::Save | QMessageBox::No | QMessageBox::Cancel);
    if (ret == QMessageBox::Save){
      return saveIdk(); // TODO might need to call exportIdf
    }
    else if (ret == QMessageBox::No){
      return true;
    }
    else if (ret == QMessageBox::Cancel){
      return false;
    }
  }
  return true;
}
コード例 #27
0
ファイル: mainwindow.cpp プロジェクト: frozenix/qspreadsheet
bool MainWindow::okToContinue()
{
    if(isWindowModified()) {
        QMessageBox msg;
        msg.setWindowTitle(tr("QSpreadsheet"));
        msg.setIcon(QMessageBox::Warning);
        msg.setText(tr("The document was modified."));
        msg.setInformativeText(tr("Do you want to save your changes?"));
        msg.setStandardButtons(QMessageBox::Cancel | QMessageBox::No |
                               QMessageBox::Yes);
        msg.setDefaultButton(QMessageBox::Yes);

        int responde = msg.exec();
        if(responde == QMessageBox::Yes) {
            save();
        } else if(responde == QMessageBox::Cancel) {
            return false;
        }
    }
    return true;
}
コード例 #28
0
ファイル: ImageDisplay.cpp プロジェクト: bpoje/dct
bool ImageDisplay::okToContinue()
{
	if (isWindowModified())
	{
		int r = QMessageBox::warning(this, tr("MDI Editor"),
		                             tr("File %1 has been modified.\n"
		                                "Do you want to save your changes?")
		                             .arg(strippedName(curFile)),
		                             QMessageBox::Yes | QMessageBox::Default,
		                             QMessageBox::No,
		                             QMessageBox::Cancel | QMessageBox::Escape);
		if (r == QMessageBox::Yes)
		{
			return save();
		}
		else if (r == QMessageBox::Cancel)
		{
			return false;
		}
	}
	return true;
}
コード例 #29
0
void MainWindow::closeEvent(QCloseEvent *ev)
{
   BEGIN;

   if (isWindowModified() == true) {
      raise();

      QMessageBox box(tr("Save Changes?"),
                tr("Do you want to save the changes you made before closing?"),
                QMessageBox::Question,
                QMessageBox::Yes    | QMessageBox::Default,
                QMessageBox::No,
                QMessageBox::Cancel | QMessageBox::Escape,
                this, Qt::Sheet);
       box.setButtonText(QMessageBox::Yes,tr("Save"));
       box.setButtonText(QMessageBox::No, tr("Don't Save"));

       switch (box.exec()) {
         case QMessageBox::Yes: {
            saveChanges();
            setWindowModified(false);// Not really necessary, but stops problems if we get close again.
            //getWorkbench()->remWindow(this);
            ev->accept();
            break;
         }
         case QMessageBox::No: {
            setWindowModified(false);// Not really necessary, but stops problems if we get close again.
            //getWorkbench()->remWindow(this);
            ev->accept();
            break;
         }
         default: {
            ev->ignore();
            break;
         }
      }
   }
}
コード例 #30
0
void MainWindow::openFile(const QString &fileName)
{
    MainWindow *existing = findMainWindow(fileName);
    if (existing) {
        existing->show();
        existing->raise();
        existing->activateWindow();
        return;
    }

    if (isUntitled && textEdit->document()->isEmpty() && !isWindowModified()) {
        loadFile(fileName);
        return;
    }

    MainWindow *other = new MainWindow(fileName);
    if (other->isUntitled) {
        delete other;
        return;
    }
    other->tile(this);
    other->show();
}