mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
Adding Calendar Sharing UI: CalDialog
Currently not functional - Sample of UI for testing while underlying service is created. Included new calendar image and updated retroshare.pro file. Added to Unfinished items window. -Note: UI resize-to-window is not working properly and will be corrected. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@565 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
22bfc3e821
commit
844e6a6941
@ -51,6 +51,7 @@ HEADERS += rshare.h \
|
||||
gui/StartDialog.h \
|
||||
gui/ChatDialog.h \
|
||||
gui/BlogDialog.h \
|
||||
gui/CalDialog.h \
|
||||
gui/NetworkDialog.h \
|
||||
gui/GenCertDialog.h \
|
||||
gui/TransfersDialog.h \
|
||||
@ -152,6 +153,7 @@ HEADERS += rshare.h \
|
||||
|
||||
FORMS += gui/ChatDialog.ui \
|
||||
gui/BlogDialog.ui \
|
||||
gui/CalDialog.ui \
|
||||
gui/StartDialog.ui \
|
||||
gui/GenCertDialog.ui \
|
||||
gui/NetworkDialog.ui \
|
||||
@ -220,6 +222,7 @@ SOURCES += main.cpp \
|
||||
gui/GenCertDialog.cpp \
|
||||
gui/ChatDialog.cpp \
|
||||
gui/BlogDialog.cpp \
|
||||
gui/CalDialog.cpp \
|
||||
gui/NetworkDialog.cpp \
|
||||
gui/TransfersDialog.cpp \
|
||||
gui/graphframe.cpp \
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "ForumsDialog.h"
|
||||
#include "channels/channelsDialog.h"
|
||||
#include "BlogDialog.h"
|
||||
#include "CalDialog.h"
|
||||
|
||||
/* for smplayer */
|
||||
#include "smplayer.h"
|
||||
@ -72,6 +73,7 @@
|
||||
#define IMAGE_RSM16 ":/images/rsmessenger16.png"
|
||||
#define IMAGE_CLOSE ":/images/close_normal.png"
|
||||
#define IMAGE_SMPLAYER ":/images/smplayer_icon32.png"
|
||||
#define IMAGE_CALENDAR ":/images/calendar.png"
|
||||
|
||||
|
||||
/* Keys for UI Preferences */
|
||||
@ -119,6 +121,10 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
||||
ui.stackPages->add(blogDialog = new BlogDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_NETWORK), tr("Blog Feed"), grp));
|
||||
|
||||
CalDialog *calDialog = NULL;
|
||||
ui.stackPages->add(calDialog = new CalDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp));
|
||||
|
||||
|
||||
|
||||
//ui.stackPages->add(groupsDialog = new GroupsDialog(ui.stackPages),
|
||||
|
136
retroshare-gui/src/gui/CalDialog.cpp
Normal file
136
retroshare-gui/src/gui/CalDialog.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 Robert Fernie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
#include "common/vmessagebox.h"
|
||||
|
||||
//#include "rshare.h"
|
||||
#include "CalDialog.h"
|
||||
//#include "rsiface/rspeers.h"
|
||||
//#include "rsiface/rsrank.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
#include <QTimer>
|
||||
#include <QTableWidget>
|
||||
#include <QComboBox>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/** Constructor */
|
||||
CalDialog::CalDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
//declare local variables for GUI items
|
||||
name = ui.lne_name;
|
||||
location = ui.lne_location;
|
||||
status = ui.cbx_status;
|
||||
calendarList = ui.lst_calList;
|
||||
|
||||
//Set GUI Item Properties
|
||||
location->setEnabled(false);
|
||||
|
||||
//Create GUI Connections
|
||||
connect(ui.btn_add,SIGNAL(clicked()),this,SLOT(addItem()));
|
||||
connect(ui.btn_addFile,SIGNAL(clicked()),this,SLOT(addFile()));
|
||||
connect(ui.lst_calList,SIGNAL(itemPressed(QListWidgetItem*)),this,SLOT(setDetails(QListWidgetItem*)));
|
||||
connect(ui.btn_remove,SIGNAL(clicked()),this,SLOT(removeItem()));
|
||||
}
|
||||
|
||||
void CalDialog::addItem()
|
||||
{
|
||||
itemDetails = new CalItem();
|
||||
if(name->text() != QString(""))
|
||||
itemDetails->name = name->text();
|
||||
if(location->text() != QString(""))
|
||||
itemDetails->location = QString(location->text());
|
||||
itemDetails->status = status->currentIndex();
|
||||
|
||||
//Add Item to Calendar Item Map
|
||||
calItems.insert(itemDetails->name, *itemDetails);
|
||||
clearDetails(); //Clear Textbox Details (and itemDetails pointer)
|
||||
updateList(); //Update listWidget with new map data.
|
||||
}
|
||||
|
||||
void CalDialog::removeItem()
|
||||
{
|
||||
QListWidgetItem* item = calendarList->currentItem();
|
||||
calItems.remove(item->text());
|
||||
clearDetails();
|
||||
updateList();
|
||||
}
|
||||
|
||||
void CalDialog::updateList()
|
||||
{
|
||||
calendarList->clear(); //Clear existing items
|
||||
//Rebuild list from Map
|
||||
QMap<QString, CalItem>::iterator it;
|
||||
for(it = calItems.begin();it != calItems.end();++it)
|
||||
calendarList->addItem(it.key());
|
||||
}
|
||||
|
||||
void CalDialog::clearDetails()
|
||||
{
|
||||
name->setText("");
|
||||
location->setText("");
|
||||
status->setCurrentIndex(0);
|
||||
itemDetails = NULL;
|
||||
}
|
||||
|
||||
void CalDialog::addFile()
|
||||
{
|
||||
//Prompt for ICS calendar file
|
||||
QStringList file = QFileDialog::getOpenFileNames(this,
|
||||
"Select calendar to share",location->text(), "Calendars (*.ics)");
|
||||
|
||||
//Populate location LineEdit if file selected
|
||||
if(!file.empty())
|
||||
location->setText(*file.begin());
|
||||
}
|
||||
|
||||
void CalDialog::setDetails(QListWidgetItem* item)
|
||||
{
|
||||
clearDetails();
|
||||
QMap<QString, CalItem>::iterator it = calItems.find(item->text());
|
||||
CalItem temp = it.value();
|
||||
name->setText(temp.name);
|
||||
location->setText(temp.location);
|
||||
status->setCurrentIndex(temp.status);
|
||||
}
|
72
retroshare-gui/src/gui/CalDialog.h
Normal file
72
retroshare-gui/src/gui/CalDialog.h
Normal file
@ -0,0 +1,72 @@
|
||||
/****************************************************************
|
||||
* RetroShare GUI is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 Robert Fernie
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef _CALENDAR_DIALOG_H
|
||||
#define _CALENDAR_DIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QTableWidget>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
#include "mainpage.h"
|
||||
#include "ui_CalDialog.h"
|
||||
|
||||
class CalItem
|
||||
{
|
||||
public:
|
||||
CalItem() {return;}
|
||||
QString name;
|
||||
QString location;
|
||||
int status;
|
||||
};
|
||||
|
||||
class CalDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
CalDialog(QWidget *parent = 0);
|
||||
|
||||
private slots:
|
||||
void addItem();
|
||||
void removeItem();
|
||||
void updateList();
|
||||
void clearDetails();
|
||||
void addFile();
|
||||
void setDetails(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
//Should this be a vector for alphabetical sorting?
|
||||
QMap<QString, CalItem> calItems;
|
||||
CalItem *itemDetails;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::CalDialog ui;
|
||||
|
||||
QLineEdit* name;
|
||||
QLineEdit* location;
|
||||
QComboBox* status;
|
||||
QListWidget* calendarList;
|
||||
};
|
||||
|
||||
#endif
|
276
retroshare-gui/src/gui/CalDialog.ui
Normal file
276
retroshare-gui/src/gui/CalDialog.ui
Normal file
@ -0,0 +1,276 @@
|
||||
<ui version="4.0" >
|
||||
<class>CalDialog</class>
|
||||
<widget class="QWidget" name="CalDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>790</width>
|
||||
<height>492</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QTabWidget" name="tab_calendar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>771</width>
|
||||
<height>469</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Maximum" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="tabShape" >
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="elideMode" >
|
||||
<enum>Qt::ElideNone</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="localCal" >
|
||||
<attribute name="title" >
|
||||
<string>Local Calendars</string>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>201</width>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="lbl_calList" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Shared Calendar List</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QListWidget" name="lst_calList" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="formLayoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>70</y>
|
||||
<width>540</width>
|
||||
<height>301</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="lbl_name" >
|
||||
<property name="text" >
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="lne_name" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="lbl_location" >
|
||||
<property name="text" >
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLineEdit" name="lne_location" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QPushButton" name="btn_addFile" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="lbl_status" >
|
||||
<property name="text" >
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QComboBox" name="cbx_status" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Private</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Public</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="lbl_allow" >
|
||||
<property name="text" >
|
||||
<string>Allow List:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QListWidget" name="lst_allow" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string><Disabled></string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>372</y>
|
||||
<width>540</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_add" >
|
||||
<property name="text" >
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_remove" >
|
||||
<property name="text" >
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbl_calDetail" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>51</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Share Details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="peerCal" >
|
||||
<attribute name="title" >
|
||||
<string>Peer Calendars</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -31,6 +31,7 @@
|
||||
<file>images/attachment.png</file>
|
||||
<file>images/avatar_background.png</file>
|
||||
<file>images/backgroundimage.png</file>
|
||||
<file>images/calendar.png</file>
|
||||
<file>images/chat.png</file>
|
||||
<file>images/chat/bar_end.png</file>
|
||||
<file>images/chat/bar_fill.png</file>
|
||||
|
BIN
retroshare-gui/src/gui/images/calendar.png
Normal file
BIN
retroshare-gui/src/gui/images/calendar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Loading…
Reference in New Issue
Block a user