AddonManagementDialog::AddonManagementDialog(QWidget * p) : QWidget(p) { setWindowTitle(__tr2qs_ctx("Manage Addons - KVIrc","addon")); setObjectName("Addon manager"); setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Addons))); #ifdef COMPILE_WEBKIT_SUPPORT m_pWebInterfaceDialog = NULL; #endif //COMPILE_WEBKIT_SUPPORT m_pInstance = this; QGridLayout * g = new QGridLayout(this); KviTalHBox *hb = new KviTalHBox(this); hb->setMargin(1); hb->setSpacing(1); g->addWidget(hb,0,0); QToolButton * tb; QFrame * sep; m_pConfigureButton = new QToolButton(hb); m_pConfigureButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_ADDONS))); m_pConfigureButton->setIconSize(QSize(32,32)); KviTalToolTip::add(m_pConfigureButton,__tr2qs_ctx("Configure addon...","addon")); connect(m_pConfigureButton,SIGNAL(clicked()),this,SLOT(configureScript())); m_pHelpButton = new QToolButton(hb); m_pHelpButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_HELP))); m_pHelpButton->setIconSize(QSize(32,32)); KviTalToolTip::add(m_pHelpButton,__tr2qs_ctx("Show help","addon")); connect(m_pHelpButton,SIGNAL(clicked()),this,SLOT(showScriptHelp())); m_pUninstallButton = new QToolButton(hb); m_pUninstallButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_REMOVE))); m_pUninstallButton->setIconSize(QSize(32,32)); KviTalToolTip::add(m_pUninstallButton,__tr2qs_ctx("Delete selected addon","addon")); connect(m_pUninstallButton,SIGNAL(clicked()),this,SLOT(uninstallScript())); sep = new QFrame(hb); sep->setFrameStyle(QFrame::VLine | QFrame::Sunken); sep->setMinimumWidth(12); m_pPackButton = new QToolButton(hb); m_pPackButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_PACK))); m_pPackButton->setIconSize(QSize(32,32)); KviTalToolTip::add(m_pPackButton,__tr2qs_ctx("Create an addon as a distributable package","addon")); connect(m_pPackButton,SIGNAL(clicked()),this,SLOT(packScript())); sep = new QFrame(hb); sep->setFrameStyle(QFrame::VLine | QFrame::Sunken); sep->setMinimumWidth(12); tb = new QToolButton(hb); tb->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_OPEN))); tb->setIconSize(QSize(32,32)); KviTalToolTip::add(tb,__tr2qs_ctx("Install addon package from disk","addon")); connect(tb,SIGNAL(clicked()),this,SLOT(installScript())); tb = new QToolButton(hb); tb->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_WWW))); tb->setIconSize(QSize(32,32)); KviTalToolTip::add(tb,__tr2qs_ctx("Get more addons...","addon")); connect(tb,SIGNAL(clicked()),this,SLOT(getMoreScripts())); QWidget *w= new QWidget(hb); w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); m_pListWidget = new KviTalListWidget(this); KviTalIconAndRichTextItemDelegate *itemDelegate=new KviTalIconAndRichTextItemDelegate(m_pListWidget); m_pListWidget->setItemDelegate(itemDelegate); m_pListWidget->setSelectionMode(QAbstractItemView::SingleSelection); m_pListWidget->setSortingEnabled(true); m_pListWidget->setMinimumHeight(400); m_pListWidget->setMinimumWidth(380); g->addWidget(m_pListWidget,1,0); fillListView(); currentChanged(0,0); connect(m_pListWidget,SIGNAL(currentItemChanged(QListWidgetItem *,QListWidgetItem *)),this,SLOT(currentChanged(QListWidgetItem *,QListWidgetItem *))); m_pListWidget->setCurrentItem(m_pListWidget->item(0)); QPushButton * pCloseBtn = new QPushButton(__tr2qs_ctx("Close","addon"),this); pCloseBtn->setMaximumSize(pCloseBtn->sizeHint().width(),pCloseBtn->sizeHint().height()); connect(pCloseBtn,SIGNAL(clicked()),this,SLOT(closeClicked())); g->addWidget(pCloseBtn,2,0); g->setMargin(5); g->setSpacing(5); g->setAlignment(pCloseBtn,Qt::AlignRight); if(g_rectManagementDialogGeometry.y() < 5) { g_rectManagementDialogGeometry.setY(5); } resize(g_rectManagementDialogGeometry.width(), g_rectManagementDialogGeometry.height()); QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow); move(rect.x() + ((rect.width() - g_rectManagementDialogGeometry.width())/2),rect.y() + ((rect.height() - g_rectManagementDialogGeometry.height())/2)); new QShortcut(Qt::Key_Escape, this, SLOT(closeClicked())); }
bool processPackScriptCmd(CmdArgs* args) { return packScript(argSourcePath(args), argTargetPath(args)); }