bool QMessageBox::qt_property( int id, int f, QVariant* v)
{
    switch ( id - staticMetaObject()->propertyOffset() ) {
    case 0: switch( f ) {
	case 0: setText(v->asString()); break;
	case 1: *v = QVariant( this->text() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 1: switch( f ) {
	case 0: setIcon((Icon&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->icon() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 2: switch( f ) {
	case 0: setIconPixmap(v->asPixmap()); break;
	case 1: if ( this->iconPixmap() ) *v = QVariant( *iconPixmap() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 3: switch( f ) {
	case 0: setTextFormat((TextFormat&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->textFormat() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    default:
	return QDialog::qt_property( id, f, v );
    }
    return TRUE;
}
int QMessageBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: buttonClicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break;
        case 1: d_func()->_q_buttonClicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< Icon*>(_v) = icon(); break;
        case 2: *reinterpret_cast< QPixmap*>(_v) = iconPixmap(); break;
        case 3: *reinterpret_cast< Qt::TextFormat*>(_v) = textFormat(); break;
        case 4: *reinterpret_cast<int*>(_v) = QFlag(standardButtons()); break;
        case 5: *reinterpret_cast< QString*>(_v) = detailedText(); break;
        case 6: *reinterpret_cast< QString*>(_v) = informativeText(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setIcon(*reinterpret_cast< Icon*>(_v)); break;
        case 2: setIconPixmap(*reinterpret_cast< QPixmap*>(_v)); break;
        case 3: setTextFormat(*reinterpret_cast< Qt::TextFormat*>(_v)); break;
        case 4: setStandardButtons(QFlag(*reinterpret_cast<int*>(_v))); break;
        case 5: setDetailedText(*reinterpret_cast< QString*>(_v)); break;
        case 6: setInformativeText(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
示例#3
0
void MessageBox::setStatus(bool status)
{
	if (status)
	{
		setText("<b>WCS Exported Successfully!</b>");
		icon->load(":/gui/images/good.png");
	}
	else
	{
		setText("Something went wrong.  Check that:<p><ul><li>The image is in the same directory as when imported</li><li>The image is not locked</li><li>The image has not been deleted</li><li>The astronomical object hasn't disappeared into the nether regions of the multiverse.</li></p>");
		icon->load(":/gui/images/bad.png");
	}
	setIconPixmap(*icon);
}
示例#4
0
FSSM_WaitMsgBox::FSSM_WaitMsgBox(QWidget *parent, const QString text, const QString title) 
				: QMessageBox(QMessageBox::NoIcon, title, text + "   ", QMessageBox::NoButton, parent)
{
	_allow_close = false;
	_parent = parent;
	// Set buttons (Constructor parameter seems to be ignored. Qt-bug ???)
	setStandardButtons( QMessageBox::NoButton );
	// Set font
	QFont newfont = font();
	newfont.setPixelSize(13); // 10pts
	newfont.setBold( true );
	setFont( newfont );
	// Set icon:
	setIconPixmap( QPixmap( QString::fromUtf8(":/icons/oxygen/22x22/view-history.png") ) );
}
示例#5
0
FileWindow::FileWindow(std::string path) : Motif::Window("fileWindow")
{
  ini.reset(new OpenCDE::Ini(OpenCDE::Environment::getHome() + "/.opencde/dtfile/filetypes.ini"));
  setTitle("File Manager - /some/path");
  setIconName("path");
  setIconPixmap(OpenCDE::Environment::getPrefix() + "/share/opencde/pixmaps/Fphome.l.pm");
  setWidth(450);
  setHeight(350);
  setCloseFunction(FUNCTION(FileWindow::onClose));

  menuBar.reset(new Motif::MenuBar("menuBar", getContentPanel()));
  menuBar->setLeftAttachment(Motif::Attachment::FORM);
  menuBar->setRightAttachment(Motif::Attachment::FORM);
  menuBar->setTopAttachment(Motif::Attachment::FORM);
  filePulldownMenu.reset(new Motif::PulldownMenu("filePulldownMenu", menuBar.get()));
  filePulldownMenu->setText("File");
  newFolderButton.reset(new Motif::Button("newFolderButton", filePulldownMenu.get()));
  newFolderButton->setText("New Folder");
  newFileButton.reset(new Motif::Button("newFileButton", filePulldownMenu.get()));
  newFileButton->setText("New File");
  separators.add(new Motif::Separator("separator", filePulldownMenu.get()));
  instanceButton.reset(new Motif::Button("instanceButton", filePulldownMenu.get()));
  instanceButton->setText("New Window");
  instanceButton->setAccelerator("Ctrl<Key>w");
  instanceButton->setAcceleratorText("Ctrl+W");
  instanceButton->setActivateFunction(FUNCTION(FileWindow::onInstanceButtonClicked));
  terminalButton.reset(new Motif::Button("terminalButton", filePulldownMenu.get()));
  terminalButton->setText("Open Terminal");
  terminalButton->setAccelerator("Ctrl<Key>t");
  terminalButton->setAcceleratorText("Ctrl+T");
  terminalButton->setActivateFunction(FUNCTION(FileWindow::onTerminalButtonClicked));
  separators.add(new Motif::Separator("separator", filePulldownMenu.get()));
  closeButton.reset(new Motif::Button("closeButton", filePulldownMenu.get()));
  closeButton->setText("Close");
  closeButton->setActivateFunction(FUNCTION(FileWindow::onClose));
  //closeButton->setAccelerator("Alt<Key>f4");
  closeButton->setAcceleratorText("Alt+F4");
  //closeButton->setSensitive(false);
  selectedPulldownMenu.reset(new Motif::PulldownMenu("editPulldownMenu", menuBar.get()));
  selectedPulldownMenu->setText("Selected");
  viewPulldownMenu.reset(new Motif::PulldownMenu("optionsPulldownMenu", menuBar.get()));
  viewPulldownMenu->setText("View");
  helpPulldownMenu.reset(new Motif::PulldownMenu("helpPulldownMenu", menuBar.get()));
  helpPulldownMenu->setText("Help");
  menuBar->setHelpMenu(helpPulldownMenu.get());
  helpButton.reset(new Motif::Button("helpButton", helpPulldownMenu.get()));
  helpButton->setText("File Manager Help");
  //helpButton->setActivateFunction(FUNCTION(FileWindow::onClose));
  separators.add(new Motif::Separator("separator", helpPulldownMenu.get()));
  aboutButton.reset(new Motif::Button("aboutButton", helpPulldownMenu.get()));
  aboutButton->setText("About File Manager");
  //aboutButton->setActivateFunction(FUNCTION(FileWindow::onClose));

  statusPanel.reset(new Motif::Panel("statusPanel", getContentPanel()));
  statusPanel->setLeftAttachment(Motif::Attachment::FORM);
  statusPanel->setRightAttachment(Motif::Attachment::FORM);
  statusPanel->setBottomAttachment(Motif::Attachment::FORM);
  statusPanel->setHeight(25);
  statusPanel->setShadowThickness(1);

  mainPanel.reset(new Motif::Panel("mainPanel", getContentPanel()));
  mainPanel->setLeftAttachment(Motif::Attachment::FORM);
  mainPanel->setRightAttachment(Motif::Attachment::FORM);
  mainPanel->setTopAttachment(Motif::Attachment::WIDGET);
  mainPanel->setBottomAttachment(Motif::Attachment::WIDGET);
  mainPanel->setLeftOffset(0);
  mainPanel->setRightOffset(0);
  mainPanel->setTopWidget(menuBar.get());
  mainPanel->setBottomWidget(statusPanel.get());
  mainPanel->setShadowThickness(1);

  filePanel.reset(new Motif::Panel("filePanel", mainPanel.get()));
  filePanel->setLeftAttachment(Motif::Attachment::FORM);
  filePanel->setLeftOffset(5);
  filePanel->setRightAttachment(Motif::Attachment::FORM);
  filePanel->setRightOffset(25);
  filePanel->setTopAttachment(Motif::Attachment::FORM);
  filePanel->setTopOffset(5);
  filePanel->setBottomAttachment(Motif::Attachment::FORM);
  filePanel->setBottomOffset(5);
  filePanel->setShadowThickness(2);
  filePanel->setShadowType(Motif::ShadowType::IN);

  statusLabel.reset(new Motif::Label("statusLabel", statusPanel.get()));
  statusLabel->setTopAttachment(Motif::Attachment::FORM);
  statusLabel->setTopOffset(1);
  statusLabel->setBottomAttachment(Motif::Attachment::FORM);
  statusLabel->setBottomOffset(1);
  statusLabel->setLeftAttachment(Motif::Attachment::FORM);
  statusLabel->setLeftOffset(1);
  statusLabel->setText("99 Items 99 Hidden");

  fileScroll.reset(new Motif::ScrollBar("fileScroll", mainPanel.get()));
  fileScroll->setTopAttachment(Motif::Attachment::FORM);
  fileScroll->setTopOffset(5);
  fileScroll->setBottomAttachment(Motif::Attachment::FORM);
  fileScroll->setBottomOffset(5);
  fileScroll->setRightAttachment(Motif::Attachment::FORM);
  fileScroll->setRightOffset(5);
  fileScroll->setLeftAttachment(Motif::Attachment::NONE);
  fileScroll->setWidth(18);
  fileScroll->setMaximum(15);
  fileScroll->setDragFunction(FUNCTION(FileWindow::onScroll));
  fileScroll->setValueChangedFunction(FUNCTION(FileWindow::onScroll));

  fileView.reset(new FileView("fileView", filePanel.get(), fileScroll.get(), ini.get(), this));
  fileView->setTopAttachment(Motif::Attachment::FORM);
  fileView->setBottomAttachment(Motif::Attachment::FORM);
  fileView->setLeftAttachment(Motif::Attachment::FORM);
  fileView->setRightAttachment(Motif::Attachment::FORM);
  fileView->setTopOffset(2);
  fileView->setBottomOffset(2);
  fileView->setLeftOffset(2);
  fileView->setRightOffset(2);
  fileView->setPath(path);

  setVisible(true);
}
示例#6
0
AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
    :
    QMessageBox(parent),
    m_settings(settings),
    m_disque(NULL),
    m_disqueTimer(NULL),
    m_rotateNext(false),
    m_disqueDelay(_I64_MAX)
{
    const QString versionStr = QString().sprintf
                               (
                                   "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
                                   lamexp_version_major(),
                                   lamexp_version_minor(),
                                   lamexp_version_release(),
                                   lamexp_version_build(),
                                   lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(),
                                   lamexp_version_compiler(),
                                   lamexp_version_arch(),
                                   qVersion()
                               );
    const QString copyrightStr = QString().sprintf
                                 (
                                     "Copyright (C) 2004-%04d LoRd_MuldeR &lt;[email protected]&gt;. Some rights reserved.",
                                     qMax(lamexp_version_date().year(), QDate::currentDate().year())
                                 );

    for(int i = 0; i < 4; i++)
    {
        m_cartoon[i] = NULL;
    }

    QString aboutText;

    aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
    aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
    aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
    aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));

    if(LAMEXP_DEBUG)
    {
        int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0);
        aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 &middot; Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
    }
    else if(lamexp_version_demo())
    {
        int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0);
        aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
    }

    aboutText += "<hr><br>";
    aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
    aboutText += "modify it under the terms of the GNU General Public License<br>";
    aboutText += "as published by the Free Software Foundation; either version 2<br>";
    aboutText += "of the License, or (at your option) any later version.<br><br>";
    aboutText += "This program is distributed in the hope that it will be useful,<br>";
    aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
    aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>";
    aboutText += "GNU General Public License for more details.<br><br>";
    aboutText += "You should have received a copy of the GNU General Public License<br>";
    aboutText += "along with this program; if not, write to the Free Software<br>";
    aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110&minus;1301, USA.</tt></nobr><br>";
    aboutText += "<hr><table><tr>";
    aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
    aboutText += QString("<td><font color=\"darkred\">%1</font></td>").arg(tr("Note: LameXP is free software. Do <b>not</b> pay money to obtain or use LameXP! If some third-party website tries to make you pay for downloading LameXP, you should <b>not</b> respond to the offer !!!"));
    aboutText += "</tr></table><hr><br>";
    aboutText += QString("%1<br>").arg(NOBR(tr("Special thanks go out to \"John33\" from %1 for his continuous support.")).arg(LINK("http://www.rarewares.org/")));

    setText(aboutText);
    setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
    setWindowTitle(tr("About LameXP"));

    if(firstStart)
    {
        QPushButton *firstButton = addButton(tr("Show License Text"), QMessageBox::AcceptRole);
        firstButton->setIcon(QIcon(":/icons/script.png"));
        firstButton->setIconSize(QSize(16, 16));
        firstButton->setMinimumWidth(135);
        firstButton->disconnect();
        connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));

        QPushButton *secondButton = addButton(tr("Accept License"), QMessageBox::AcceptRole);
        secondButton->setIcon(QIcon(":/icons/accept.png"));
        secondButton->setIconSize(QSize(16, 16));
        secondButton->setMinimumWidth(120);

        QPushButton *thirdButton = addButton(tr("Decline License"), QMessageBox::AcceptRole);
        thirdButton->setIcon(QIcon(":/icons/delete.png"));
        thirdButton->setIconSize(QSize(16, 16));
        thirdButton->setMinimumWidth(120);
        thirdButton->setEnabled(false);
    }
    else
    {
        QPushButton *firstButton = addButton(tr("3rd Party S/W"), QMessageBox::AcceptRole);
        firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
        firstButton->setIconSize(QSize(16, 16));
        firstButton->setMinimumWidth(120);
        firstButton->disconnect();
        connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));

        QPushButton *secondButton = addButton(tr("Contributors"), QMessageBox::AcceptRole);
        secondButton->setIcon(QIcon(":icons/user_suit.png"));
        secondButton->setIconSize(QSize(16, 16));
        secondButton->setMinimumWidth(120);
        secondButton->disconnect();
        connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));

        QPushButton *thirdButton = addButton(tr("About Qt4"), QMessageBox::AcceptRole);
        thirdButton->setIcon(QIcon(":/images/Qt.svg"));
        thirdButton->setIconSize(QSize(16, 16));
        thirdButton->setMinimumWidth(120);
        thirdButton->disconnect();
        connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));

        QPushButton *fourthButton = addButton(tr("Discard"), QMessageBox::AcceptRole);
        fourthButton->setIcon(QIcon(":/icons/cross.png"));
        fourthButton->setIconSize(QSize(16, 16));
        fourthButton->setMinimumWidth(90);

        QPixmap disque(":/images/Disque.png");
        QRect screenGeometry = QApplication::desktop()->availableGeometry();
        m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
        m_disque->installEventFilter(this);
        m_disque->setStyleSheet("background:transparent;");
        m_disque->setAttribute(Qt::WA_TranslucentBackground);
        m_disque->setGeometry(qrand() % (screenGeometry.width() - disque.width()), qrand() % (screenGeometry.height() - disque.height()), disque.width(), disque.height());
        m_disque->setPixmap(disque);
        m_disque->setWindowOpacity(0.01);
        m_disque->show();
        m_disqueFlags[0] = (qrand() > (RAND_MAX/2));
        m_disqueFlags[1] = (qrand() > (RAND_MAX/2));
        m_disqueTimer = new QTimer;
        connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
        m_disqueTimer->setInterval(10);
        m_disqueTimer->start();
    }

    m_firstShow = firstStart;
}