HeadbandWidget::HeadbandWidget(QWidget *parent):QWidget(parent)
{
    setPalette(QPalette(Qt::cyan));
    setAutoFillBackground(true);

    bL = new QHBoxLayout();

    QWidget* w = new QWidget(this);
    w->setAttribute(Qt::WA_TransparentForMouseEvents);
    w->setPalette(QPalette(Qt::red));
    w->setAutoFillBackground(true);
    w->setFixedWidth(500);

    QWidget* w1 = new QWidget(this);
    w1->setAttribute(Qt::WA_TransparentForMouseEvents);
    w1->setPalette(QPalette(Qt::green));
    w1->setAutoFillBackground(true);
    w1->setFixedWidth(300);

    //Ajout des widget au layout
    bL->addWidget(w);
    bL->addWidget(w1);

    this->setLayout(bL);
}
Example #2
0
void SmsDialog::initUI()
{
  setCaption( i18n( "SMS text" ) );
  setButtons( Ok | Cancel );
  setDefaultButton( Ok );
  showButtonSeparator( true );

  QWidget *page = new QWidget( this );
  setMainWidget( page );
  page->setFixedWidth( 300 );

  QVBoxLayout *topLayout = new QVBoxLayout( page );
  topLayout->setSpacing( spacingHint() );
  topLayout->setMargin( 0 );


  QLabel *label = new QLabel( i18n( "Please insert SMS text for an SMS to the following number: %1", mNumber ), page );
  topLayout->addWidget( label );
  label->setWordWrap( true );

  mSmsTextEdit = new KTextEdit( page );
  mSmsTextEdit->setAcceptRichText( false );
  label->setBuddy( mSmsTextEdit );
  topLayout->addWidget( mSmsTextEdit );

  connect( mSmsTextEdit, SIGNAL(textChanged()), SLOT(updateCounter()) );

  mLengthLabel = new QLabel( QLatin1String( "-" ) , page );
  topLayout->addWidget( mLengthLabel );

  mSmsTextEdit->setFocus();
  updateCounter();
}
Example #3
0
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);

	statusBar()->showMessage("Ready.");

	QWidget* spacer = new QWidget;
	spacer->setFixedWidth(40);
	attachBtn = new QToolButton;
	openFileBtn = new QToolButton;
	playBtn = new QToolButton;
	pauseBtn = new QToolButton;
	stopBtn = new QToolButton;
	
	//Disable some
	playBtn->setDisabled(true);
	pauseBtn->setDisabled(true);
	stopBtn->setDisabled(true);

	attachBtn->setIcon(QIcon(":/Icons/bug.png"));
	openFileBtn->setIcon(QIcon(":/Icons/folder_explore.png"));
	playBtn->setIcon(QIcon(":/Icons/control_play_blue.png"));
	pauseBtn->setIcon(QIcon(":/Icons/control_pause_blue.png"));
	stopBtn->setIcon(QIcon(":/Icons/control_stop_blue.png"));

	//Events
	connect(attachBtn, SIGNAL(clicked()), this, SLOT(Trigger_AttachToProcess()));
	connect(playBtn, SIGNAL(clicked()), this, SLOT(Trigger_PlayBtn()));
	connect(stopBtn, SIGNAL(clicked()), this, SLOT(Trigger_StopBtn()));
	connect(pauseBtn, SIGNAL(clicked()), this, SLOT(Trigger_PauseBtn()));
	//Add
	ui.toolBar->addWidget(attachBtn);
	ui.toolBar->addSeparator();
	ui.toolBar->addWidget(openFileBtn);
	ui.toolBar->addSeparator();
	ui.toolBar->addWidget(playBtn);
	ui.toolBar->addSeparator();
	ui.toolBar->addWidget(pauseBtn);
	ui.toolBar->addSeparator();
	ui.toolBar->addWidget(stopBtn);

	//Initialize event handlers
	connect(ui.actionAttach_to_Process, SIGNAL(triggered()), this, SLOT(Trigger_AttachToProcess()));

	//Debug
	AllocConsole();
	freopen("CONOUT$", "w", stdout);

	Vox::Dbg::Init();

	//Make sure we actually do this
	bool bFirstRun = false;
	if (bFirstRun)
	{
		QMessageBox::information(NULL, "First Run", "This appears to be your first run. Please open a file"
			" or attach VoxDbg to a process.");
	}
}
Example #4
0
void SettingsBottomView::resizeEvent(QResizeEvent* event) {
  int pages = stack->count();

  for (int p = 0; p < pages; ++p) {
    QScrollArea* scrollArea = qobject_cast<QScrollArea*>(stack->widget(p));
    QWidget* page = scrollArea->widget();
    page->setFixedWidth(scrollArea->width());
  }
}
Example #5
0
// Function to create Vertical Toolbar
void GUI::createVtoolbar()
{
	vtoolbar = new QToolBar;
	vtoolbar->setFixedWidth(60);
	vtoolbar->setOrientation(Qt::Vertical);

	QWidget *dummy = new QWidget(vtoolbar);
	dummy->setFixedHeight(30);
	dummy->setFixedWidth(60);
	vtoolbar->addWidget(dummy);

	open = new QToolButton(vtoolbar);
	open->setStatusTip("Open Volume Files");
	open->setFixedHeight(50);
	open->setFixedWidth(50);
	open->setCheckable(true);
	open->setIcon(QIcon(":/ICONS/open3.png"));
	vtoolbar->addWidget(open);

	save = new QToolButton(vtoolbar);
	save->setStatusTip("Save Slices");
	save->setFixedHeight(50);
	save->setFixedWidth(50);
	save->setCheckable(true);
	save->setIcon(QIcon(":/ICONS/save.png"));
	vtoolbar->addWidget(save);

	showiso = new QToolButton(vtoolbar);
	showiso->setStatusTip("Toggle Visibility of ISOsurface");
	showiso->setFixedHeight(50);
	showiso->setFixedWidth(50);
	showiso->setCheckable(true);
	showiso->setIcon(QIcon(":/ICONS/iso.png"));
	vtoolbar->addWidget(showiso);

	pathview = new QToolButton(vtoolbar);
	pathview->setStatusTip("Define or Show Slices on an Arbitrary Axis");
	pathview->setFixedHeight(50);
	pathview->setFixedWidth(50);
	pathview->setCheckable(true);
	pathview->setIcon(QIcon(":/ICONS/path.png"));
	vtoolbar->addWidget(pathview);

	Exittool = new QToolButton(vtoolbar);
	Exittool->setStatusTip("Exit Application");
	Exittool->setFixedHeight(50);
	Exittool->setFixedWidth(50);
	Exittool->setIcon(QIcon(":/ICONS/exit.png"));
	vtoolbar->addWidget(Exittool);
	connect(Exittool,SIGNAL(clicked()),qApp,SLOT(quit()));

	QPalette pal;
	pal.setColor(QPalette::Background, QColor("Gray"));
	vtoolbar->setAutoFillBackground(true);
	vtoolbar->setPalette(pal);
	mainLayout->addWidget(vtoolbar);
}
//************************************************************************************************
//*************************************** class ZSearch ******************************************
//************************************************************************************************
ZSearch::ZSearch(const QString &curPath, const QString &originName)
  :MyBaseDlg()
{
  QString ProgDir =  QString ( qApp->argv() [0] );
  int i = ProgDir.findRev ( "/" );
  ProgDir.remove ( i+1, ProgDir.length() - i );

  ZConfig readlang("/ezxlocal/download/appwrite/setup/ezx_system.cfg", true);
  Idioma = ProgDir + "/languages/" + readlang.readEntry(QString("SYS_SYSTEM_SET"), QString("LanguageType"), "en-us");
  if ( ! QFileInfo(Idioma).isFile() ) Idioma = ProgDir + "/languages/en-us";
  ZConfig lang (Idioma,false); 

  this->setMainWidgetTitle("zTextViewer");
  
  QWidget *myWidget = new ZWidget ( this, NULL, 0);
  QVBoxLayout *myVBoxLayout = new QVBoxLayout ( myWidget, 0 );
  myWidget->setFixedWidth(240);
  ZAppInfoArea* pAIA = new ZAppInfoArea(myWidget, NULL, 0);
  pAIA->setActArea(ZAppInfoArea::no_progress_meter);
  pAIA->appendText(ZAppInfoArea::activity, lang.readEntry(QString("TEXTVIEWER"), "IDS_SAVE", ""), "name");
  setAppInfoArea(pAIA);
  myVBoxLayout->addWidget ( pAIA, 1, 1 );

    ZFormContainer* fc = new ZFormContainer(this);
    setContentWidget(fc);

    lineEdit = new ZLineEdit(this, NULL);
    lineEdit->setTitle(lang.readEntry(QString("TEXTVIEWER"), "IDS_ENTER_FILE_NAME", ""));
    lineEdit->setTitlePosition(ZLineEdit::TitleTop);
    lineEdit->setMaxLength(50);
	lineEdit->setText(originName);
    fc->addChild(lineEdit);

 	buttonDir = new myButton(this, "ZPressButton");
	buttonDir->setTitle(lang.readEntry(QString("TEXTVIEWER"), "IDS_LOCATION", ""));
	QString direc = curPath;
	if ( direc == "" ) direc = "/mmc/mmca1";
	if ( direc[direc.length()-1] == QChar('/') ) 
	  {	direc.remove( direc.length()-1, 1 ); }
    buttonDir->setText(direc); 
	FStext=direc;
	buttonDir->setPixmap(QPixmap(ProgDir+"/img/folder.png"));
    fc->addChild(buttonDir);
	

  ZSoftKey *softKey = new ZSoftKey ( "CST_2A", this, this );
  softKey->setText ( ZSoftKey::RIGHT, lang.readEntry(QString("TEXTVIEWER"), "IDS_CANCEL", ""), ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setText ( ZSoftKey::LEFT, lang.readEntry(QString("TEXTVIEWER"), "IDS_SAVE", ""), ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setClickedSlot ( ZSoftKey::RIGHT, this, SLOT ( slot_cancel() ) );
  softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( slot_search() ) );


  this->setCSTWidget( softKey );

}
Example #7
0
MainWindow::MainWindow()
{
    setUnifiedTitleAndToolBarOnMac( true );

    QStatusBar* status = new QStatusBar( this );
    PlaybackControlsWidget* pcw = new PlaybackControlsWidget( status );

    //FIXME: this code is duplicated in the audioscrobbler app too
    //In order to compensate for the sizer grip on the bottom right
    //of the window, an empty QWidget is added as a spacer.
    QSizeGrip* sg = status->findChild<QSizeGrip *>();
    if( sg ) {
        int gripWidth = sg->sizeHint().width();
        QWidget* w = new QWidget( status );
        w->setFixedWidth( gripWidth );
        status->addWidget( w );
    }

    //Seemingly the only way to get a central widget in a QStatusBar
    //is to add an empty widget either side with a stretch value.
    status->addWidget( new QWidget( status), 1 );
    status->addWidget( pcw );
    status->addWidget( new QWidget( status), 1 );

    setStatusBar( status );

    MainWidget* mw;

    QWidget* w = new QWidget();
    
    new QVBoxLayout( w );
    w->layout()->addWidget(mw = new MainWidget());

    m_messageBar = new MessageBar( this );

    connect(mw, SIGNAL(startRadio(RadioStation)), SIGNAL(startRadio(RadioStation)));

    AuthenticatedUser user;
    connect(user.getFriends(), SIGNAL(finished()), mw, SLOT(onUserGotFriends()));
    connect(user.getTopTags(), SIGNAL(finished()), mw, SLOT(onUserGotTopTags()));
    connect(user.getPlaylists(), SIGNAL(finished()), mw, SLOT(onUserGotPlaylists()));
    connect(user.getRecentStations(), SIGNAL(finished()), mw, SLOT(onUserGotRecentStations()));

    setCentralWidget( w );

    finishUi();

    //todo: bury this:
    menuBar()->addMenu("Normania")->addAction( tr("RQL"), mw, SLOT(rawrql()), QKeySequence(tr("Ctrl+r")) );

    m_messageBar->raise();
}
CalamaresWindow::CalamaresWindow( QWidget* parent )
    : QWidget( parent )
{
    // Hide close button
    setWindowFlags( Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint );

    setMinimumSize( 1010, 560 );
    QSize availableSize = qApp->desktop()->screenGeometry( this ).size();
    int w = qBound( 1010, CalamaresUtils::defaultFontHeight() * 60, availableSize.width() );
    int h = qBound( 560,  CalamaresUtils::defaultFontHeight() * 36, availableSize.height() );

    cDebug() << "Proposed window size:" << w << h;
    resize( w, h );

    QBoxLayout* mainLayout = new QHBoxLayout;
    setLayout( mainLayout );

    QWidget* sideBox = new QWidget( this );
    mainLayout->addWidget( sideBox );

    QBoxLayout* sideLayout = new QVBoxLayout;
    sideBox->setLayout( sideLayout );
    sideBox->setFixedWidth( qMax( 190, CalamaresUtils::defaultFontHeight() * 12 ) );
    sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    QHBoxLayout* logoLayout = new QHBoxLayout;
    sideLayout->addLayout( logoLayout );
    logoLayout->addStretch();
    QLabel* logoLabel = new QLabel( "branding\ngoes\nhere", sideBox );
    {
        QPalette plt = sideBox->palette();
        sideBox->setAutoFillBackground( true );
        plt.setColor( sideBox->backgroundRole(), CalamaresStyle::SIDEBAR_BACKGROUND );
        plt.setColor( sideBox->foregroundRole(), CalamaresStyle::SIDEBAR_TEXT );
        sideBox->setPalette( plt );
        logoLabel->setPalette( plt );
    }
    logoLabel->setAlignment( Qt::AlignCenter );
    logoLabel->setFixedSize( 80, 80 );
    logoLayout->addWidget( logoLabel );
    logoLayout->addStretch();

    ProgressTreeView* tv = new ProgressTreeView( sideBox );
    sideLayout->addWidget( tv );
    CalamaresUtils::unmarginLayout( sideLayout );
    CalamaresUtils::unmarginLayout( mainLayout );

    Calamares::ViewManager* vm = new Calamares::ViewManager( this );

    mainLayout->addWidget( vm->centralWidget() );
}
Example #9
0
void TrackContainerView::realignTracks()
{
	QWidget * content = m_scrollArea->widget();
	content->setFixedWidth( width()
				- m_scrollArea->verticalScrollBar()->width() );
	content->setFixedHeight( content->minimumSizeHint().height() );

	for( trackViewList::iterator it = m_trackViews.begin();
						it != m_trackViews.end(); ++it )
	{
		( *it )->show();
		( *it )->update();
	}
}
Example #10
0
ExamplesPreview::ExamplesPreview(int engine, QWidget *parent) : QScrollArea(parent)
{
    setWindowFlags(windowFlags() | Qt::ToolTip);
    setAutoFillBackground(true);

    setFrameStyle(QFrame::Box | QFrame::Plain);
    setFixedSize(300, 300);
    setWidgetResizable(true);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QWidget *widget = new QWidget(this);
    widget->setFixedWidth(280);
    QVBoxLayout *l = new QVBoxLayout(widget);
    l->setSpacing(0);

    QPalette p(palette());
    p.setColor(QPalette::Window, QColor("#c0daff"));
    setPalette(p);

    static const QStringList filters[ENGINE_MAX] =
    {
        (QStringList() << "*.js"),
        (QStringList() << "*.py")
    };

    QDir dir(":/examples");
    QStringList files = dir.entryList(filters[engine], QDir::NoFilter, QDir::Name);
    QFile f;
    for(int i = 0; i < files.size(); ++i)
    {
        f.setFileName(":/examples/" + files[i]);
        if(!f.open(QIODevice::ReadOnly))
            continue;

        ExamplePreviewItem *prev = new ExamplePreviewItem(files[i], f.readLine(), this);
        connect(prev, SIGNAL(openInEditor(QString)), SIGNAL(openInEditor(QString)));
        connect(prev, SIGNAL(openPreview(QString)),  SIGNAL(openPreview(QString)));

        l->addWidget(prev);
        l->addWidget(getSeparator());

        f.close();
    }
    setWidget(widget);

    connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), SLOT(focusChanged(QWidget*, QWidget*)));
}
Example #11
0
QWidget* MainWindow::createListView()
{
    m_noteList = new QWidget(this);
    m_noteList->setMinimumWidth(100);
    QVBoxLayout* layoutList = new QVBoxLayout();
    layoutList->setContentsMargins(0, 0, 0, 0);
    layoutList->setSpacing(0);
    m_noteList->setLayout(layoutList);

    QHBoxLayout* layoutActions = new QHBoxLayout();
    layoutActions->setContentsMargins(0, 0, 0, 0);
    layoutList->setSpacing(0);

    CWizViewTypePopupButton* viewBtn = new CWizViewTypePopupButton(*this, this);
    connect(viewBtn, SIGNAL(viewTypeChanged(int)), SLOT(on_documents_viewTypeChanged(int)));
    layoutActions->addWidget(viewBtn);
    QWidget* line = new QWidget(this);
    line->setFixedWidth(1);
    line->setStyleSheet("border-left-width:1;border-left-style:solid;border-left-color:#d9dcdd");
    layoutActions->addWidget(line);
    CWizSortingPopupButton* sortBtn = new CWizSortingPopupButton(*this, this);
    connect(sortBtn, SIGNAL(sortingTypeChanged(int)), SLOT(on_documents_sortingTypeChanged(int)));
    layoutActions->addWidget(sortBtn);
    layoutActions->addStretch(0);

    m_labelDocumentsHint = new QLabel(this);
    m_labelDocumentsHint->setStyleSheet("font: 12px; color: #787878");
    m_labelDocumentsHint->setMargin(5);
    layoutActions->addWidget(m_labelDocumentsHint);
    connect(m_category, SIGNAL(documentsHint(const QString&)), SLOT(on_documents_hintChanged(const QString&)));

    m_labelDocumentsCount = new QLabel("", this);
    m_labelDocumentsCount->setStyleSheet("font: 12px; color: #787878");
    m_labelDocumentsCount->setMargin(5);
    layoutActions->addWidget(m_labelDocumentsCount);
    connect(m_documents, SIGNAL(documentCountChanged()), SLOT(on_documents_documentCountChanged()));

    QWidget* line2 = new QWidget(this);
    line2->setFixedHeight(1);
    line2->setStyleSheet("border-top-width:1;border-top-style:solid;border-top-color:#d9dcdd");

    layoutList->addLayout(layoutActions);
    layoutList->addWidget(line2);
    layoutList->addWidget(m_documents);

    return m_noteList;
}
Example #12
0
void Player::setSkin(const QString& skin_name)
{
    QDir dir = QDir(Settings::path);
    dir.cd("skins");
#ifdef Q_OS_WIN
    dir.cd(skin_name);
#else
    if (!dir.cd(skin_name))
        dir = QDir(QDir::homePath() + "/.lplayer/skins/" + skin_name);
#endif
    // Load skin.qml
    if (chdir(dir.absolutePath().toUtf8().constData()))
    {
        QMessageBox::warning(this, "Error", tr("Failed to read skin!"));
        exit(EXIT_FAILURE);
    }
    QFile qssFile("skin.qss");
    if (!qssFile.open(QFile::ReadOnly | QFile::Text))
    {
        QMessageBox::warning(this, "Error", tr("Failed to read skin!"));
        exit(EXIT_FAILURE);
    }
    QString qss = QString::fromUtf8(qssFile.readAll());
    qssFile.close();
    setStyleSheet(qss);

    // Set fixed sizes
    QFile sizeFile("fixed_sizes");
    if (sizeFile.open(QFile::ReadOnly | QFile::Text))
    {
        QByteArray data = sizeFile.readAll().simplified().replace(" ", "");
        sizeFile.close();
        QStringList sizeInfos = QString::fromUtf8(data).split(';', QString::SkipEmptyParts);
        foreach (QString item, sizeInfos) {
            QStringList properties = item.split(',');
            QWidget *widget = findChild<QWidget*>(properties[0]);
            if (widget)
            {
                int w = properties[1].toInt(), h = properties[2].toInt();
                if (w)
                    widget->setFixedWidth(w);
                if (h)
                    widget->setFixedHeight(h);
                widget->setFocusPolicy(Qt::NoFocus);
            }
        }
//************************************************************************************************
//************************************** class ZFolderSelect2 ***********************************
//************************************************************************************************
ZFolderSelect2::ZFolderSelect2(bool onlyDirs, QString path)
  :MyBaseDlg()
{
  QString ProgDir =  QString ( qApp->argv() [0] );
  int i = ProgDir.findRev ( "/" );
  ProgDir.remove ( i+1, ProgDir.length() - i );

  ZConfig readlang("/ezxlocal/download/appwrite/setup/ezx_system.cfg", true);
  Idioma = ProgDir + "/languages/" + readlang.readEntry(QString("SYS_SYSTEM_SET"), QString("LanguageType"), "en-us");
  if ( ! QFileInfo(Idioma).isFile() ) Idioma = ProgDir + "/languages/en-us";
  ZConfig lang (Idioma,false); 

  this->setMainWidgetTitle("zFileManager");
  
  QWidget *myWidget = new ZWidget ( this, NULL, 0);
  QVBoxLayout *myVBoxLayout = new QVBoxLayout ( myWidget, 0 );
  myWidget->setFixedWidth(240);
  ZAppInfoArea* pAIA = new ZAppInfoArea(myWidget, NULL, 0);
  pAIA->setActArea(ZAppInfoArea::no_progress_meter);
  QPixmap pixmap; pixmap.load(ProgDir+"/img/folder.png");
  pAIA->appendIcon(ZAppInfoArea::activity,pixmap,"");
  pAIA->appendText(ZAppInfoArea::activity, lang.readEntry(QString("LANGUAGE"), "SEARCH_IN", ""), "name");
  setAppInfoArea(pAIA);
  myVBoxLayout->insertWidget (0, pAIA );

  fb = new FileBrowser2("*", onlyDirs, QString ( "%I%M" ), myWidget, 0);
  fb->setDir(path);
  QObject::connect(fb, SIGNAL(isFilePicked(bool)), SLOT(filePicked(bool)));

  
  fb->ProgramDir = ProgDir;
  setContentWidget ( fb );
  
  ZSoftKey *softKey = new ZSoftKey ( "CST_2A", this, this );
  
  softKey->setText ( ZSoftKey::RIGHT, lang.readEntry(QString("LANGUAGE"), "CANCEL", ""), ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setText ( ZSoftKey::LEFT, lang.readEntry(QString("LANGUAGE"), "CHOISE", ""), ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setClickedSlot ( ZSoftKey::RIGHT, this, SLOT ( slot_cancel() ) );
  softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( accept() ) );
   
  this->setCSTWidget( softKey );

}
Example #14
0
void DataSaver::saveData() {

    QString qPath = path->text().toLocal8Bit();
    string stdPath = qPath.toStdString();
    if(stdPath.find('"') != string::npos) { // = if there are more files selected

        int i = 0;
        unsigned int i1 = 0, i2 = 1;
        while(i > -1) {

            if(i1 > stdPath.length() || i2 > stdPath.length())
                break;
            i1 = stdPath.find('"', i1);
            i++;
            i2 = stdPath.find('"', i2);
            i++;
            if(i1 == string::npos || i2 == string::npos)
                break;
            string stdPath1 = stdPath.substr(i1+1, i2-(i1+1));
            saveFile(stdPath1, editors);
            i1=i2+1;
            i2+=3;

        }

    } else {                                    // = if only one file was selected
        saveFile(stdPath, editors);
    }

    QWidget* w = new QWidget();
    QLabel *l = new QLabel("Saved.", w);
    QPushButton* b = new QPushButton("OK", w);
    QVBoxLayout* layout = new QVBoxLayout();
    layout->addWidget(l);
    layout->addWidget(b);
    w->setLayout(layout);
    w->setFixedHeight(100);
    w->setFixedWidth(150);
    w->show();
    QWidget::connect(b, SIGNAL(clicked()), w, SLOT(close()));

}
Example #15
0
void AdvancedRenameLineEditProxy::setWidget(QWidget* widget)
{
    delete m_widget;
    delete m_layout;

    m_widget = widget;
    m_widget->setParent(this);

    QWidget* placeholder = new QWidget(this);
    placeholder->setFixedHeight(1);
    placeholder->setFixedWidth(clearButtonUsedSize().width());

    QGridLayout* mainLayout = new QGridLayout(this);
    mainLayout->addWidget(m_widget,    0, 0, 1, 1);
    mainLayout->addWidget(placeholder, 0, 1, 1, 1);
    mainLayout->setSpacing(0);
    mainLayout->setMargin(0);
    setLayout(mainLayout);
    updateGeometry();
}
Example #16
0
void tst_QFormLayout::wrapping()
{
    QWidget *w = new QWidget;
    QFormLayout *fl = new QFormLayout(w);
    fl->setRowWrapPolicy(QFormLayout::WrapLongRows);

    QLineEdit *le = new QLineEdit;
    QLabel *lbl = new QLabel("A long label");
    le->setMinimumWidth(200);
    fl->addRow(lbl, le);

    w->setFixedWidth(240);
    w->show();

    QCOMPARE(le->geometry().y() > lbl->geometry().y(), true);

    //TODO: additional tests covering different wrapping cases

    delete w;
}
Example #17
0
ModuleTitle::ModuleTitle(QWidget *parent, const char *name) : QHBox(parent, name)
{
    QWidget *spacer = new QWidget(this);
    spacer->setFixedWidth(KDialog::marginHint() - KDialog::spacingHint());
    m_icon = new QLabel(this);
    m_name = new QLabel(this);

    QFont font = m_name->font();
    font.setPointSize(font.pointSize() + 1);
    font.setBold(true);
    m_name->setFont(font);

    setSpacing(KDialog::spacingHint());
    if(QApplication::reverseLayout())
    {
        spacer = new QWidget(this);
        setStretchFactor(spacer, 10);
    }
    else
        setStretchFactor(m_name, 10);
}
//************************************************************************************************
//************************************** class ZFileOpenDialog ***********************************
//************************************************************************************************
ZFileOpenDialog::ZFileOpenDialog()
  :MyBaseDlg()
{
  
  QString ProgDir =  QString ( qApp->argv() [0] );
  int i = ProgDir.findRev ( "/" );
  ProgDir.remove ( i+1, ProgDir.length() - i );

  ZConfig readlang("/ezxlocal/download/appwrite/setup/ezx_system.cfg", true);
  Idioma = ProgDir + "/languages/" + readlang.readEntry(QString("SYS_SYSTEM_SET"), QString("LanguageType"), "en-us");
  if ( ! QFileInfo(Idioma).isFile() ) Idioma = ProgDir + "/languages/en-us";
  ZConfig lang (Idioma,false); 

  this->setMainWidgetTitle("zTextViewer");

  QWidget *myWidget = new ZWidget ( this, NULL, 0);
  QVBoxLayout *myVBoxLayout = new QVBoxLayout ( myWidget, 0 );
  myWidget->setFixedWidth(240);
  ZAppInfoArea* pAIA = new ZAppInfoArea(myWidget, NULL, 0);
  pAIA->setActArea(ZAppInfoArea::no_progress_meter);
  pAIA->appendText(ZAppInfoArea::activity, lang.readEntry(QString("TEXTVIEWER"), "IDS_OPEN", "Open"), "name");
  setAppInfoArea(pAIA);
  myVBoxLayout->addWidget ( pAIA, 1, 1 );

  fb = new FileBrowser("*", QString ( "%I%M" ), myWidget, 0);
  fb->setDir("/");
  QObject::connect(fb, SIGNAL(isFilePicked(bool)), SLOT(filePicked(bool)));

 // myVBoxLayout->addWidget ( fb, 1 );
  
  setContentWidget ( fb );
  
  ZSoftKey *softKey = new ZSoftKey ( NULL, this, this );
  softKey->setText ( ZSoftKey::LEFT, lang.readEntry(QString("TEXTVIEWER"), "IDS_OPEN", "Open"), ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setText ( ZSoftKey::RIGHT, lang.readEntry(QString("TEXTVIEWER"), "IDS_CANCEL", "Cancel"), ( ZSoftKey::TEXT_PRIORITY ) 0 );
  softKey->setClickedSlot ( ZSoftKey::RIGHT, this, SLOT ( reject() ) );
  softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( accept() ) );
  setCSTWidget ( softKey );
}
Example #19
0
void DialogController::showDialog(QWidget *widget)
{
    QWidget *frame = frameWidget(widget);
    if(m_dialogHeight > 0) {
        frame->setFixedHeight(m_dialogHeight);
    }
    if(m_dialogWidth > 0) {
        frame->setFixedWidth(m_dialogWidth);
    }
    frame->setFocus();
    frame->show();
    connect(widget, &QWidget::destroyed, this, &DialogController::closeDialogWhenDestroyed);

    if(m_dialog) { // previous dialog
        if(m_widget)
            disconnect(m_widget, 0, this, 0);

        m_dialog->close();
        m_dialog->deleteLater();
        m_widget = widget;
        m_dialog = frame;
        frame->setGeometry(visibleGeometry(frame));
        return; // only animate, if there was no dialog before.
    }

    m_widget = widget;
    m_dialog = frame;

    QPropertyAnimation *animation  = new QPropertyAnimation(m_dialog, "geometry");
    animation->setStartValue(hiddenGeometry(frame));
    animation->setEndValue(visibleGeometry(frame));
    animation->setDuration(300);
    animation->setEasingCurve(QEasingCurve::OutExpo);
    animation->start();

    connect(animation, &QPropertyAnimation::finished,
            animation, &QPropertyAnimation::deleteLater);
}
Example #20
0
QWidget *CSVSettings::ListView::buildWidget(bool isMultiLine, int width)
{
    QWidget *widget = 0;

    if (isMultiLine)
    {
        mAbstractItemView = new QListView (this);
        widget = mAbstractItemView;

        if (width > 0)
            widget->setFixedWidth (widgetWidth (width));
    }
    else
    {
        mComboBox = new QComboBox (this);
        widget = mComboBox;

        if (width > 0)
            mComboBox->setMinimumContentsLength (width);
    }

    return widget;
}
Example #21
0
PlayListWidget::PlayListWidget(QWidget *parent)
    : ShadowWidget(parent)
    , col(1)
    , currentIndex(0)
    , pImpl(new PlayListWidget_Impl())
{
    setAttribute(Qt::WA_QuitOnClose, false);
    setWindowModality(Qt::ApplicationModal);
    QPalette text_palette = palette();
    text_palette.setColor(QPalette::Window, QColor(225, 225, 225));
    text_palette.setColor(QPalette::Background, QColor(255, 255, 255, 120));
    setPalette(text_palette);
    QHBoxLayout *up_title_layout = new QHBoxLayout;
    set_no_margin(up_title_layout);
    connect(pImpl->btn_close, SIGNAL(clicked()), this, SLOT(hide()));
    up_title_layout->addWidget(pImpl->btn_close, 0, Qt::AlignTop);
    up_title_layout->addStretch();
    QVBoxLayout *main_layout = new QVBoxLayout(this);
    QScrollArea *view = new QScrollArea;
    view->setWidgetResizable(true);
    view->setContentsMargins(0, 0, 0, 0);
    QWidget *viewWidgetContents = new QWidget(view);
    QVBoxLayout *tmp_layout = new QVBoxLayout(viewWidgetContents);
    tmp_layout->addLayout(pImpl->scroll_layout);
    tmp_layout->addStretch();
    view->setWidget(viewWidgetContents);
    main_layout->addLayout(up_title_layout);
    main_layout->addWidget(view);
    main_layout->setSpacing(0);
    viewWidgetContents->setPalette(text_palette);
    main_layout->setContentsMargins(5, 5, 5, 5);
    viewWidgetContents->setFixedWidth(380);
    setFixedSize(400, 300);
    connect(pImpl->play_next_key, SIGNAL(triggered()), SLOT(on_playNext_clicked()));
    connect(pImpl->play_prev_key, SIGNAL(triggered()), SLOT(on_playPrev_clicked()));
}
Example #22
0
File: main.cpp Project: kgadek/kpfp
int main(int argc, char **argv) {
	QApplication app(argc, argv);

	QWidget *window = new QWidget;
	window->setWindowTitle("Real Life simulator: zwierzyna kontra predator");

	QHBoxLayout *layout = new QHBoxLayout;
	QVBoxLayout *settings = new QVBoxLayout();

	PlotArea *plot = new PlotArea();


	// ********************************************************************************
	QLabel *labA = new QLabel("Wsp. smierci drapieznikow z powodu braku ofiar (0,1]");
	QSlider *slA = new QSlider(Qt::Horizontal);
	slA->setMaximum((int)sliderAmax);
	slA->setMinimum(1);
	slA->setValue(0.1*sliderAmax);
	settings->addWidget(labA);
	settings->addWidget(slA);
	QObject::connect(slA,SIGNAL(valueChanged(int)),plot,SLOT(setA(int)));

	QLabel *labB = new QLabel("Wsp. narodzin ofiar, gdy nie ma drapieznikow (0,1]");
	QSlider *slB = new QSlider(Qt::Horizontal);
	slB->setMaximum((int)sliderBmax);
	slB->setMinimum(1);
	slB->setValue(0.1*sliderBmax);
	settings->addWidget(labB);
	settings->addWidget(slB);
	QObject::connect(slB,SIGNAL(valueChanged(int)),plot,SLOT(setB(int)));

	QLabel *labC = new QLabel("Efektywnosc, z jaka drapieznik wykorzystuje energie\npozyskana ze zjedzenia ofiar (0,1]");
	QSlider *slC = new QSlider(Qt::Horizontal);
	slC->setMaximum((int)sliderCmax);
	slC->setMinimum(1);
	slC->setValue(0.07*sliderCmax);
	settings->addWidget(labC);
	settings->addWidget(slC);
	QObject::connect(slC,SIGNAL(valueChanged(int)),plot,SLOT(setC(int)));

	QLabel *labD = new QLabel("Efektywnosc usmiercania ofiar przez\ndrapieznikow (0,1]");
	QSlider *slD = new QSlider(Qt::Horizontal);
	slD->setMaximum((int)sliderDmax);
	slD->setMinimum(1);
	slD->setValue(0.008*sliderDmax);
	settings->addWidget(labD);
	settings->addWidget(slD);
	QObject::connect(slD,SIGNAL(valueChanged(int)),plot,SLOT(setD(int)));

	QLabel *labH = new QLabel("Krok czasowy (0,1]");
	QSlider *slH = new QSlider(Qt::Horizontal);
	slH->setMaximum((int)sliderHmax);
	slH->setMinimum(1);
	slH->setValue(0.1*sliderHmax);
	settings->addWidget(labH);
	settings->addWidget(slH);
	QObject::connect(slH,SIGNAL(valueChanged(int)),plot,SLOT(setH(int)));

	QLabel *labN = new QLabel("Ilosc krokow (0,1000000]");
	QSlider *slN = new QSlider(Qt::Horizontal);
	slN->setMaximum(100000);
	slN->setMinimum(1);
	slN->setValue(10000);
	settings->addWidget(labN);
	settings->addWidget(slN);
	QObject::connect(slN,SIGNAL(valueChanged(int)),plot,SLOT(setN(int)));

	QLabel *labX = new QLabel("Poczatkowa ilosc drapieznikow\n(0,10000]");
	QSlider *slX = new QSlider(Qt::Horizontal);
	slX->setMaximum(1000);
	slX->setMinimum(1);
	slX->setValue(1);
	settings->addWidget(labX);
	settings->addWidget(slX);
	QObject::connect(slX,SIGNAL(valueChanged(int)),plot,SLOT(setX0(int)));

	QLabel *labY = new QLabel("Poczatkowa ilosc ofiar (0,10000]");
	QSlider *slY = new QSlider(Qt::Horizontal);
	slY->setMaximum(10000);
	slY->setMinimum(1);
	slY->setValue(1000);
	settings->addWidget(labY);
	settings->addWidget(slY);
	QObject::connect(slY,SIGNAL(valueChanged(int)),plot,SLOT(setY0(int)));


	// ********************************************************************************
	layout->addWidget(plot);
	layout->addLayout(settings);

	window->setLayout(layout);
	window->adjustSize();
	window->setFixedWidth(900);
	window->show();

	return app.exec();
}
Example #23
0
MasterEdit::MasterEdit()
: AbstractMidiEditor(0, _rasterInit, 0)
{
    setWindowTitle(tr("LOS: Tempo Editor"));
    setWindowIcon(*losIcon);
    mainw->setLayout(mainGrid);
    _raster = 0; // measure
    //setMinimumSize(400, 300);
    //resize(500, 350);

    //---------Pulldown Menu----------------------------
    //      QPopupMenu* file = new QPopupMenu(this);
    //      menuBar()->insertItem("&File", file);

    //---------ToolBar----------------------------------

    QToolBar* info = new QToolBar(tr("Info Tools"));
    addToolBar(Qt::BottomToolBarArea, info);

    editbar = new EditToolBar(this, masterTools);

    info->setFloatable(false);
    info->setMovable(false);

    cursorPos = new PosLabel(0);
    cursorPos->setFixedHeight(22);
    cursorPos->setToolTip(tr("time at cursor position"));
    cursorPos->setObjectName("composerCursor");
    info->addWidget(cursorPos);
    tempo = new TempoLabel(0);
    tempo->setFixedHeight(22);
    tempo->setToolTip(tr("tempo at cursor position"));
    tempo->setObjectName("pitchLabel");
    info->addWidget(tempo);

    const char* rastval[] = {
        QT_TRANSLATE_NOOP("@default", "Off"), "Bar", "1/2", "1/4", "1/8", "1/16"
    };
    rasterLabel = new QComboBox(this);
    rasterLabel->setFocusPolicy(Qt::NoFocus);
    for (int i = 0; i < 6; i++)
        rasterLabel->insertItem(i, tr(rastval[i]));
    rasterLabel->setCurrentIndex(1);
    info->addWidget(rasterLabel);
    connect(rasterLabel, SIGNAL(currentIndexChanged(int)), SLOT(_setRaster(int)));

    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    spacer->setFixedWidth(15);
    info->addWidget(spacer);

    info->addWidget(editbar);

    QWidget* spacer15 = new QWidget();
    spacer15->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    spacer15->setFixedWidth(15);
    info->addWidget(spacer15);

    //---------values for current position---------------
    info->addWidget(new QLabel(tr("CurPos ")));
    curTempo = new TempoEdit(0);
    curSig = new SigEdit(0);
    curSig->setValue(AL::TimeSignature(4, 4));
    curTempo->setToolTip(tr("tempo at current position"));
    curSig->setToolTip(tr("time signature at current position"));
    info->addWidget(curTempo);
    info->addWidget(curSig);
    ///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
    connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&)));

    ///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
    connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double)));

    //---------------------------------------------------
    //    master
    //---------------------------------------------------

    int xscale = -20;
    int yscale = -500;
    hscroll = new ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw);
    vscroll = new ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw);
    vscroll->setRange(30000, 250000);
    time1 = new MTScale(&_raster, mainw, xscale);
    sign = new SigScale(&_raster, mainw, xscale);

    canvas = new Master(this, mainw, xscale, yscale);

    time2 = new MTScale(&_raster, mainw, xscale);
    tscale = new TScale(mainw, yscale);
    time2->setBarLocator(true);

    //---------------------------------------------------
    //    Rest
    //---------------------------------------------------

    //      QSizeGrip* corner   = new QSizeGrip(mainw);

    mainGrid->setRowStretch(5, 100);
    mainGrid->setColumnStretch(1, 100);

    mainGrid->addWidget(hLine(mainw), 0, 1);
    mainGrid->addWidget(time1, 1, 1);
    mainGrid->addWidget(hLine(mainw), 2, 1);
    mainGrid->addWidget(sign, 3, 1);
    mainGrid->addWidget(hLine(mainw), 4, 1);
    mainGrid->addWidget(canvas, 5, 1);
    mainGrid->addWidget(tscale, 5, 0);
    mainGrid->addWidget(hLine(mainw), 6, 1);
    mainGrid->addWidget(time2, 7, 1);
    mainGrid->addWidget(hscroll, 8, 1);
    mainGrid->addWidget(vscroll, 0, 2, 10, 1);


    connect(editbar, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
    connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
    connect(vscroll, SIGNAL(scaleChanged(float)), canvas, SLOT(setYMag(float)));

    connect(vscroll, SIGNAL(scrollChanged(int)), tscale, SLOT(setYPos(int)));
    connect(vscroll, SIGNAL(scaleChanged(float)), tscale, SLOT(setYMag(float)));

    connect(hscroll, SIGNAL(scrollChanged(int)), time1, SLOT(setXPos(int)));
    connect(hscroll, SIGNAL(scrollChanged(int)), sign, SLOT(setXPos(int)));
    connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
    connect(hscroll, SIGNAL(scrollChanged(int)), time2, SLOT(setXPos(int)));

    connect(hscroll, SIGNAL(scaleChanged(float)), time1, SLOT(setXMag(float)));
    connect(hscroll, SIGNAL(scaleChanged(float)), sign, SLOT(setXMag(float)));
    connect(hscroll, SIGNAL(scaleChanged(float)), canvas, SLOT(setXMag(float)));
    connect(hscroll, SIGNAL(scaleChanged(float)), time2, SLOT(setXMag(float)));

    connect(time1, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
    connect(time2, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));

    connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
    connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
    connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
    connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(posChanged(int, unsigned, bool)));

    connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
    connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
    posChanged(0, song->cpos(), false);
}
Example #24
0
ExcitationWidget::ExcitationWidget(QWidget* aFeedback, QString aWorkDir, QWidget* parent) throw (QLE) : QWidget(parent)
{
    this->feedback = aFeedback;

    ///////////////////// LAYOUNT //////////////////////////////////////////////
    QVBoxLayout* mainLayout = new QVBoxLayout();

    QGroupBox* exGroup = new QGroupBox("Parameters for excitation signal");
    QVBoxLayout* exLayout = new QVBoxLayout();

    // Excitation top
    QHBoxLayout* exTop = new QHBoxLayout();

    exTop->addWidget(new QLabel("Length, seconds:"));
    this->lengthCombo = new QComboBox();
    this->lengthCombo->setEditable(false);
    this->lengthCombo->addItem("3");
    this->lengthCombo->addItem("5");
    this->lengthCombo->addItem("7");
    this->lengthCombo->addItem("10");
    this->lengthCombo->addItem("15");
    this->lengthCombo->addItem("25");
    this->lengthCombo->addItem("40");
    this->lengthCombo->setCurrentIndex(2);
    exTop->addWidget(this->lengthCombo);
    connect(this->lengthCombo, SIGNAL(currentIndexChanged(const QString&)),
            this, SLOT(lengthChanged(const QString&)));

    exTop->addStretch(1);
    exTop->addSpacing(SMALL_SPACE);
    exTop->addWidget(new QLabel("Sample rate:"));
    this->rateCombo = new QComboBox();
    this->rateCombo->setEditable(false);
    this->rateCombo->addItem("32000");
    this->rateCombo->addItem("44100");
    this->rateCombo->addItem("48000");
    this->rateCombo->addItem("64000");
    this->rateCombo->addItem("88200");
    this->rateCombo->addItem("96000");
    this->rateCombo->addItem("128000");
    this->rateCombo->addItem("176400");
    this->rateCombo->addItem("192000");
    this->rateCombo->setCurrentIndex(2);
    exTop->addWidget(this->rateCombo);
    connect(this->rateCombo, SIGNAL(currentIndexChanged(const QString&)),
            this, SLOT(rateChanged(const QString&)));

    exTop->addStretch(1);
    exTop->addSpacing(SMALL_SPACE);
    exTop->addWidget(new QLabel("Bit depth:"));
    this->depthCombo = new QComboBox();
    this->depthCombo->setEditable(false);
    this->depthCombo->addItem("16");
    this->depthCombo->addItem("24");
    this->depthCombo->addItem("32");
    this->depthCombo->setCurrentIndex(2);
    exTop->addWidget(this->depthCombo);
    connect(this->depthCombo, SIGNAL(currentIndexChanged(const QString&)),
            this, SLOT(depthChanged(const QString&)));

    exTop->addSpacing(BIG_SPACE);
    QWidget* excitLabel = new QLabel("<b>Excitation</b>");
    excitLabel->setFixedWidth(MainWindow::rightSize().width());
    exTop->addWidget(excitLabel);

    exLayout->addLayout(exTop);

    // Excitation bottom
    QHBoxLayout* exBottom = new QHBoxLayout();

    exBottom->addWidget(new QLabel("Min Freq, Hz"));
    this->fMinCnt = new QwtCounter();
    this->fMinCnt->setRange(1.0, 100000.0);
#if QWT_VERSION > 0x060000
    this->fMinCnt->setSingleStep(1.0);
#else
    this->fMinCnt->setStep(1.0);
#endif
    this->fMinCnt->setNumButtons(2);
    this->fMinCnt->setIncSteps(QwtCounter::Button1, 1);
    this->fMinCnt->setIncSteps(QwtCounter::Button2, 10); 
    
    this->fMinCnt->setNumButtons(2);
    this->fMinCnt->setIncSteps(QwtCounter::Button1, 1);
    this->fMinCnt->setIncSteps(QwtCounter::Button2, 10);
    this->fMinCnt->setValue(100);
    QWidget* tmp = new QLabel("W100000W");
    this->fMinCnt->setFixedWidth(this->fMinCnt->sizeHint().width() + tmp->sizeHint().width());
    delete tmp;
    exBottom->addWidget(this->fMinCnt, 5);
    connect(this->fMinCnt, SIGNAL(valueChanged(double)), this, SLOT(fMinChanged(double)));

    exBottom->addStretch(1);
    exBottom->addSpacing(SMALL_SPACE);

    exBottom->addWidget(new QLabel("Max Freq, Hz"));
    this->fMaxCnt = new QwtCounter();
    this->fMaxCnt->setRange(1, 100000);
#if QWT_VERSION > 0x060000
    this->fMinCnt->setSingleStep(1.0);
#else
    this->fMinCnt->setStep(1.0);
#endif
    this->fMaxCnt->setNumButtons(2);
    this->fMaxCnt->setIncSteps(QwtCounter::Button1, 10);
    this->fMaxCnt->setIncSteps(QwtCounter::Button2, 1000);
    this->fMaxCnt->setValue(10000);
    tmp = new QLabel("W1000000W");
    this->fMaxCnt->setFixedWidth(this->fMaxCnt->sizeHint().width() + tmp->sizeHint().width());
    delete tmp;
    exBottom->addWidget(this->fMaxCnt, 5);
    connect(this->fMaxCnt, SIGNAL(valueChanged(double)), this, SLOT(fMaxChanged(double)));

    exBottom->addSpacing(BIG_SPACE);
    QPushButton* genBtn = new QPushButton("Generate");
    genBtn->setFixedWidth(MainWindow::rightSize().width());
    exBottom->addWidget(genBtn);
    connect(genBtn, SIGNAL(clicked()), this, SLOT(generate()));

    exLayout->addLayout(exBottom);

    //
    exGroup->setLayout(exLayout);
    mainLayout->addWidget(exGroup);
    this->setLayout(mainLayout);
    this->layout()->setMargin(0);

    ////////////////////////// SIGNALS ////////////////////////////////////////
    connect(this, SIGNAL(setStatus(const QString&)),
            this->feedback, SLOT(showStatus(const QString&)));
    connect(this, SIGNAL(setStatus(const QString&, int)),
            this->feedback, SLOT(showStatus(const QString&, int)));
    connect(this->feedback, SIGNAL(forceRate(int)), this, SLOT(forceRate(int)), Qt::QueuedConnection);
    connect(this->feedback, SIGNAL(workDirChanged(const QString&)),
            this, SLOT(setWorkDir(const QString&)));
    connect(this, SIGNAL(excitInfoChanged(const QString&)),
            this->feedback, SLOT(changeExcitInfo(const QString&)));

    ///////////////
    this->setWorkDir(aWorkDir);

}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{


    //ui->setupUi(this);
    QGridLayout* gamefield = new QGridLayout();
    config *current=new config();

    QColor clr(255,255,255);
    QPalette qw(clr);
    QColor clr2(9,227,89);
    QPalette qw2(clr2);

    for(int i=0;i<25;i++)
    {
        for(int j=0;j<25;j++)
        {

            my_cell *mWidget= new my_cell(this);
            current->array[i][j]=mWidget;

            mWidget->setAutoFillBackground(1);
            if(i==0 || i==24 || j==24 || j==0)
            {
                mWidget->setVisible(false);

            gamefield->addWidget(mWidget,i,j);
            }
            else
            {

            mWidget->setPalette(qw);
            gamefield->addWidget(mWidget,i,j);

            }
        }
    }

    this->setWindowTitle("Life");

    QWidget* w = new QWidget(this);

    QPushButton *btn1=new QPushButton("GO");
    QPushButton *stahp=new QPushButton("STOP");
     QPushButton *clearz=new QPushButton("CLEAR");
    gamefield->addWidget(btn1,1,26);
   gamefield->addWidget(stahp,2,26);
   gamefield->addWidget(clearz,3,26);

    connect(btn1,SIGNAL(clicked()),current,SLOT(woohoo()));
    connect(stahp,SIGNAL(clicked()),current,SLOT(stop()));
      connect(clearz,SIGNAL(clicked()),current,SLOT(clear()));




    gamefield->setHorizontalSpacing(1);
     gamefield->setVerticalSpacing(1);
    w->setLayout(gamefield);
    this->setCentralWidget(w);
    w->setFixedHeight(600);
    w->setFixedWidth(600);
    w->setMaximumHeight(601);
     w->setMaximumWidth(601);
     this->setMaximumHeight(600);
     this->setMaximumHeight(600);







}
Example #26
0
StartupView::StartupView( QWidget * parent ) 
  : QWidget( parent )
{
  m_templateListModel = boost::shared_ptr<TemplateListModel>( new TemplateListModel() );

  setStyleSheet("openstudio--StartupView { background: #E6E6E6; }");
  
#ifdef Q_WS_MAC
  setWindowFlags(Qt::FramelessWindowHint);
#else
  setWindowFlags(Qt::CustomizeWindowHint);
#endif

  QWidget * recentProjectsView = new QWidget();
  recentProjectsView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * recentProjectsLayout = new QVBoxLayout();
  recentProjectsLayout->setContentsMargins(10,10,10,10);
  QLabel * recentProjectsLabel = new QLabel("Recent Projects");
  recentProjectsLabel->setStyleSheet("QLabel { font: bold }");
  recentProjectsLayout->addWidget(recentProjectsLabel,0,Qt::AlignTop);
  recentProjectsView->setLayout(recentProjectsLayout);

  QToolButton * openButton = new QToolButton();
  openButton->setText("Open File");
  openButton->setStyleSheet("QToolButton { font: bold; }");
  openButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon openIcon(":/images/open_file.png");
  openButton->setIcon(openIcon);
  openButton->setIconSize(QSize(40,40));
  connect( openButton, SIGNAL(clicked()), this, SIGNAL(openClicked()) );

  QToolButton * importButton = new QToolButton();
  importButton->setText("Import Idf");
  importButton->setStyleSheet("QToolButton { font: bold; }");
  importButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importIcon(":/images/import_file.png");
  importButton->setIcon(importIcon);
  importButton->setIconSize(QSize(40,40));
  connect( importButton, SIGNAL(clicked()), this, SIGNAL(importClicked()) );
/*  
  QToolButton * importSDDButton = new QToolButton();
  importSDDButton->setText("Import SDD");
  importSDDButton->setStyleSheet("QToolButton { font: bold; }");
  importSDDButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importSDDIcon(":/images/import_file.png");
  importSDDButton->setIcon(importSDDIcon);
  importSDDButton->setIconSize(QSize(40,40));
  connect( importSDDButton, SIGNAL(clicked()), this, SIGNAL(importSDDClicked()) );
*/
  QWidget * projectChooserView = new QWidget();
  projectChooserView->setFixedWidth(238);
  projectChooserView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * projectChooserLayout = new QVBoxLayout();
  projectChooserLayout->setContentsMargins(10,10,10,10);
  QLabel * projectChooserLabel = new QLabel("Create New From Template");
  projectChooserLabel->setStyleSheet("QLabel { font: bold }");
  projectChooserLayout->addWidget(projectChooserLabel,0,Qt::AlignTop);
  m_listView = new QListView();
  m_listView->setViewMode(QListView::IconMode);
  m_listView->setModel(m_templateListModel.get());
  m_listView->setFocusPolicy(Qt::NoFocus);
  m_listView->setFlow(QListView::LeftToRight);
  m_listView->setUniformItemSizes(true);
  m_listView->setSelectionMode(QAbstractItemView::SingleSelection);
  projectChooserLayout->addWidget(m_listView);
  projectChooserView->setLayout(projectChooserLayout);

  m_projectDetailView = new QWidget();
  m_projectDetailView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * projectDetailLayout = new QVBoxLayout();
  projectDetailLayout->setContentsMargins(10,10,10,10);
  m_projectDetailView->setLayout(projectDetailLayout);

  QWidget * footerView = new QWidget();
  footerView->setObjectName("FooterView");
  footerView->setStyleSheet("QWidget#FooterView { background: #E6E6E6; }");
  footerView->setMaximumHeight(50);
  footerView->setMinimumHeight(50);

  QPushButton * cancelButton = new QPushButton();
  cancelButton->setObjectName("StandardGrayButton");
  cancelButton->setMinimumSize(QSize(99,28));
  #ifdef OPENSTUDIO_PLUGIN
    cancelButton->setText("Cancel");
    connect( cancelButton, SIGNAL(clicked()), this, SLOT(hide()) );
  #else
    #ifdef Q_OS_MAC
      cancelButton->setText("Quit");
    #else
      cancelButton->setText("Exit");
    #endif
    connect( cancelButton, SIGNAL(clicked()), OpenStudioApp::instance(), SLOT(quit()) );
  #endif
  cancelButton->setStyleSheet("QPushButton { font: bold; }");

  QPushButton * chooseButton = new QPushButton();
  chooseButton->setObjectName("StandardBlueButton");
  chooseButton->setText("Choose");
  chooseButton->setMinimumSize(QSize(99,28));
  connect( chooseButton, SIGNAL(clicked()), this, SLOT(newFromTemplateSlot()) );
  chooseButton->setStyleSheet("QPushButton { font: bold; }");

  QHBoxLayout * hFooterLayout = new QHBoxLayout();
  hFooterLayout->setSpacing(25);
  hFooterLayout->setContentsMargins(0,0,0,0);
  hFooterLayout->addStretch();
  hFooterLayout->addWidget(cancelButton);
  hFooterLayout->addWidget(chooseButton);
  footerView->setLayout(hFooterLayout);

  QHBoxLayout * hLayout = new QHBoxLayout();
  QVBoxLayout * vLayout = new QVBoxLayout();

  QVBoxLayout * vOpenLayout = new QVBoxLayout();
  vOpenLayout->addWidget(recentProjectsView);
  vOpenLayout->addWidget(openButton);
  vOpenLayout->addWidget(importButton);
  //vOpenLayout->addWidget(importSDDButton);

  hLayout->addLayout(vOpenLayout);
  hLayout->addWidget(projectChooserView);
  hLayout->addWidget(m_projectDetailView,1);

  vLayout->addSpacing(50);
  vLayout->addLayout(hLayout);
  vLayout->addWidget(footerView);

  setLayout(vLayout);

  connect(m_listView,SIGNAL(clicked( const QModelIndex &)),this,SLOT( showDetailsForItem( const QModelIndex & ) ));

  m_listView->setCurrentIndex(m_templateListModel->index(0,0));
  showDetailsForItem(m_templateListModel->index(0,0));
}
Example #27
0
CoursePage::CoursePage(ResizableStackedWidget *pageStack, Model *model, QWidget *parent)
    : QWidget(parent)
{
    this->model = model;
    this->pageStack = pageStack;



    courseEditForm = new CourseForm();
    courseEditDialog = new Dialog(this, courseEditForm, "Edit the course...", "Change", "Cancel");

    courseDeleteDialog = new Dialog(this, nullptr, "Are you sure you want to delete this course?", "Delete", "Cancel");

    factAddForm = new FactForm();
    factAddDialog = new Dialog(this, factAddForm, "Add a new fact...", "Add", "Cancel");

    sectionEditForm = new SectionForm();
    sectionEditDialog = new Dialog(this, sectionEditForm, "Edit the section...", "Edit", "Cancel");



    QVBoxLayout *outerLayout = new QVBoxLayout(this);



    //  ##   ## #######   ###   #####   ####### #####
    //  ##   ## ##       ## ##  ##  ##  ##      ##  ##
    //  ##   ## ##      ##   ## ##   ## ##      ##   ##
    //  ####### #####   ##   ## ##   ## #####   ##  ##
    //  ##   ## ##      ####### ##   ## ##      #####
    //  ##   ## ##      ##   ## ##  ##  ##      ##  ##
    //  ##   ## ####### ##   ## #####   ####### ##   ##

    // The breadcrumbs show the current course and provide
    // a way to go back to the courses screen.
    // It is presented like a filepath.

    QHBoxLayout *crumbBorderLayout = new QHBoxLayout();

    breadCrumbs = new BreadCrumbs(1, model, pageStack);
    breadCrumbs->setFixedWidth(700);

    crumbBorderLayout->addStretch(1);
    crumbBorderLayout->addWidget(breadCrumbs);
    crumbBorderLayout->addStretch(1);

    outerLayout->addLayout(crumbBorderLayout);



    // Now show the name of the current course and some buttons to
    // edit or delete it.

    QHBoxLayout *topBorderLayout = new QHBoxLayout();

    QWidget *topWidget = new QWidget();
    topWidget->setFixedWidth(700);
    QHBoxLayout *topLayout = new QHBoxLayout(topWidget);
    topLayout->setContentsMargins(0, 0, 0, 0);

    courseLabel = new QLabel();
    courseLabel->setWordWrap(true);
    courseLabel->setScaledContents(true);

    QFont courseFont = courseLabel->font();
    courseFont.setPointSize(24);
    courseLabel->setFont(courseFont);

    editCourseButton = new ImageButton(QPixmap(":/images/pencil_black.png"), QSize(32, 32));
    QVBoxLayout *editCourseVLayout = new QVBoxLayout();
    editCourseVLayout->addSpacing(16);
    editCourseVLayout->addWidget(editCourseButton);

    deleteCourseButton = new ImageButton(QPixmap(":/images/trash_black.png"), QSize(32, 32));
    QVBoxLayout *deleteCourseVLayout = new QVBoxLayout();
    deleteCourseVLayout->addSpacing(16);
    deleteCourseVLayout->addWidget(deleteCourseButton);

    topLayout->addWidget(courseLabel);
    topLayout->addLayout(editCourseVLayout);
    topLayout->addSpacing(10);
    topLayout->addLayout(deleteCourseVLayout);

    topBorderLayout->addStretch(1);
    topBorderLayout->addWidget(topWidget);
    topBorderLayout->addStretch(1);
    outerLayout->addLayout(topBorderLayout);


    outerLayout->addSpacing(20);
    outerLayout->addWidget(new HorizontalSeperator(QColor(66, 139, 202), 2));
    outerLayout->addSpacing(20);



    //  ######   #####  #####   ##    ##
    //  ##   ## ##   ## ##  ###  ##  ##
    //  ##   ## ##   ## ##   ##   ####
    //  ######  ##   ## ##   ##    ##
    //  ##   ## ##   ## ##   ##    ##
    //  ##   ## ##   ## ##  ###    ##
    //  ######   #####  #####      ##

    // Use a horizontal splitter to divide the two areas dynamically

    splitter = new Splitter(Qt::Horizontal);
    outerLayout->addWidget(splitter);
    splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);



    // The section picker controls which section is shown
    // on the other view.

    pickerScrollArea = new QScrollArea();
    pickerScrollArea->setWidgetResizable(true);
    pickerScrollArea->setFrameShape(QFrame::NoFrame);
    splitter->addWidget(pickerScrollArea);

    QWidget *pickerScrollWidget = new QWidget();
    pickerScrollLayout = new QVBoxLayout(pickerScrollWidget);
    pickerScrollLayout->setContentsMargins(0, 0, 0, 0);
    pickerScrollArea->setWidget(pickerScrollWidget);

    pickerScrollLayout->addStretch(1);



    // This is a list of facts which on click will either expand
    // or change to the fact page.

    courseScrollArea = new QScrollArea();
    courseScrollArea->setWidgetResizable(true);
    courseScrollArea->setFrameShape(QFrame::NoFrame);
    splitter->addWidget(courseScrollArea);

    QWidget *courseScrollWidget = new QWidget();
    courseScrollLayout = new QVBoxLayout(courseScrollWidget);
    courseScrollLayout->setContentsMargins(0, 0, 0, 0);
    courseScrollArea->setWidget(courseScrollWidget);



    splitter->setSizes(QList<int>({0, 1}));



    //  #####  ####  #####  ##   ##   ###   ##       #####
    // ##   ##  ##  ##   ## ###  ##  ## ##  ##      ##   ##
    //  ##      ##  ##      ###  ## ##   ## ##       ##
    //   ###    ##  ##      ####### ##   ## ##        ###
    //     ##   ##  ##  ### ##  ### ####### ##          ##
    // ##   ##  ##  ##   ## ##  ### ##   ## ##      ##   ##
    //  #####  ####  #####  ##   ## ##   ## #######  #####

    connect(editCourseButton, SIGNAL(clicked()), this, SLOT(courseEditButtonClicked()));

    connect(courseEditDialog, SIGNAL(accepted()), this, SLOT(courseEditDialogCompleted()));
    connect(courseEditDialog, SIGNAL(rejected()), courseEditDialog, SLOT(close()));

    connect(deleteCourseButton, SIGNAL(clicked()), courseDeleteDialog, SLOT(show()));

    connect(courseDeleteDialog, SIGNAL(accepted()), this, SLOT(courseDeleteDialogAccepted()));
    connect(courseDeleteDialog, SIGNAL(rejected()), courseDeleteDialog, SLOT(close()));

    connect(factAddDialog, SIGNAL(accepted()), this, SLOT(factAddFormCompleted()));
    connect(factAddDialog, SIGNAL(rejected()), factAddDialog, SLOT(close()));

    connect(sectionEditDialog, SIGNAL(accepted()), this, SLOT(sectionEditFormCompleted()));
    connect(sectionEditDialog, SIGNAL(rejected()), sectionEditDialog, SLOT(close()));

    connect(model, SIGNAL(courseSelectedChanged(Course)), this, SLOT(courseSelectedChangedSlot(Course)));
    connect(model, SIGNAL(courseEdited(Course)), this, SLOT(courseEditedSlot(Course)));
    connect(model, SIGNAL(courseDeleted(int)), this, SLOT(courseDeletedSlot(int)));
}
Example #28
0
SectionLord::SectionLord( QWidget * parent, const char * name )
	: GenericSection( parent, name )
{
	setTitle( tr( "Lord" ) );

	QVBoxLayout * layout = new QVBoxLayout( _mainWidget );
	layout->setMargin( 5 );
	layout->setSpacing( 5 );

	_bigPix = new AskPixmap( true, "", tr( "Photo: " ), _mainWidget );
	layout->addWidget( _bigPix );

	_smallPix = new AskPixmap( true, "", tr( "Icon: " ), _mainWidget );
	layout->addWidget( _smallPix );

	_name = new AskString( tr( "Name : " ), _mainWidget );
	layout->addWidget( _name );

	_category = new AskCombo( tr( "Category : " ), _mainWidget );
	layout->addWidget( _category );

	_attack = new AskInt( tr( "Attack : " ), _mainWidget );

	_defense = new AskInt( tr( "Defense : " ), _mainWidget );

	_movemax = new AskInt( tr( "MaxMoves : " ), _mainWidget );
	_movemax->setMaxValue( 9000 );

	_vision = new AskInt( tr( "Vision : " ), _mainWidget );

	QWidget * widg = new QWidget(this);
	
	QGridLayout * glayout = new QGridLayout( widg );
	glayout->setColumnStretch( 0, 1 );
	glayout->setColumnStretch( 1, 1 );
	glayout->addWidget( _attack, 0, 0,Qt::AlignLeft );
	glayout->addWidget( _defense, 0, 1 ,Qt::AlignLeft );
	glayout->addWidget( _movemax, 1, 0 ,Qt::AlignLeft );
	glayout->addWidget( _vision, 1, 1 ,Qt::AlignLeft );
	glayout->setRowStretch( 2, 1 );
	glayout->setMargin( 0 );
	widg->setFixedWidth( 450 );
	
	layout->addWidget( widg );
	
	_cost = new AskCost( tr( "Cost: " ), _mainWidget );
	layout->addWidget( _cost );

	_troops = new DisplayTroops( _mainWidget );
	layout->addWidget( _troops );

	layout->addStretch( 1 );
	layout->activate();

	if( DataTheme.lords.count() > 1 ) {
		_idLord = 1;
	} else {
		_idLord = 0;
	}
	updateData();
	selectFirst();
}
BackstageOSF::BackstageOSF(QWidget *parent) : BackstagePage(parent)
{
	QGridLayout *layout = new QGridLayout(this);
	layout->setSpacing(0);
	layout->setContentsMargins(0, 0, 0, 0);
	setLayout(layout);

	QWidget *topRow = new QWidget(this);
	layout->addWidget(topRow);

	QGridLayout *topRowLayout = new QGridLayout();
	topRowLayout->setContentsMargins(0, 6, 12, 0);
	topRow->setLayout(topRowLayout);

	QLabel *label = new QLabel("Open Science Framework", topRow);
	QSizePolicy sp = label->sizePolicy();
	sp.setHorizontalStretch(1);
	label->setSizePolicy(sp);
	label->setContentsMargins(12, 12, 12, 1);
	topRowLayout->addWidget(label, 0, 0);

	_nameButton = new QToolButton(topRow);
	_nameButton->hide();
	topRowLayout->addWidget(_nameButton, 0, 1);

	connect(_nameButton, SIGNAL(clicked(bool)), this, SLOT(nameClicked()));

	QWidget *buttonsWidget = new QWidget(this);
	buttonsWidget->setContentsMargins(0, 0, 0, 0);
	layout->addWidget(buttonsWidget);

	QGridLayout *buttonsWidgetLayout = new QGridLayout(buttonsWidget);
	buttonsWidgetLayout->setContentsMargins(0, 0, 12, 0);
	buttonsWidget->setLayout(buttonsWidgetLayout);

	_breadCrumbs = new BreadCrumbs(buttonsWidget);
	buttonsWidgetLayout->addWidget(_breadCrumbs, 0, 0);

	_newFolderButton = new QToolButton(buttonsWidget);
	_newFolderButton->setText("New Folder");
	_newFolderButton->hide();
	buttonsWidgetLayout->addWidget(_newFolderButton, 0, 2);

	_fileNameContainer = new QWidget(this);
	_fileNameContainer->hide();
	_fileNameContainer->setObjectName("browseContainer");
	layout->addWidget(_fileNameContainer);

	QHBoxLayout *saveLayout = new QHBoxLayout(_fileNameContainer);
	_fileNameContainer->setLayout(saveLayout);

	_fileNameTextBox = new QLineEdit(_fileNameContainer);
	QSizePolicy policy = _fileNameTextBox->sizePolicy();
	policy.setHorizontalStretch(1);
	_fileNameTextBox->setSizePolicy(policy);
	_fileNameTextBox->setEnabled(false);

	saveLayout->addWidget(_fileNameTextBox);

	_saveButton = new QPushButton(_fileNameContainer);
	_saveButton->setText("Save");
	_saveButton->setEnabled(false);
	saveLayout->addWidget(_saveButton, 0, Qt::AlignRight);

	QWidget *line;

	line = new QWidget(this);
	line->setFixedHeight(1);
	line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
	layout->addWidget(line);

	_model = new FSBMOSF();

	connect(_model, SIGNAL(authenticationSuccess()), this, SLOT(updateUserDetails()));
	connect(_model, SIGNAL(authenticationClear()), this, SLOT(updateUserDetails()));

	_fsBrowser = new FSBrowser(this);
	_fsBrowser->setViewType(FSBrowser::ListView);
	_fsBrowser->setFSModel(_model);
	layout->addWidget(_fsBrowser);

	_breadCrumbs->setModel(_model);
	_breadCrumbs->setEnabled(false);

	connect(_fsBrowser, SIGNAL(entryOpened(QString)), this, SLOT(notifyDataSetOpened(QString)));
	connect(_fsBrowser, SIGNAL(entrySelected(QString)), this, SLOT(notifyDataSetSelected(QString)));

	connect(_saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
	connect(_newFolderButton, SIGNAL(clicked(bool)), this, SLOT(newFolderClicked()));

	line = new QWidget(this);
	line->setFixedWidth(1);
	line->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
	line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
	layout->addWidget(line, 0, 1, 6, 1);

	QWidget *about = new QWidget(this);
	about->setObjectName("aboutOSF");
	about->setStyleSheet("#aboutOSF { border-top: 1px solid #A3A4A5 ; }");
	layout->addWidget(about);

	QHBoxLayout *aboutLayout = new QHBoxLayout(about);
	aboutLayout->setSpacing(12);
	about->setLayout(aboutLayout);

	HyperlinkLabel *aboutOSF = new HyperlinkLabel(about);
	aboutOSF->setText("<a href='https://osf.io/getting-started/'>About the OSF</a>");

	HyperlinkLabel *registerOSF = new HyperlinkLabel(about);
	registerOSF->setText("<a href='https://osf.io/'>Register</a>");

	aboutLayout->addWidget(aboutOSF);
	aboutLayout->addWidget(registerOSF);
	aboutLayout->addStretch(1);
}
DWIDGET_USE_NAMESPACE

ControlWidget::ControlWidget(QWidget *parent)
    : QWidget(parent)
{
    m_songName = new QLabel;
    m_songName->setAlignment(Qt::AlignCenter);
    m_songName->setStyleSheet("color:white;"
//                              "background-color:red;"
                              "font-size:15px;"
                              "margin:0 35px 10px 5px;");
    m_volumeNums = new QLabel;
    m_volumeNums->hide();
    m_volumeNums->setStyleSheet("color:white;"
//                                "background-color:red;"
                                "font-size:13px;");
    m_prevSong = new DImageButton;
    m_prevSong->setNormalPic(":/icons/previous_normal.png");
    m_prevSong->setHoverPic(":/icons/previous_hover.png");
    m_prevSong->setPressPic(":/icons/previous_press.png");

    m_pauseSong = new DImageButton;
    m_pauseSong->setNormalPic(":/icons/pause_normal.png");
    m_pauseSong->setHoverPic(":/icons/pause_hover.png");
    m_pauseSong->setPressPic(":/icons/pause_press.png");

    m_nextSong = new DImageButton;
    m_nextSong->setNormalPic(":/icons/next_normal.png");
    m_nextSong->setHoverPic(":/icons/next_hover.png");
    m_nextSong->setPressPic(":/icons/next_press.png");
    m_volume = new DImageButton;
    m_volume->setNormalPic(":/icons/volume_normal.png");
    m_volume->setHoverPic(":/icons/volume_hover.png");
    m_volume->setPressPic(":/icons/volume_press.png");
    m_volume->installEventFilter(this);


    m_userswitch = new DImageButton;
    m_userswitch->setNormalPic(":/icons/userswitch_normal.png");
    m_userswitch->setHoverPic(":/icons/userswitch_hover.png");
    m_userswitch->setPressPic(":/icons/userswitch_press.png");


    m_shutdown = new DImageButton;
    m_shutdown->setNormalPic(":/icons/shutdown_normal.png");
    m_shutdown->setHoverPic(":/icons/shutdown_hover.png");
    m_shutdown->setPressPic(":/icons/shutdown_press.png");


    QHBoxLayout *volumeLayout = new QHBoxLayout;
    volumeLayout->addWidget(m_volumeNums);
    volumeLayout->setSpacing(0);
    volumeLayout->setMargin(0);

    QWidget *volumeWidget = new QWidget;
    volumeWidget->setFixedWidth(30);
    volumeWidget->setLayout(volumeLayout);

    QHBoxLayout *songCtrls = new QHBoxLayout;
    songCtrls->addWidget(m_prevSong);
    songCtrls->addWidget(m_pauseSong);
    songCtrls->addWidget(m_nextSong);
    songCtrls->addWidget(m_volume);
    songCtrls->addWidget(volumeWidget);
    songCtrls->setSpacing(0);
    songCtrls->setMargin(0);

    QVBoxLayout *songLayout = new QVBoxLayout;
    songLayout->addWidget(m_songName);
    songLayout->addStretch();
    songLayout->addLayout(songCtrls);
    songLayout->setSpacing(0);
    songLayout->setMargin(0);

    m_songControlWidget = new QWidget;
    m_songControlWidget->setLayout(songLayout);

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addStretch();
    mainLayout->addWidget(m_songControlWidget);
    mainLayout->setAlignment(m_songControlWidget, Qt::AlignBottom);
    mainLayout->addSpacing(10);
    mainLayout->addWidget(m_userswitch);
    mainLayout->setAlignment(m_userswitch, Qt::AlignBottom);
    mainLayout->addWidget(m_shutdown);
    mainLayout->setAlignment(m_shutdown, Qt::AlignBottom);

    setLayout(mainLayout);
    setFixedSize(500, 150);

    connect(m_shutdown, &DImageButton::clicked, this, &ControlWidget::shutdownClicked);
    connect(m_userswitch, &DImageButton::clicked, this, &ControlWidget::switchUser);
}