Пример #1
0
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->resize(275, 600);
    choosew = new ChooseWidget(this);
    //HeadButton *h = new HeadButton(this);
    /*
    list = new QListWidget(this);
    list->resize(200, 600);
    FriendWidget *f = new FriendWidget();
    QListWidgetItem *i = new QListWidgetItem();
    i->setSizeHint(QSize(200, 50));
    list->addItem(i);
    list->setItemWidget(i, f);

    tree = new QTreeWidget(this);
    tree->resize(275, 600);
    tree->move(200, 0);
    QStringList str;
    str << QObject::tr("张三");
    QTreeWidgetItem *treeitem = new QTreeWidgetItem(tree, str);
    QTreeWidgetItem *child1 = new QTreeWidgetItem(treeitem, str);
    treeitem->addChild(child1);
    */
    createTray();

    chat_server = new QTcpServer(this);
    chat_server->listen(QHostAddress::Any, 55554);
    connect(chat_server, SIGNAL(newConnection()), this, SLOT(receive_connection()));
    connect(choosew, SIGNAL(to_up_msg(QString,QString)), this, SLOT(send_msg(QString, QString)));
    connect(choosew, SIGNAL(new_conn(QString, QString)), this, SLOT(new_conn(QString, QString)));
    connect(this, SIGNAL(rec_msg(QString,QString)), choosew, SLOT(from_up_msg(QString,QString)));
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    createTray();
}
QtQuick1ApplicationViewer::QtQuick1ApplicationViewer(QWidget *parent)
    : QDeclarativeView(parent)
{
    connect(engine(), SIGNAL(quit()), SLOT(close()));
    setResizeMode(QDeclarativeView::SizeRootObjectToView);

    createActions();
    createTray();
}
TeachingLoginDialog::TeachingLoginDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::TeachingLoginDialog)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::WType_TopLevel|Qt::WStyle_StaysOnTop |Qt::WindowTitleHint);
    initWindow();
    createTray();
    createActions();
}
Пример #5
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    setWindowTitle(tr("To do"));
    QIcon icon = QIcon(":/pics/pencil.png");
    setWindowIcon(icon);

    thread = new MyThread();
    createActions();
    thread->start();
    createTray();
    trayIcon->setIcon(icon);
    trayIcon->show();
}
Пример #6
0
// updating UI from configdata
void MainWindow::updateUI()
{
    _ui->delayBox->setValue(_conf->getDelay());
    _ui->cbxTypeScr->setCurrentIndex(_conf->getDefScreenshotType());
    _ui->checkIncludeCursor->setChecked(_conf->getIncludeCursor());

    updateShortcuts();

    // create tray object
    if (_conf->getShowTrayIcon() && !_trayIcon)
        createTray();

    // kill tray object, if tray was disabled in the configuration dialog
    if (!_conf->getShowTrayIcon() && _trayIcon)
        killTray();
}
Пример #7
0
/**
 * Set-up additional ui elements
 * @brief MainWindow::initializeUiElements
 */
void MainWindow::initializeUiElements()
{
    ui->txtMessage->installEventFilter(this);

    //Hide close button from the first tab, which should always be visible.
    ui->tabgrpConversations->tabBar()->tabButton(0, QTabBar::RightSide)->resize(0, 0);

    //Connect filemenu actions
    connect(ui->actionScan_Lan, SIGNAL(triggered()), controller, SLOT(scanLan()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->actionSet_nickname, SIGNAL(triggered()), this, SLOT(setNickname()));
    connect(ui->actionClear_current_window, SIGNAL(triggered()), this, SLOT(clearTab()));

    //Create list of smileys and add to current ui-list.
    smileys = new QList<QListWidgetItem*>;
    for (int i = 0; i < 40; ++i)
    {
        QListWidgetItem* qlwi = new QListWidgetItem(QIcon(RES_SMILEYS + QString::number(i) + ".png"), "");
        smileys->append(qlwi);
        ui->lstSmileys->addItem(qlwi);
    }

    createTray();
}
Пример #8
0
/*!
 * Конструктор класса DaemonUi.
 */
DaemonUi::DaemonUi(QWidget *parent)
  : QDialog(parent, Qt::Tool)
  , m_core(0)
  , m_feeds(0)
  , m_plugins(0)
  , m_pool(0)
  , m_storage(0)
{
  Path::init(LS("schatd2"));

  m_settings = new Settings(Path::data() + LS("/schatd2.conf"), this);

  loadTranslation();

  m_toolBar = new QToolBar(this);
  m_toolBar->setIconSize(QSize(22, 22));
  m_toolBar->setStyleSheet(LS("QToolBar{margin:0px;border:0px;}"));

  m_menu = new QMenu();

  createActions();
  createButtons();

  m_controlGroup = new QGroupBox(this);
  QHBoxLayout *controlGroupLay = new QHBoxLayout(m_controlGroup);
  controlGroupLay->addWidget(m_toolBar);
  controlGroupLay->setMargin(2);
  controlGroupLay->setSpacing(0);

  // Отображение статуса
  m_statusLabel = new QLabel(this);
  m_ledLabel = new QLabel(this);
  m_statusGroup = new QGroupBox(this);
  QHBoxLayout *statusGroupLay = new QHBoxLayout(m_statusGroup);
  statusGroupLay->setMargin(2);
  statusGroupLay->setSpacing(0);
  statusGroupLay->addWidget(m_statusLabel);
  statusGroupLay->addStretch();
  statusGroupLay->addWidget(m_ledLabel);

  QHBoxLayout *controlLay = new QHBoxLayout;
  controlLay->addWidget(m_controlGroup);
  controlLay->addWidget(m_statusGroup);

  m_siteBtn = new QToolButton(this);
  m_siteBtn->setStyleSheet(LS("QToolButton{color:#0066cc;background:none;border:none} QToolButton:hover{text-decoration:underline}"));
  m_siteBtn->setText("schat.me");
  m_siteBtn->setFocusPolicy(Qt::NoFocus);
  m_siteBtn->setCursor(Qt::PointingHandCursor);
  m_siteBtn->setIcon(QIcon(":/images/globe-blue.png"));
  m_siteBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

  // Кнопки внизу окна
  QHBoxLayout *bottomLay = new QHBoxLayout;
  bottomLay->addWidget(m_siteBtn);
  bottomLay->addStretch();
  bottomLay->addWidget(m_hideButton);
  bottomLay->addWidget(m_quitButton);

  // Все основные виджеты
  QVBoxLayout *bodyLay = new QVBoxLayout;
  bodyLay->setMargin(6);
  bodyLay->setSpacing(6);
  bodyLay->addLayout(controlLay);
  bodyLay->addLayout(bottomLay);

  // Надпись вверху окна
  m_aboutLabel = new QLabel(QString(
      "<html><body style='color:#333;margin:6px;'>"
      "<h4 style='margin-bottom:0px;'>Simple Chat Daemon %1</h4>"
      "<p style='margin-left:16px;margin-top:5px;'>Copyright © 2008-%2 Alexander Sedov &lt;<a href='mailto:[email protected]' style='color:#0066cc;'>[email protected]</a>&gt;</p>"
      "</body></html>").arg(SCHAT_VERSION).arg(QDateTime::currentDateTime().toString("yyyy")), this);
  m_aboutLabel->setStyleSheet("background:#fff; border:4px solid #fff;");
  m_aboutLabel->setOpenExternalLinks(true);

  QFrame *line2 = new QFrame(this);
  line2->setFrameShape(QFrame::HLine);
  line2->setFrameShadow(QFrame::Sunken);

  // End
  QVBoxLayout *mainLay = new QVBoxLayout(this);
  mainLay->setMargin(0);
  mainLay->setSpacing(0);
  mainLay->addWidget(m_aboutLabel);
  mainLay->addWidget(line2);
  mainLay->addLayout(bodyLay);

  createTray();
  setState(Unknown);

  setWindowIcon(QIcon(":/images/schat16-green.png"));

  retranslateUi();

  QTimer::singleShot(0, this, SLOT(init()));

  connect(m_siteBtn, SIGNAL(clicked()), SLOT(openSite()));
}